Slashdot Mirror


PHP Contest: Revenge of the Apple Eating Robots

Zack Coburn writes "The latest Codewalkers' PHP Coding Contest invites PHP programmers to write a script in PHP to interface with a judging library and play 'Apple Eating Robots,' a game based on the classic Unix console game called Robots. According to the contest description, the goal is 'to avoid robots, eat apples, and kill robots by forcing them to hit each other in order to get the highest score.' For judging, 'at least 100 rounds will be played. In the end, the sum of all points earned will determine the winner. In the case of a tie, the running time will be the tie-breaker.' According to an e-mail sent out to Codewalkers users, 'The PHP Coding Contest is now in its third year since inception and touts $2,000 worth of prizes. The first ten places will earn a prize, so even if you aren't the top winner, you have a chance at winning something.' Prizes for the current contest include Macromedia Studio MX, Zend Studio, PHPEd, and SourceGuardian Pro."

66 comments

  1. Crapple by maelstrom · · Score: 0, Offtopic

    Why do you hate Apple so much?

    --
    The more you know, the less you understand.
    1. Re:Crapple by Anonymous Coward · · Score: 0, Offtopic

      Why don't you check the post anonymously box?

  2. The Prize is Software? by netsharc · · Score: 3, Funny

    Heck, I know sources I can get the prize for free... offer something tangible why don't you.

    Well, name recognition would be in it too, I guess. So one might be able to get a job coding PHP. Although, the standard things PHP is used for doesn't exactly require advanced AI-beating algorithms, it's more boring and tedious representation of data -- "wow, a forum, with comments..."

    --
    What time is it/will be over there? Check with my iPhone app!
    1. Re:The Prize is Software? by Anonymous Coward · · Score: 3, Funny

      Bah... people offer free stuff and it's just not good enough for the 'eleet' of the world. what a shame...

      d00d, U m33n 1337!?!? \/\/3 4r3 7a|k1ng a60u7 \/\/AR3Z |-|3r3 d00d!!!!! U53 1227 5p33k!!!!!!!!!!!!!!!!!!!!!!

    2. Re:The Prize is Software? by krumms · · Score: 2, Funny

      I think I speak for all employed PHP web application developers when I say "Fuck you."

      Now if you'd stop bothering me with your smart ass comments, I'll get back to writing my forum^H^H^H^H^H complex CPU-intensive business application ... :/

    3. Re:The Prize is Software? by Woy · · Score: 1

      That's the point. We're used to getting stuff for free, in very different contexts, from warez to gpl software. Free is no longer enough, they'll have to try harder.

      --
      "If God created us in his own image we have more than reciprocated." - Voltaire
    4. Re:The Prize is Software? by Anonymous Coward · · Score: 0

      I've seen "^H^H^H" in a lot of posts. What does it actually mean?

    5. Re:The Prize is Software? by Zach978 · · Score: 2, Informative

      ^H = Backspace

      --

      "I told you a million times not to exaggerate!"
    6. Re:The Prize is Software? by Anonymous Coward · · Score: 0

      Thanks, never thought of that :-) It makes sense now, thought it was some kind of weird smiley.

  3. Comment removed by account_deleted · · Score: 1, Offtopic

    Comment removed based on user account deletion

  4. Why Apple? why not PC by VEGx · · Score: 0, Offtopic
    Stupipd robots eating Macs, can't they eat PCs or something?

    no one touches my PowerBook!

  5. PHP will SAVE the World from Evil !! by Anonymous Coward · · Score: 2, Funny


    sod writing in code in assembler, its PHP from now on !!, all those big companies use it like Eba.. no Amazo.. uhm uhm well my friend uses it on his blog

    1. Re:PHP will SAVE the World from Evil !! by kubla2000 · · Score: 2, Informative

      I think you were thinking of Yahoo.

      http://news.com.com/2100-1023-963937.html?tag=lh

    2. Re:PHP will SAVE the World from Evil !! by proudlyindian · · Score: 1

      .. if the rules do not depend on the sex of the robot .. else we can have surprises ...
      Striving to be common...

    3. Re:PHP will SAVE the World from Evil !! by Anonymous Coward · · Score: 0

      The language is called Assembly NOT assembler, you dork.

    4. Re:PHP will SAVE the World from Evil !! by brettbender · · Score: 1

      I believe you meant Yahoo.

    5. Re:PHP will SAVE the World from Evil !! by LaBlueCow · · Score: 1

      Not to nitpick, but many oldschool coders (Finland, Sweden, etc. - the demoscene) also called it "assembler" when leaving out the "language" qualifier. It was called Assembly Language, ASM, assembly, assembler, etc.

      --
      [SQL Error ID 10-T: This sig. is above your current threshold.]
  6. Re:Why Apple? why not PC by mphase · · Score: 0, Offtopic

    Since I can't decide if your serious I'm going to respond like you are. That said: FRUIT YOU NINNY, FRUIT!

  7. Why *apples*? by pedantic+bore · · Score: 4, Funny
    I was hoping that robots would be free of original sin, but no. Well, I guess if I can't find a robot that's smart enough to vacuum my living room without getting wedged beneath the couch, I shouldn't expect to find a robot smart enough to resist forbidden fruit.

    Well, let's hope all they want is a little revenge, and not their come-uppence.

    --
    Am I part of the core demographic for Swedish Fish?
  8. Speaking of which... by Anonymous Coward · · Score: 2, Interesting

    ..are there any good free PHP debuggers yet?

    1. Re:Speaking of which... by Anonymous Coward · · Score: 1, Informative

      for what on earth do you need a PHP debugger?
      you got echo, print, printf, var_dump, print_r, debug_backtrace.

      Though http://de3.php.net/manual/en/debugger.php sais there are debugger out there.

      But honestly. I have never needed one. As the previous mentioned function did all what I needed to even debug complex scripts.

      kindest regards,
      mo

    2. Re:Speaking of which... by rasjani · · Score: 3, Informative

      PHP has a debugger build in. Check out this php website

      --
      yush
    3. Re:Speaking of which... by messju · · Score: 2, Informative

      even if dmitri is working at zend now, there is http://dd.cron.ru/dbg/ . it's good and free.

    4. Re:Speaking of which... by rasjani · · Score: 1

      Well mm.. I kinda meant this as funny but i guess it goes as informative too =))

      --
      yush
    5. Re:Speaking of which... by shiflett · · Score: 2, Informative

      APD. It's been around for several years (it was hosted elsewhere before being moved to PECL in 2002).

  9. Eating Apples? by beacher · · Score: 1

    I thought we were pro Apple! It should be avoid the robots, break down gates, and make the robots crash into each other.. I know what you're thinking... Lets the robots crash into the gates... It hard keeping the gates up, they tend to crash by themself...

  10. Waste of talent by Anonymous Coward · · Score: 0

    Why not make the competition about something useful?
    Oh no lets make anoter hype contest which result noone will be able to use to anything productive :P

  11. Sorry if redundant... Where can i get classic src? by Anonymous Coward · · Score: 1, Interesting

    Article says it's classic UNIX game, Robots, but i have never heard of it and want to try.

    Where can i get sources? Where is Robots homepage?
    How interesting is it?

  12. Whew. by Anonymous Coward · · Score: 0

    It's a good thing they didn't decide to use a webpage scripting language for this. That would be a disaster. What next, Windows Longhorn written in ASP?

    1. Re:Whew. by Anonymous Coward · · Score: 0

      Actually, you are far off yet very close to the truth. ASP.NET (wich is completelly diferent from ASP) is based on the .NET framework. Every page is a class, is an object. It uses a complete programming language like C# or Visual Basic.NET instead of a simple scripting language like PHP.

      And yes, Longhorn is supposed to run WinFX wich is a larger version of .NET and every application is written in managed code and standard compiled apps will be kept for compatibility. Therefore, programming in Longhorn will be closer to programming in ASP.NET than you think.

    2. Re:Whew. by NuclearDog · · Score: 0

      Maybe it's just me, but I use PHP for more than just website scripting. I use it to script quite a few other non-website tasks, since it makes it a lot easier.

      ND

      --
      This statement is forty-five characters long.
  13. Better hope you don't come in tenth by Anonymous Coward · · Score: 4, Funny

    1 month free hosting from TheHostingCompany.us. (Platinum Package)

    How exactly is this a prize? What are you going to do, cancel with your current ISP, transfer your website over to this place, wait a month, sign back up with your original ISP again, and transfer back?

    One year's hosting, that would be a prize. One month? That's not a prize--that's a burden (and, obviously, just a promotional gimmick).

    I hereby announce my own set of prizes for the 11th through the 20th place contestants. Each person placing 11th through 20th will have one free week's rent in an apartment, selected by me, on the opposite side of the country from their current residence, under the conditions that (1) they move all of their furniture in and unpack everything they own completely before the week is up, (2) they pack everything back up and move all of it back out by 5:00 PM the final day, (3) they sell their current residence to someone they don't know, and (4) they buy back their old place after the week is up.

    As an alternative, I will also permit the winners to remain in their new apartments, AS LONG AS they pay me a $1000 stipend every six weeks.

    Good luck, everybody!

    1. Re:Better hope you don't come in tenth by double_h · · Score: 1

      How exactly is this a prize?

      No, it's not a great prize, but 20GB of transfer on a fast pipe could be moderately useful, even for just a month (to host an iso image or mid-sized video clip). In any case it's only one of 16 prizes, and probably a better one than a t-shirt or one year's DNS registration (though that too could be fun for goofing off purposes).

    2. Re:Better hope you don't come in tenth by Anonymous Coward · · Score: 0

      20GB of transfer on a fast pipe could be moderately useful, even for just a month (to host an iso image or mid-sized video clip)

      Yeah, let's see, 20GB would mean exactly 32 people could download the 625MB ISO for Slackware 9.1 disc one before bumping against the transfer limit....

      I can't wait to win and become an official Slackware mirror site! ;-)

  14. A contest worthy of /. logic by michaeldot · · Score: 2, Funny

    1. Avoid robots

    2. Eat apples

    3. PROFIT!

    1. Re:A contest worthy of /. logic by ps_inkling · · Score: 1
      Actually, it is /. logic, since you get points for all apples on the board when the robots are destroyed. (Rule 6)

      1. Avoid robots

      2. ...

      3. Profit!

      Looks like I'll be playing lots of RobotFindsKitten as a warmup exercise...

  15. Ummm... wrong slashdot section? by Anonymous Coward · · Score: 0

    Instead of the Developers section of Slashdot, shouldn't this be in the Apple section?

    TDz.

  16. Question about PHP: by Anonymous Coward · · Score: 0

    is the rest of the language as insanely fucked up as what they call arrays?

    1. Re:Question about PHP: by LaBlueCow · · Score: 1

      Agreed that PHP arrays (and variables in general) are a bit screwy, but if you're not doing anything intense, it's actually a relief to just take a bunch of unknown types and stuff them into an array, pull them out as needed without having to create a dynamic static overloaded operational matrix of classes (or somesuch).

      --
      [SQL Error ID 10-T: This sig. is above your current threshold.]
  17. Apple-eating? by Big+Nothing · · Score: 1

    "a game based on the classic Unix console game called Robots"

    I guess it's old-style, so... that would be old Apple ]['s they're eating?

    --
    SIG: TAKE OFF EVERY 'CAPTAIN'!!
  18. Re:Sorry if redundant... Where can i get classic s by Exiler · · Score: 1

    Robots is part of the popular BSD Games collection, which you can find or in your favorite distro's package repository.

    --
    Banaaaana!
  19. Re:Sorry if redundant... Where can i get classic s by Anonymous Coward · · Score: 0

    Messed up the HTML, That was supposed to be a "[linked]here[/link] or in..." but you get the idea

  20. Re:Sorry if redundant... Where can i get classic s by taviso · · Score: 4, Informative

    it's usually distributed as part of a collection called "bsd games", if you use Linux try here.

    --
    ex$$
  21. Robot championship by Roland+Piquepaille · · Score: 0

    Here you can read about evolutionary computing, where teams of mobile robots with neural networks playing the Capture the flag game.

    1. Re:Robot championship by Anonymous Coward · · Score: 0

      A piece of advice: If you want people to click on your links, don't use TinyURL, which is primarily used to hide offensive images (goatse, tubgirl, etc.). Just use the URL directly.

  22. I have nothing better to do by Phidoux · · Score: 1

    so I'm gonna get coding right away. Oh... But this'll cut into my /. time! Oh well... I guess the one is almost as much of a waste of time as the other.

  23. $2000? by SilentChris · · Score: 1

    *Calculates* That's less than what most developers make in a week or two. Coming up with something that'll win the top prize will probably take more than a few weeks of after-hours or programming (or during work-hours, if you're risky). Heck, those who play in those video game tournaments get more money. I'd pass.

    1. Re:$2000? by LaBlueCow · · Score: 1

      For $2000, I'd take a shot. The logic can't be THAT difficult - for every frame, find the nearest 'bot. If it can't get to you in less than 2 or so turns, move. If you're cornered, teleport (if that's still part of the game, that may have been an offshoot of the original). Avoiding 'bots takes priority over killing bots, which is above getting apples. The only slightly difficult part would be to make the 'bots crash. Considering some of the programming tasks we got in second-level college C++, this excercise seems like 2-day cake. Good enough for $2000, if you ask me.

      --
      [SQL Error ID 10-T: This sig. is above your current threshold.]
    2. Re:$2000? by NuclearDog · · Score: 0

      Yeah, but do most PHP developers code stuff like this at work? Maybe a forum or a backend system, definatly not an AI.

      ND

      --
      This statement is forty-five characters long.
  24. Re:Why Apple? why not PC by AndroidCat · · Score: 2, Funny

    They tried having them eat mushrooms, but after a few, the results became unpredictable. Some started playing some nonsense tune about badgers, others just quietly exploded.

    --
    One line blog. I hear that they're called Twitters now.
  25. Re:Sorry if redundant... Where can i get classic s by AndroidCat · · Score: 3, Informative
    You can get RoboCode which is decended from it and uses Java for robot programming. (Covered on Slashdot at least once.)

    I'm not sure that the Unix robots was the first such game. Wasn't there an Apple II commercial game that sparked it all off? After that, there were variants everywhere. (There was even an HP3000 version that used a RPN Forth-like language.)

    --
    One line blog. I hear that they're called Twitters now.
  26. Sound like RealTimeBattle by stesch · · Score: 1
    RealTimeBattle

    OK, this idea goes way back to CoreWars. PHP or Redcode? Hmm. Not so easy to decide ... :-)

  27. Other Sites that Run Coding Challenged by Dozix007 · · Score: 1

    I run the Uberhacker website. This site is dedicated to secure PHP programming. We are currently running a Gauntlet challenge to see who can create the most secure scripts of a specific type. This round, the challenge is to create an Article Submition System.

  28. Syntax error in their provided code! by Blarfy_Snarflepoop · · Score: 2, Funny
    I should get the prize already - notice the missing endquote?
    /* "height" will be between
    100 and 1000 */
    "height => 100-1000;
    --
    No sig for you.
  29. Best Use? by Tellalian · · Score: 2, Interesting

    I'm a big fan of PHP, but is this really the best usage for this language?

    This is a game, so ideally, some real-time graphical output would be nice. Yet isn't that not the nature of PHP? PHP's web-centric, so you're usually generating html. If I wanted to write a game that has to run continuously I'd write it in a general purpose programming language like python (or c++ if I was feeling masochistic ;). Python has a simple syntax and a standard GUI library, along with scores of additional modules for graphics, sounds, and almost anything else you can think of. I don't want to sound like I'm evangelizing python, but is this contest really the best test of ones PHP skills?

  30. how about a useful contest... by SethJohnson · · Score: 1


    How about a contest to see who can make PHPnuke impervious to brazillian script kiddies? I'd put up $500 cash to see that accomplished.
  31. Online version of the game by Otto · · Score: 1

    An online version of the game can be found here: http://www.robinjohnson.f9.co.uk/robots2/robots2.h tml

    --
    - Give a man a fire and he's warm for a day, but set him on fire and he's warm for the rest of his life.
  32. Thoughts on the algorithm needed... by Otto · · Score: 4, Informative

    Okay.. You only have 9 possible moves. So on each turn, you run through all your possible moves, one at a time. After each move you can make, you calculate what the robots will do (since this is known), and then make a choice.
    -If a move will get you killed, you eliminate it as a possibility.
    -If all moves will get you killed, you teleport and hope for the best.

    The only real choice is when you have more than one move that will keep you alive, and just a few rules can make this fairly obvious on what to do.

    -If all the robots are in line with you and there's a scrap pile between them and you, stand your ground. They'll eventually run into the scrap.
    -If a move will make robots collide, bump it up in priority a bit. Bump collisions that eliminate robots that are closer to you higher than collisions happening far away.
    -If a move will bring robots closer to each other on the same line, bump it up in priority a bit, because this sort of thing will eventually cause them to collide. Give extra priority to bringing together robots that are closer to you, because scrapheaps closer to you protect you from robots further away from you.
    -If a move will get you closer to any robots, lower it in priority a bit, because you want to keep your distance when possible. This should be less than the above priority adjustment because to bring robots together you need to have them on opposite sides of you, either vertically or horizontally.

    Once you've done that, you pick the move with the highest priority. Then it's just a matter of tweaking these priority adjustments by hand until you find one that works good.

    Apples are a null factor. The only way it states to end the game is to kill all the robots, and it says you get all the remaining apples after that anyway. So going after them is pointless with the rules as written. If getting all the apples also ends the game, then that's something else to consider as a factor, and makes it a bit more complicated.

    --
    - Give a man a fire and he's warm for a day, but set him on fire and he's warm for the rest of his life.
    1. Re:Thoughts on the algorithm needed... by iMMersE · · Score: 1

      The killer here is the speed of PHP - The maps they are talking about are big (905x730, 10,631 apples, 1,950 robots, but could be 1,000x1,000, 20,000 apples and 10,000 robots), and you have to play through an entire game in 60 seconds.

      An non-optimal routine I wrote takes about 4s to evaluate each move (Using something like the rules you outlined) on a 2.4Ghz P4. So it's going to take some serious optimisation to get it to the point it can play a decent number of moves.

      The first one is to play out the game without calling their routines, that way the overhead of creating nicer-to-work with data structures is minimised. This way, you work out all your moves until you need to randomly jump, and just replay them all to their code. You're probably wanting to make a couple of hundred, though, so still a long way to go.

      I definitely agree though that the way to go at this problem is to kill robots and, incidentally, picking up apples along the way.

      Interesting problem, I just not convinced that using PHP and having a 60 second limit is the way to go ...

      --
      codegolf.com - smaller *is* better.
  33. functions library by StarDeath88 · · Score: 2, Informative

    Am I the only one who can't access the site at the moment? I already have a script mostly made thank you google chache) and would like to test it... Would someone mind emailing it to me/mirroring it?

    --
    a+b=c 4a-3a+4b-3b=4c-3c 4a+4b-4c=3a+3b-3c 4(a+b-c)=3(a+b-c) 4=3
    1. Re:functions library by mt1955 · · Score: 1

      You're not the only one, I haven't been able to since yesterday. Is it the aktari thing?