PDA

View Full Version : Robocode


Dru Lee Parsec
09-13-2002, 05:06 PM
Ok, I was tempted not to post this until after I got back from vacation. But it's too cool not to mention.

Robocode is a Java based programming game. There are several robots (essentially tanks) in an arena. The robots can move, they can rotate their gun, they can shoot their gun, and they can rotate their radar. You write code that extends either a Robot or AdvancedRobot class. This code tells your robot how to behave. You then put several of your robots into the arena and let them shoot it out.

There are very clear instructions on how to build the robots. The entire game was written as a teaching tool for learning the Java language. Don't worry if your robots can't beat the best robots (that use various AI techniques). Just try to make one that works and dishes out a reasonable amount of damage. THEN you can improve your AI.

Robocode is here:
http://robocoderepository.com/

A good starter article is here:
http://www-106.ibm.com/developerworks/library/j-robocode/

Some great articles on how to build artificial intelligence into your robots is here:
http://www-106.ibm.com/developerworks/java/library/robotips/

Have fun with it and I'll see you folks after the 23rd.

DLP

Strike
09-13-2002, 06:56 PM
Hrm, this sounds like a Competition thread brewing .... :)

stuka
09-13-2002, 07:16 PM
robocode is cool...I've played with it a bit, but it's tougher than it seems, to be sure!

kmj
09-15-2002, 02:47 PM
A couple guys in my DAI class used this for their project last year. It's pretty neat. Wish I had time to play with it.

inkedmn
09-15-2002, 09:40 PM
i noticed that last week someplace, not sure where though...

looks pretty cool, might be worth checking out :)

GnuVince
09-15-2002, 10:44 PM
Why is this a Java-only competition though? I mean, the one at ICFP is really interesting, because you see different coding techniques depending on the languages.

kmj
09-15-2002, 11:34 PM
Originally posted by GnuVince
Why is this a Java-only competition though? I mean, the one at ICFP is really interesting, because you see different coding techniques depending on the languages.

From Dru's post:
"The entire game was written as a teaching tool for learning the Java language."

GnuVince
09-16-2002, 10:00 AM
Originally posted by kmj


From Dru's post:
"The entire game was written as a teaching tool for learning the Java language."

That's exactly my question: why wasn't this competition meant to learn other languages? Why couldn't they make a competition where you could write a Robot in Java or in C++ or in C# or in XXX for example? Why only Java? Unless this was in part funded by Sun Microsystems or another big Java player, I can't see why players had to do it only in Java.

kmj
09-16-2002, 11:38 AM
perhaps the developers

a) Were interested in teaching people java, not just programming

b) Did not have the time available to work on a project of such a large scope. Clearly, it would have required a much greater effort.


I suggest, if you want something like you describe, start working on it!

sicarius
09-20-2002, 01:53 PM
I understand you point vince, but it is kind of like asking "why can't a hockey player hit the puck with a baseball bat?" The only answer is because those are the rules.

Dru Lee Parsec
09-24-2002, 08:47 PM
Dang this is tough! I built a robot that goes in a square instead of just forward and backwards like the example MyFirstRobot. If it hits a wall it moves to the center of the battle field. And if it bumps into another robot it blast the robot with a full strength bullet.

But I still can't beat a simple MyFirstRobot!

This is frustrating. I think I need to add code to "lead" my target when shooting. That should give me a big advantage. But I'm surprised that I'm not winning already against such a simple robot.

All that code and my now robot is slightly dumber. :( If I extend Advanced robot I think I could win easily, but I'd like to see if I can build a non-multithreaded robot first that at least beats the example bot.


BTW, for your coding pleasure I've attached the robot as it exist so far.

Dru Lee Parsec
09-25-2002, 08:24 PM
OK, I got one that can beat MyFirstRobot consistently. It's a version of a RamBot with code to recover from a Wall hit.

Now, if I can figure out how to post my code again I would. but the upload file button seems to be missing.

Dru Lee Parsec
09-25-2002, 08:27 PM
Found it! Here it is