fr.umlv.botbattle
Interface BotContext


public interface BotContext

Context send to a bot by the game. This interface permits the bot to interact with the game by asking information using info(infoType) or acting using nextTurn(action).

Version:
1.0
Author:
remi

Nested Class Summary
static interface BotContext.Action<R extends BotContext.ActionResponse>
          marker interface of all actions allowed to a bot.
static interface BotContext.ActionResponse
          marker interface of all responses retruns by the game.
static interface BotContext.Info
          marker interface of all informations provided by the game.
 
Method Summary
 Set<? extends Class<? extends BotContext.Action>> actionTypes()
          Actions interfaces provided by the game to the bot.
 int getVersion()
          Version of the game.
<I extends BotContext.Info>
I
info(Class<I> infoType)
          return an object provided by the game that implements interfaces specified by infoType.
 Set<? extends Class<? extends BotContext.Info>> infoTypes()
          Informations interfaces provided by the game to the bot.
<R extends BotContext.ActionResponse,A extends BotContext.Action<R>>
R
nextTurn(A action)
          Ask the game to execute an action by the current bot.
 

Method Detail

getVersion

int getVersion()
Version of the game. Default version is 1

Returns:
the version value

infoTypes

Set<? extends Class<? extends BotContext.Info>> infoTypes()
Informations interfaces provided by the game to the bot. Theses classes can be used as argument of info(Class) to obtain an object implementing the interface. version 1 of the game required interfaces : GameInfo, ArenaInfo and BombInfo.

Returns:
a set of all interfaces provided by the game.
See Also:
info(Class)

info

<I extends BotContext.Info> I info(Class<I> infoType)
return an object provided by the game that implements interfaces specified by infoType.

Type Parameters:
I - type of the interface.
Parameters:
infoType - class of the interface.
Returns:
an object that implements the interface.
Throws:
IllegalArgumentException - if infoType is not one of interfaces returns by infoType().
See Also:
infoTypes()

actionTypes

Set<? extends Class<? extends BotContext.Action>> actionTypes()
Actions interfaces provided by the game to the bot. These interfaces specify all actions allowed to the bot by the game.

Returns:
a set of all actions allowed by the game.
See Also:
nextTurn(BotContext.Action)

nextTurn

<R extends BotContext.ActionResponse,A extends BotContext.Action<R>> R nextTurn(A action)
                                             throws DeadBotException
Ask the game to execute an action by the current bot. This method blocks until the action is treated by the game.

Type Parameters:
A - type of the action.
R - type of the response corresponding to the action.
Parameters:
action - to performs, this action may be null if the bot just want to wait until the next game turn.
Returns:
a response to the requested action.
Throws:
DeadBotException - if the current bot is dead.
IllegalArgumentException - if the action is not a recognized action of the game.
See Also:
actionTypes(), GameInfo.isAlive(), GameInfo.getTourTime()