- Install Robocode the usual way: download robocode-1.9.3.4-setup.jar from here and run the setup jar to install Robocode into your home directory with:
java -jar robocode-1.9.3.4-setup.jar
- Clone this repo to a local directory with:
git clone https://github.com/athenian-programming/robocode-example.git
-
Make sure you have Java 1.8 installed.
-
Open the repo with IntelliJ
Check Use auto-import
Group modules: *using explicit module groups
Uncheck Create separate module per source set
Gradle JVM: 1.8
- Click on File -> Project Structure... to open the project's structure.
Project SDK: 1.8
Project language level: 8 - Lambdas, type annotations etc.
-
Select Build -> Build Project to compile the project's java code.
-
Click on Run -> Edit Configurations..., then click on + and select Application from the list and create a configuration with these values:
Name: Robocode
Main class: robocode.Robocode
VM options: -Xmx512M -Dsun.io.useCanonCaches=false -Ddebug=true
Working directory: /Users/username/robocode
Use classpath of module: org.athenian.robocode-example.main
JRE: 1.8
-
Run the newly created configuration to start Robocode.
-
Once started, select Options -> Preferences -> Development Options on the Robocode app, and add robocode-example/out/production/classes and robocode-example/out/production/resources from the cloned robocode-example repo and click Finish.
- Start a Robocode battle by going to Robocode and selecting Battle -> New. Add the org.athenian.SimpleRobot, sample.Crazy, and sample.Fire robots and then click Start Battle.