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

Set the result to draw.

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"

Link to this function

from_pgn_file(file)

Import game from pgn file.

Returns a new game from initial position fen. It is possible to pass a fen as Game initializer.

Link to this function

play(game, move)

Plays a move.

Prints a game current position.

Resign a game.

Link to this function

set_result(game, result)

Set result of the game.

Export the history move list to pgn string.