-
ended(won, reason)
-
This is called when the game ends, you can clean up your data and dump files here if need be.
Name |
Type |
Description |
won |
boolean
|
True means you won, false means you lost. |
reason |
string
|
The human readable string explaining why you won or lost. |
-
Array.<Tile>
findPath(start, goal)
-
A very basic path finding algorithm (Breadth First Search) that when given a starting Tile, will return a valid path to the goal Tile.
Name |
Type |
Description |
start |
Tile
|
the starting Tile |
goal |
Tile
|
the goal Tile |
Returns:
Array.<Tile>
array of Tiles representing the path, the the first element being a valid adjacent Tile to the start, and the last element being the goal.
-
gameUpdated()
-
This is called every time the game's state updates, so if you are tracking anything you can update it here.
-
string
getName()
-
This is the name you send to the server so your AI will control the player named this string.
Returns:
string
The name of your Player.
-
boolean
runTurn()
-
This is called every time it is this AI.player's turn.
Returns:
boolean
Represents if you want to end your turn. True means end your turn, False means to keep your turn going and re-call this function.
-
start()
-
This is called once the game starts and your AI knows its playerID and game. You can initialize your AI here.