chess_logic v0.3.0 ChessLogic.Position

Documentation for Position.

Link to this section Summary

Functions

Returns all possible moves from a position.

Returns all possible moves from a given piece, or square.

Check if king is attacked.

Returns a san from a move string, given a set of possible moves. Game history persists a san version of move, for PGN export eg. "e2e4" -> "e4", "e4" -> "e4"

Plays a move and returns new position.

Prints a position.

Returns a coords move (eg. "e2e4") from san (eg. "e4")

Returns position status.

Returns a fen string from a position.

Link to this section Functions

Link to this function

all_possible_moves(position)

Returns all possible moves from a position.

Link to this function

all_possible_moves_from(position, start_piece)

Returns all possible moves from a given piece, or square.

Link to this function

from_fen(fen \\ "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")

Returns a position from a fen string.

Link to this function

is_king_attacked(position)

Check if king is attacked.

Link to this function

move_to_san(position, move)

Returns a san from a move string, given a set of possible moves. Game history persists a san version of move, for PGN export eg. "e2e4" -> "e4", "e4" -> "e4"

Link to this function

play(position, move)

Plays a move and returns new position.

Link to this function

print(position)

Prints a position.

Link to this function

san_to_move(position, san)

Returns a coords move (eg. "e2e4") from san (eg. "e4")

Link to this function

status(position)

Returns position status.

Link to this function

to_fen(position)

Returns a fen string from a position.