Battlecode 2022
Battlecode is an MIT AI competition run every year throughout the month of January. At
the beginning of the month, they release a new 2 player game, at which point teams have to
code up a bot that plays said game. There are multiple tournaments throughout the month,
ending in a tournament for the top 16 teams out of the hundreds that submit code for cash
prizes.
This is my battlecode 2022 project, where three friends and I programmed an automated
robot player to play in the Battlecode competition.
Qualified for finals and placed 7th among 250+ teams
internationally.
Check out the code
here!
For a more in-depth explanation of the game and our player, check out our
post-mortem!
Read about some of the cool engineering we had to do below, since I also competed in Battlecode in 2021!
Battlecode 2021
Qualified for finals and placed 9th among 250+ teams
internationally. You can see a sample match of our robot (red) vs another qualified team Monky (blue) below.
Check out the code
here!
For a more in-depth explanation of the game and our player, check out our
post-mortem!
The rules were very restrictive about the communication that troops could use between each other. As a result, we were forced to use only 24 bits for one troop to communicate with another one. Coordinating attacks with these semantics were difficult, but we were able to come up with a smart solution, where we used bit-packing to encode the type of message being sent in the top 6 bits, and actual information in the bottom 18 bits. For example, we needed to encode the location of enemies, so we were able to store a dx and dy from home base inside these bit-packed messages.
There were also strict bytecode limits in the rules. This meant that we could not use any standard libraries that Java provided, as they incurred too much overhead. We had to develop our own map and set libraries. This involved using StringBuilder and separating keys and values by a simple caret symbol. StringBuilder operations were not costly, so we were now able to resume standard use of maps and sets after implementing this framework.
For in-depth information about our strategy, please take a look at our post-mortem!