chess_logic v0.3.0 ChessLogic.Game
Documentation for Game.
The main entity,
April 2018, klg September 2019, v0.3.0
Link to this section Summary
Functions
Set the result to draw.
Import game from pgn string.
Import game from pgn file.
Returns a new game from initial position fen. It is possible to pass a fen as Game initializer.
Plays a move.
Prints a game current position.
Resign a game.
Set result of the game.
Export the history move list to pgn string.
Link to this section Functions
draw(game)
Set the result to draw.
from_pgn(pgn)
Import game from pgn string.
Returns a list of games, as pgn could contain multiple trees
The string MUST BE utf8! Otherwise, add :iconv and use new_string = :iconv.convert "utf-8", "ascii//translit", string
Example : Chess.from_pgn "[White \"Calistri, Tristan\"]\n[Black \"Bauduin, Etienne\"]\n 1. e4 c5"
from_pgn_file(file)
Import game from pgn file.
new()
Returns a new game from initial position fen. It is possible to pass a fen as Game initializer.
new(fen)
play(game, move)
Plays a move.
print(game)
Prints a game current position.
resign(game)
Resign a game.
set_result(game, result)
Set result of the game.
to_pgn(game)
Export the history move list to pgn string.