This is a slightly modified version of Norbert Schneider's Robocode Template at: https://github.com/bertschneider/RobocodeTemplate It contains the Robocode API (version 1.9.3.0) from: http://robocode.sourceforge.net/
This little project can be used as template for your first Robocode robots and automated battles.
For example it should be a good starting point for a tournament in your company...
- Set the
robotlocation
property in thepom.xml
to your Robocode robots folder
In a tournament this could be a network fileshare or some other shared location. - Import the Maven project into an IDE of your choice
- Change the name of the
de.metro.TestRobot
Java and properties file to the name of your robot - Set the new classname of your robot in the properties file
- Implement a superior robot
- Build the robot jar with the Maven command
mvn clean install
The name of the output file/jar is generated using the user.name
Maven variable.
You could also set your own artifact name just make sure it is a unique name.
- Make sure the robots are deployed into your Robocode robots folder
If you use a network fileshare to exchange the robots you could create a link to that folder - Copy
misc/battles.battle
into your Robocode battles folder - Add the classnames of the participating robots to the
selectedRobots
property in the battle file - Run the following command in your Robocode folder
java -Xmx1024M -cp libs/robocode.jar robocode.Robocode -battle battles\battles.battle -results results.txt
- Watch the fight!
- Edit
robotlocation
property for dev profile adding therobot
directory path from your robocode installation - For seeing a battle between two instances of your robot, run
mvn -Pdev clean install exec:exec
.
- Robocode Website
- Robocode API
- Robocode Getting Started
- Robocode Wiki
- robocode@github
- Rock 'em, sock 'em Robocode!
- Robocode Lessons
As far as I can tell there are no Maven dependencies available. So the Robocode API was installed in a local repository in the project with the following Maven command:
mvn install:install-file -Dfile=robocode.jar \
-Dsources=robocode-1.9.3.0-sources.jar \
-Djavadoc=robocode-1.9.3.0-javadoc.jar \
-DgroupId=net.sf.robocode
-DartifactId=robocode.api \
-Dversion=1.9.3.0 \
-Dpackaging=jar \
-DgeneratePom=true \
-DcreateChecksum=true \
-DlocalRepositoryPath=lib
The sources can also be found on Github at github.com/robo-code/robocode.