Welcome to the battlecode hackathon!
- Download a copy of this repository here or fork / clone it.
- Install a recent version of node.js (> 8). If you already have Node installed, you can check which version you have with
node --version
in your terminal. - Open a terminal / command prompt.
- Run
npm install -g @battlecode/battlehack
.- If you're on linux, you might need
sudo
.
- If you're on linux, you might need
- Run
battlehack start
and leave that terminal running. Make sure thathttp://localhost:8080/
has opened in your browser. - Open a new terminal;
cd
into thehackathon-starter/python
directory and runpython player.py
. - Open a third and last terminal;
cd
into thehackathon-starter/python
directory and runpython player.py
again. - You should now be able to watch a game run in your browser.
- Open
player.py
and start hacking!
Note: you should ignore run.sh
for now.
- Download a copy of this repository here or fork / clone it.
- Install a recent version of node.js (> 8). If you already have Node installed, you can check which version you have with
node --version
in your terminal. - Open a terminal / command prompt.
- Run
npm install -g @battlecode/battlehack
.- If you're on linux, you might need
sudo
.
- If you're on linux, you might need
- Run
battlehack start
and leave that terminal running. Make sure thathttp://localhost:8080/
has opened in your browser. - Create a Java project wherever you'd like. Import
java/battlehack17.jar
into your project. - Copy RobotPlayer.java to get yourself started. You'll need a main function, with a game loop.
- To run, use your IDE. Make sure you run your program twice so that the two copies can fight each other.
- You should now be able to watch a game run in your browser.
- Open RobotPlayer.java and start hacking!
Note: you should ignore run.sh
for now.
See website: http://battlehack.mit.edu/#/releases
There is documentation for the Python API in python/battlecode-docs.txt
and python/battlecode-docs.html
.
There is documentation for the Java API in python/battlecode-docs.txt
and python/battlecode-docs.html
.
Note: the matchmaking server doesn't open until 2PM.
-
Python:
- Go into the
python
directory. - Make sure that
run.sh
runs your main player. - Run
battlehack upload
and answer the prompts. - Win all the glory!
- Go into the
-
Java:
- When you're ready to submit, use your IDE to generate a jar containing both the extracted contents of battlehack17.jar, as well as your code. Mark your main class in the jar's manifest (your IDE will give you an option to do so).
- IntelliJ version: File > Project Structure > Artifacts > JAR (remember to select where your main() is!)
- Put
run.sh
andyour_package_name.jar
in the same directory. - Modify
run.sh
and replaceyour_package_name.jar
with the jar file's name. - Go into the directory with
run.sh
andyour_package_name.jar
and answer the prompts. - Win all the glory!
Technically, we support other languages besides python 2, python 3, and java, but you'll have to do a lot more work to use any of them. Talk to the devs for more information.
The source code for the competition is at https://github.com/battlecode/battlecode-hackathon. Feel free to peruse it.