Class AI

the AI functions for the Chess game.

Fields

self.game The reference to the Game instance this AI is playing.
self.player The reference to the Player this AI controls in the Game.

Methods

AI:getName () this is the name you send to the server to play as.
AI:start () this is called once the game starts and your AI knows its playerID and game.
AI:gameUpdated () this is called when the game's state updates, so if you are tracking anything you can update it here.
AI:ended (won, reason) this is called when the game ends, you can clean up your data and dump files here if need be
AI:makeMove () This is called every time it is this AI.player's turn to make a move.


Fields

self.game
The reference to the Game instance this AI is playing.

See also:

self.player
The reference to the Player this AI controls in the Game.

See also:

Methods

AI:getName ()
this is the name you send to the server to play as.
AI:start ()
this is called once the game starts and your AI knows its playerID and game. You can initialize your AI here.
AI:gameUpdated ()
this is called when the game's state updates, so if you are tracking anything you can update it here.
AI:ended (won, reason)
this is called when the game ends, you can clean up your data and dump files here if need be

Parameters:

  • won boolean true means you won, won == false means you lost
  • reason string why you won or lost
AI:makeMove ()
This is called every time it is this AI.player's turn to make a move.

Returns:

    string A string in Universal Chess Interface (UCI) or Standard Algebraic Notation (SAN) formatting for the move you want to make. If the move is invalid or not properly formatted you will lose the game.
generated by LDoc 1.4.3 Last updated 2020-11-07 17:28:14