This is our team's (Team DOS) bot for the 2019 Sharif AI Challenge, written in Java. It ranked first on the competition leaderboard.
This is a turn-based strategy game where two teams of four heroes compete on a grid map. The four hero classes are Blaster, Sentry, Healer and Guardian. Every turn has three phases:
- Pick: choose the heroes for the team.
- Move: move heroes across the map toward the objective zone.
- Action: use abilities (attack, heal, dodge, fortify) against the other team.
The full rules are in AIC19/other/GameDesignDoc_V1.4.pdf.
All of our strategy code is in AIC19/src/code/, about 4,400 lines. The rest of src/ is the client the organizers provided.
Manage.java: the entry point. It sends each phase of the turn to the right handler.PickHandler.java: chooses a team composition based on the map. It includes preset line-ups such as 4 Healers, 4 Guardians, 2 Blasters + 2 Sentries, and 1 Blaster + 3 Sentries.MovementHandler.javaandNav.java: move the heroes. They use BFS pathfinding to the objective zone and other targets, and plan the best move for each turn.ActionHandler.java: chooses abilities and targets each turn.Blaster.java,Sentry.java,Healer.java,Guardian.java: the logic specific to each hero class, built on a shared base inAhero.java.Util.javaandFastMath.java: helpers for distances, line of sight and fast math.
- Import
AIC19into Eclipse or IntelliJ as a Java project, and addgson-2.3.1.jarto the classpath. - Start the game server:
cd AIC19/other
java -jar server.jar- Run
client.Mainto connect the bot. The maps used in the practice and qualifier rounds are inAIC19/other/Maps/.
- Java
- Gson
- JSON over sockets (from the provided client)