AMazeBot 2016 API: Overview

All bot programs must be placed in a subpackage of bots. For the competition this subpackage must have the same name as your submission ID (e.g. AM16_42), but otherwise it can be any valid Java identifier. At minimum a bot program is contained in a class called Brain, which extends BotBrain. Additionally other classes may be present in the package. Note therefore that it is the package name and not the class name that identifies your bot. It is done this way to allow you break up your code into several classes and not incur any risk of conflicting with other bots.

Brain

This class is where the system will call your code. There are only 2 required methods: public String getName() and public void run(). The getName() method should return a string containing your bot's preferred nickname. The system will use this in the competition.

The run() method is where all the action happens. Your code will call methods of the BotBrain class to control the bot. You should use the getStartPosition() to discover your bot's location, and getGoalCorner() can be used to determine the location of the goal. Both the start position and the goal will be different from maze to maze.

Compass

A large part of running a maze is exploring, and what good explorer is without a compass? The Compass class is used for representing the cardinal directions (East, South, West, North). You can use this class for all your directional needs. It is less error-prone than attempting to write your own class, or worse, using constants.

Basics of Movement

A bot's position is represented by a Point, which has x and y coordinates. The top-left cell of the maze is considered (0, 0) and the bottom-right cell is (28, 28). As you move EAST a bot's x coordinate is incremented by 1 and as you move SOUTH the y position is incremented by 1. To move your bot you use the move method with a direction (eg. Compass.SOUTH).  Before you actually move you may want to check to see that the location is not a wall by using the look method.

BotBrain

BotBrain is the class that you must extend, and its methods are the primary API you need to know to write your bot programs. See this page for complete documentation on all availalbe methods in BotBrain class.