====== Robocode Introduction ====== * See http://robocode.sourceforge.net/ * Robocode is a programming game where the goal is to code a robot to compete against other robots in a battle arena. The player is the programmer of the robot, who will have no direct influence on the game. Instead, the player must write the AI of the robot telling it how to behave and react on events occurring in the battle arena. * The game is designed to help you learn Java, and have fun doing it. Robots are written in the Java(TM) Programming Language, and the Robocode game can run on any operating system supported by the Java Platform, which includes all common operative systems like Windows, Mac OS X, Linux etc. * See the Robocode [[http://robocode.sourceforge.net/docs/ReadMe.html|ReadMe]] file for a more detailed introduction. ==== Getting Started ==== * Install * In HH 305, download the latest robocode*.setup.jar archive available at http://tinyurl.com/n7e3tge. * Install robocode to the default folder. The instructor will guide you here. * Run robocode: * From the "Applications" menu -> "Local Programs" -> "Robocode" * OR... * Start a Terminal, type ''robocode'' and hit Enter. * Start the robot editor in robocode. * Code an autonomous robot. * [[http://robowiki.net/wiki/Robocode/My_First_Robot|My First Robot Tutorial]] **(READ THIS FIRST)** * [[http://testwiki.roborumble.org/w/index.php?title=Robocode/Robot_Anatomy|Anatomy of a Robot]] * [[http://testwiki.roborumble.org/w/index.php?title=Robocode/Getting_Started|Getting Started]] * [[http://testwiki.roborumble.org/w/index.php?title=Robocode/Game_Physics|Game Physics]] **(READ THIS)** * [[http://robocode.sourceforge.net/docs/robocode/robocode/Robot.html|LIST OF ROBOT METHODS]] **(VIEW THIS)** * [[http://testwiki.roborumble.org/w/index.php?title=Robocode/Scoring|Scoring]] * Robots are saved under ~/.robocode/robots/ as one .java and .class file per robot. ==== Lab Program - Your own Robocode robot ==== * Using [[http://robowiki.net/wiki/Robocode/My_First_Robot|"My First Robot"]] as a starting point, write and test your own Robocode robot. * Try moving your robot in various ways first, using methods such as ahead(), back(), turnRight() and turnLeft(). * Then try methods such as onHitWall() to avoid getting stuck on walls. * Use the LIST OF ROBOT METHODS: http://robocode.sourceforge.net/docs/robocode/robocode/Robot.html * Hints and Strategies * The robot sample.RamFire goes after the first robot detected. * This is not a good strategy overall, but if you want to program your robot to go after an enemy bot, look at sample.RamFire. * You will lose energy if you run into a wall or into another robot. * Many people have found that the sample.Walls robot does very well in competition. * Thus, it is wise if you test your robot against it. * Try packaging your robot in robocode to share robots with other students. * If you have not already done so, create a ''cs175'' or ''cs501a'' folder under your home directory; you may use the file manager for this. * Copy your robot code (.java file) or your packaged robot (.jar file) to your ''cs175'' or ''cs501a'' folder. ==== Additional Information ==== * Future Robocode tournament announcement * [[http://rockhopper.monmouth.edu/cshelp/Robocode_Tournament_Fall_2009|Robocode Tournament Fall 2009 info & results]] * http://robocode.sourceforge.net/developerWorks.php * Strategies for Robocode * Random walk * Divide-and-conquer * Circular movement * Bullet dodging * Prediction ----