Older Contests
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP ContestsOlder Contests

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #16  
Old March 7th, 2003, 10:10 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

Doing some testing i discovered that collapsing the grid takes almost 90% of the total time! I really have to code a better collapsing function :-

Reply With Quote
  #17  
Old March 7th, 2003, 11:07 AM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

Through a more proper if coding i am now able to complete 50x50x8 in 22 secs

Now a question. I have the grid in a multidimension table of the form grid[$i][$j] = $tile. If i recode the whole script to work with a singe string, will i see a significant improvment in the speed?

Reply With Quote
  #18  
Old March 7th, 2003, 11:30 AM
mcoder mcoder is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 130 mcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

>Now a question. I have the grid in a multidimension table of the form grid[$i][$j] = $tile. If i recode the whole script to work with a singe string, will i see a significant improvment in the speed?

Multidimensional arrays are VERY SLOW in PHP !
Try something else.

JC

Reply With Quote
  #19  
Old March 7th, 2003, 01:29 PM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

Hmmmm, i converted only the collpasing function to work with a single string and to my surprise it is a little SLOWER than working with the multidimensional grid! I wonder why some people say that arrays are slow?

Reply With Quote
  #20  
Old March 7th, 2003, 02:01 PM
mcoder mcoder is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 130 mcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

I didn't say arrays are slow.
I said MULTIDIMENSIONAL arrays are slow !

BTW, I optimized my programme a little bit more, and get 14 seconds for a 50*50 grid on my 2.4Ghz (with the dumb heuristic of removing the longest set of tiles every move).

JC

Reply With Quote
  #21  
Old March 7th, 2003, 11:21 PM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: RE: [Down-n-Out]max board size 300x300 ?


Quote:
I didn't say arrays are slow.
I said MULTIDIMENSIONAL arrays are slow !

BTW, I optimized my programme a little bit more, and get 14 seconds for a 50*50 grid on my 2.4Ghz (with the dumb heuristic of removing the longest set of tiles every move).

JC


Are you implying that $grid[$i][$j] is not a multidimensional array?

Also, 50x50 and how many tile types? 3, 5, 8? It makes a lot of difference.

Reply With Quote
  #22  
Old March 8th, 2003, 12:02 AM
mcoder mcoder is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 130 mcoder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

>Are you implying that $grid[$i][$j] is not a multidimensional array?

Replace your multidimensional array grid[x][y] by grid[y*XMAX+x], and you should notice a difference !
PHP handles multi-dimensional arrays in a strange way (just print_r your array).

>Also, 50x50 and how many tile types? 3, 5, 8? It makes a lot of difference.

8 colors, and I'm now below 10s.
But it seems that marcel's program performs a lot better than mine (around 15% faster) :-(((

I guess at least 5 or 6 guys will be able to write very fast programs (50*50*8 in less than 30 seconds). It's just a matter of time, and the contest will finish in 3 weeks.
This gives us plenty of time to write a good heuristic.

JC

Reply With Quote
  #23  
Old March 8th, 2003, 12:20 PM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

It seems i misunderstood you earlier. I converted the multidimensional grid in a grid of type grid[x] = line_contents. The good thing is that i can access this type the same way i did with the previous grid. So without making any other change i now get 13.6 for 45x45x8 and 19.8 for 50x50x8. Previously i got 14 and 22.5 respectively. As it is obvious, the improvement increases more as the grid size increases.

Reply With Quote
  #24  
Old March 8th, 2003, 02:34 PM
fractalbit fractalbit is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 108 fractalbit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: [Down-n-Out]max board size 300x300 ?

I am happy to report that through some more optimizations, i am able to complete a 50x50x8 grid in 11.5secs! That is less than 13.6 that i get with the code that matt posted. So it seems that i am within the time limt for all grids

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [Down-n-Out]max board size 300x300 ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway