API
This is the collection of all the data that your bot has access to during the generation of a mach as well as all the methods that it can use in order to control game entities.
On this page you can find references for:
- InitialData - Gives you match state and all the constants when the match starts
- MatchState - Gives you access to match state during the match generation
- Response object - With it you can control your game units, make them move, spawn new ones, etc.
InitialData
Bot receives InitialData object only once at the beginning of the match. It holds the following data:
mapWidth: int- In world unitsmapHeight: int- In world unitsmap: boolean[][]- Two dimensional list of booleans. If atmap[y][x]the value istrueit means that at(y,x)there is a tile on which the unit can be placed. If the value isfalseit means that there is a hole in the map through which the unit can fall and die.map[0][0]represents the bottom left corner of the map.sawSpawnDelay: int- After how many match updates a new pair of saws spawnyourUnit: Unit- Data about your unitx: int- x location of the unity: int- y location of the unitpoints: int- Number of points the unit has gatheredlives: int- Number of lives the unit has left
opponentUnit: Unit- Data about the opponent unit, the same type asyourUnitcoins: list of Coin objects- List of all the coins on the map, each holding the data below:x: int- x location of the coiny: int- y location of the coin
saws: list of Saw objects- List of all the saws on the map, each holding the data below:x: int- x location of the sawy: int- y location of the sawdirection: SawDirection- The direction towards which the saw is traveling, can beUP_LEFT,UP_RIGHT,DOWN_LEFTandDOWN_RIGHT.
__matchDetails: MatchDetails- A few details about the match and participating botsyourBotIndex: int- Index of the bot in botsDetails to which this instance of MatchDetails was sent tobotsDetails: list- List of all bots that participate in this match with their detailsbotName: stringteamIndex: int
MatchState
Bot receives MatchState every update call which equals to every half a match second. It holds the data about what is going on with match entities at a current time during the match.
time: float- Current match time in secondsyourUnit: Unit- Data about your unitx: int- x location of the unity: int- y location of the unitpoints: int- Number of points the unit has gatheredlives: int- Number of lives the unit has left
opponentUnit: Unit- Data about the opponent unit, the same type asyourUnitcoins: list of Coin objects- List of all the coins on the map, each holding the data below:x: int- x location of the coiny: int- y location of the coin
saws: list of Saw objects- List of all the saws on the map, each holding the data below:x: int- x location of the sawy: int- y location of the sawdirection: SawDirection- The direction towards which the saw is traveling, can beUP_LEFT,UP_RIGHT,DOWN_LEFTandDOWN_RIGHT.
Response object
Using Response object you can communicate with the match generator and tell it what you want your unit to do. You can use the following method:
moveUnit(Direction direction)- Tells match generator to move the unit towards a certain direction. Possible directions are
LEFT,RIGHT,UPandDOWN.
- Tells match generator to move the unit towards a certain direction. Possible directions are