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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old May 23rd, 2004, 12:52 AM
YaiEf YaiEf is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 YaiEf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[appleeaters]Robots don't die?

Well, I think this screenshot speaks for itself: http://webselect.dk/error.gif

After that the robot (or robots) just kept getting closer till I died ... I guess that's a bug. Happy chasing

Also - regarding the speed of it all ... the maximum matrix is pretty massive with 1000x1000 and several thousand apples and robots. Have you done any worst case scenario testing? It would be a real help if you told everybody how many moves you could expect to make in the worst case scenario even with minimal code ... I have a feeling that unless you have some pretty hefty machines to run it on then it won't be all that many.

Frankly it seems kinda stupid for a script that already runs for upwards 60 seconds that you have to be really careful with your coding ... and in a language like PHP. It just seems like a pseudobarrier that people are forced to code up against - it's not about coming up with a brilliant solution to this game but rather trying to stay within the boundries of max runtime. It just doesn't feel right when I'm already considering using an internal counter so I can commit suicide when the time approaches 60 seconds ...

Reply With Quote
  #2  
Old May 23rd, 2004, 12:57 AM
YaiEf YaiEf is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 4 YaiEf User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[appleeaters]RE: Robots don't die?

And btw - 5 (stay in place) doesn't seem to be the default.

The command is empty when not calling it with anything - which equates to 0 - which means teleportation.

Reply With Quote
  #3  
Old May 23rd, 2004, 01:07 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[appleeaters]RE: Robots don't die?

I agree that the 60 second limitation seems odd for overall script execution.. 60 seconds between moves would be more realistic, also since there is now way to end the game without dying or killing all the robots (which could take hundreds of moves) it makes more sense.. That's kinda what I've been working of using set_time_limit(0) before move() and set_time_limit(60) after (doing the same thing with start() so it doesn't timeout on a huge matrix)
php Code:
Original - php Code
  1.  
  2. $game    = $robots->start();
  3. .
  4. .
  5. .
  6. $game = $robots->move($move);

Make more sense if it was part of the library, but ya know

Reply With Quote
  #4  
Old May 23rd, 2004, 01:09 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[appleeaters]RE: Robots don't die?

Last post was me.. Really should register..

-- Tresni (tresni AT crackmonkey DOT us)

Reply With Quote
  #5  
Old May 23rd, 2004, 04:52 AM
sturtx sturtx is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Fairfax, VA, USA
Posts: 1 sturtx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
[appleeaters]RE: Robots don't die?

I noticed the same problem. Robots didnt always die when they ran into each other or into dead robots. I'm using the PHP that comes standard with redhat9.

Here's my fix to robotslib.php:

remove:

php Code:
Original - php Code
  1.  
  2.         foreach($this->game["robots"] as $key=>$robot){
  3.             $search=array_search($robot,$this->game["robots"]);
  4.             if ($search<>FALSE and $search<>$key){
  5.                 echo "Two robots collided at (".$robot[0].",".$robot[1].")n";
  6.                 unset($this->game["robots"][$key]);
  7.                 unset($this->game["robots"][$search]);
  8.                 array_push($this->game["deadrobots"],$robot);
  9.                 continue;
  10.             }
  11.             $search=array_search($robot,$this->game["deadrobots"]);
  12.             if ($search<>FALSE and $search<>$key){
  13.                 echo "A robot and a dead robot collided at (".$robot[0].",".$robot[1].")n";
  14.                 unset($this->game["robots"][$key]);
  15.                 array_push($this->game["deadrobots"],$robot);
  16.             }
  17.         }


and replace it with:

php Code:
Original - php Code
  1.  
  2.  
  3.         foreach($this->game["robots"] as $key=>$robot){
  4.             $search = array_keys($this->game["robots"], $robot);
  5.             if((count($search) > 1) || (count(array_keys($this->game["deadrobots"],$robot)) > 0)) {
  6.               foreach($search as $rmkey) {
  7.             unset($this->game["robots"][$rmkey]);
  8.               }
  9.               if(! in_array($this->game["deadrobots"], $robot )) {
  10.             array_push($this->game["deadrobots"],$robot);
  11.               }
  12.             }
  13.         }
  14.  


haven't tested extensively, but this seemed to fix the problems i could see.

Dan Sturtevant

Reply With Quote
  #6  
Old May 24th, 2004, 02:42 AM
Jeff321 Jeff321 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Near Chicago, IL, USA
Posts: 45 Jeff321 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Jeff321
[appleeaters]RE: Robots don't die?

Example of robot not dying:

http://jeff321.com/projects/robots/1.jpg
light blue = player, Green = apple, red = robot, dark red = dead robot

http://jeff321.com/projects/robots/2.jpg
Robot lands on the dead robot, and I'm going to eat the apple...

http://jeff321.com/projects/robots/3.jpg
Status showing apple eaten but robot still alive

http://jeff321.com/projects/robots/4.jpg
Robot went right through dead robot.

Reply With Quote
  #7  
Old May 24th, 2004, 09:33 AM
zackcoburn zackcoburn is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 184 zackcoburn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
[appleeaters]RE: Robots don't die?

Jeff, run your script on the latest robotslib.php and tell me if you have the same problem with robots not dying.

Reply With Quote
  #8  
Old May 24th, 2004, 10:03 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
[appleeaters]RE: Robots don't die?

The new lib, proparlly kills robots for me. Infact now that the robots die my script is undeafted in my small game (width/height <200) test cases now to work on the lame movement optimizations and other silliness :/.

Reply With Quote
  #9  
Old May 26th, 2004, 08:44 PM
Jeff321 Jeff321 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Near Chicago, IL, USA
Posts: 45 Jeff321 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Jeff321
[appleeaters]RE: Robots don't die?

I think it's good now but if I notice anything odd I'll let you know.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP ContestsOlder Contests > [appleeaters]Robots don't die?


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 |