
May 23rd, 2004, 06:58 PM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 22,309
Time spent in forums: < 1 sec
Reputation Power: 25
|
|
|
[appleeaters]Faster Robotslib?
Is it just me, or is anyone else finding the 60 seccond limit kinda tough? I think that the robotslib could be (and should be) made faster..
My suggestion is to instead of haveing have an array of all robots, and an array of all apples (each with their own array of coordinates), have a single multi dimensional array for the entire board. So if there was a robot at position (500,251), you could find it in $board[500][251]. This would allow you to write faster algorithms to find the closest apple/robot by simply running an algorithm that spirals out from the location of the player until it finds the first apple or the first robot. This would keep the algorithms from having to loop over every single robot/apple and give the code developers (us) more freedom in the complexity of algorithms we can run.
In each $board[$x][$y] you could have another array with properties...
example: $board[$x][$y] = array('apple'=>true,'robot'=>false,'deadrobot'=>true);
Its probably too late for you guys to do this, because it would change the way that the returned $game variable looks, but I think that this would make things much better.
Btw... what kind of scores is everyone else in here getting with their algorithms? (just so I can get an Idea of what I am up against..) Currently, my *best* (fluke) score is 2611 (this happened because there were only about a dozen robots spawned), but my average score that I am getting now is ~ 450 but my algorithm is still under construction.
Also, one other quick question.. What kind of server/pc are you going to be running this on? Because the amount of processing done in the 60 seccond timeout limit will vary from machine to machine...
|