Liking cljdoc? Tell your friends :D

clj-chess.core


add-commentclj/s

(add-comment game cmt & {:keys [node-id]})

Adds a comment to the move leading to the node with the given node id. Uses current node if no node id is supplied. Adding a comment at the root of the game has no effect; if you want to add a comment before the first move of the game, use add-pre-comment instead.

Adds a comment to the move leading to the node with the given node id.
Uses current node if no node id is supplied. Adding a comment at the root
of the game has no effect; if you want to add a comment before the first
move of the game, use add-pre-comment instead.
sourceraw docstring

add-key-value-pairclj/s

(add-key-value-pair game key value & {:keys [node-id]})

Adds a key value pair to the map at the given node id of the game. If no node id is supplied, the key value pair is added at the current node.

Adds a key value pair to the map at the given node id of the game. If no
node id is supplied, the key value pair is added at the current node.
sourceraw docstring

add-moveclj/s

(add-move game move-function move node-id remove-existing-moves?)

Takes a game, a move function (a function that, given a board and some other value, translates that value to a chess move), a a value representing a move, a node id, and a boolean that says whether the existing moves at the current nodes should be removed, and returns an updated game where the move has been added as the last child at the given node. If no node id is supplied, the current node of the game is used.

Takes a game, a move function (a function that, given a board and
some other value, translates that value to a chess move), a
a value representing a move, a node id, and a boolean that says whether the
existing moves at the current nodes should be removed, and returns an
updated game where the move has been added as the last child at the given
node. If no node id is supplied, the current node of the game is used.
sourceraw docstring

add-move-sequenceclj/s

(add-move-sequence game move-function moves node-id remove-existing-moves?)

Like add-move, but adds a sequence of moves rather than a single move. This is faster than calling add-move multiple times, because we don't have to unzip and zip the tree for each added move. If remove-existing-moves? is true, any previously existing moves at the point of insertion are removed.

Like add-move, but adds a sequence of moves rather than a single move. This
is faster than calling add-move multiple times, because we don't have to
unzip and zip the tree for each added move. If remove-existing-moves? is
true, any previously existing moves at the point of insertion are removed.
sourceraw docstring

add-pre-commentclj/s

(add-pre-comment game cmt & {:keys [node-id]})

Adds a pre-comment to the node with the given node-id. Uses the current node if no node id is supplied. When exporting as PGN, the pre-comment is displayed before the move rather than after. It is probably only useful for the first move of the game or the first move of a recursive annotation variation.

Adds a pre-comment to the node with the given node-id. Uses the current
node if no node id is supplied. When exporting as PGN, the pre-comment is
displayed *before* the move rather than after. It is probably only useful
for the first move of the game or the first move of a recursive annotation
variation.
sourceraw docstring

add-san-moveclj/s

(add-san-move game san-move & {:keys [node-id remove-existing-moves?]})

Adds a move in short algebraic notation to a game at a given node id. The move is added as the last child. If no node id is supplied, the current node of the game is used. If remove-existing-moves? is true, any previously existing moves at the point of insertion are removed.

Adds a move in short algebraic notation to a game at a given node
id. The move is added as the last child. If no node id is supplied,
the current node of the game is used. If remove-existing-moves? is true,
any previously existing moves at the point of insertion are removed.
sourceraw docstring

add-san-move-sequenceclj/s

(add-san-move-sequence game
                       san-moves
                       &
                       {:keys [node-id remove-existing-moves?]})

Like add-san-move, but adds a sequence of moves rather than a single move. This is faster than calling add-san-move multiple times, because we don't have to unzip and zip the tree for each added move. If remove-existing-moves? is true, any previously existing moves at the point of insertion are removed.

Like add-san-move, but adds a sequence of moves rather than a single move.
This is faster than calling add-san-move multiple times, because we don't
have to unzip and zip the tree for each added move. If
remove-existing-moves? is true, any previously existing moves at the point
of insertion are removed.
sourceraw docstring

add-uci-moveclj/s

(add-uci-move game uci-move & {:keys [node-id remove-existing-moves?]})

Adds a move in UCI notation to a game at a given node id. The move is added as the last child. If no node id is supplied, the current node of the game is used. If remove-existing-moves? is true, any previously existing moves at the point of insertion are removed.

Adds a move in UCI notation to a game at a given node id. The move is
added as the last child. If no node id is supplied, the current node of the
game is used. If remove-existing-moves? is true, any previously existing
moves at the point of insertion are removed.
sourceraw docstring

add-uci-move-sequenceclj/s

(add-uci-move-sequence game
                       uci-moves
                       &
                       {:keys [node-id remove-existing-moves?]})

Like add-uci-move, but adds a sequence of moves rather than a single move. This is faster than calling add-uci-move multiple times, because we don't have to unzip and zip the tree for each added move. If remove-existing-moves? is true, any previously existing moves at the point of insertion are removed.

Like add-uci-move, but adds a sequence of moves rather than a single move.
This is faster than calling add-uci-move multiple times, because we don't
have to unzip and zip the tree for each added move. If
remove-existing-moves? is true, any previously existing moves at the point
of insertion are removed.
sourceraw docstring

ancestorsclj/s

(ancestors board)

A sequence of all ancestors of the board, ordered by the root board, up to and including the input board.

A sequence of all ancestors of the board, ordered by the root board, up to
and including the input board.
sourceraw docstring

at-beginning?clj/s

(at-beginning? game)

Tests whether we are currently at the beginning of the game, i.e. that the current node equals the root node.

Tests whether we are currently at the beginning of the game, i.e. that the
current node equals the root node.
sourceraw docstring

at-end?clj/s

(at-end? game)

Tests whether we are currently at the end of the game, i.e. that the current node has no children.

Tests whether we are currently at the end of the game, i.e. that the
current node has no children.
sourceraw docstring

black-eloclj/s

(black-elo game)

The Elo of the black player (as an integer), or nil.

The Elo of the black player (as an integer), or nil.
sourceraw docstring

black-playerclj/s

(black-player game)

Name of the black player.

Name of the black player.
sourceraw docstring

boardclj/s

(board game)

Returns the current board position of a game.

Returns the current board position of a game.
sourceraw docstring

board-equal?clj/s

(board-equal? board-1 board-2 & boards)

Tests whether two or more boards are equal.

Tests whether two or more boards are equal.
sourceraw docstring

board-side-to-moveclj/s

(board-side-to-move board)

The current side to move, :white or :black.

The current side to move, :white or :black.
sourceraw docstring

board-to-uciclj/s

(board-to-uci board)

Translates the board state (including as much of the move history as necessary) to a format ready to be sent to a UCI chess engine, i.e. like 'position fen' followed by a sequence of moves.

Translates the board state (including as much of the move history as
necessary) to a format ready to be sent to a UCI chess engine, i.e.
like 'position fen' followed by a sequence of moves.
sourceraw docstring

boardsclj/s

(boards game)

A sequence of all the board positions along the main line of the game, beginning at the root node.

A sequence of all the board positions along the main line of the game,
beginning at the root node.
sourceraw docstring

boards-with-movesclj/s

(boards-with-moves game)

A sequence of two element vectors, one for each board position along the main line, beginning at the root node. Each two-element vector consists of a board along with the move made from that board.

A sequence of two element vectors, one for each board position along the
main line, beginning at the root node. Each two-element vector consists of
a board along with the move made from that board.
sourceraw docstring

can-castle-kingside?clj/s

(can-castle-kingside? board side)

Tests whether the given side still has the right to castle kingside.

Tests whether the given side still has the right to castle kingside.
sourceraw docstring

can-castle-queenside?clj/s

(can-castle-queenside? board side)

Tests whether the given side still has the right to castle queenside.

Tests whether the given side still has the right to castle queenside.
sourceraw docstring

castle-rightsclj/s

(castle-rights board)

Castle rights, a subset of #{:white-oo, :white-ooo, :black-oo, :black-ooo}

Castle rights, a subset of #{:white-oo, :white-ooo, :black-oo, :black-ooo}
sourceraw docstring

check?clj/s

(check? board)

Tests whether the side to move is in check.

Tests whether the side to move is in check.
sourceraw docstring

checking-piecesclj/s

(checking-pieces board)

Returns a vector of all squares containing checking pieces (always 0, 1 or 2 pieces).

Returns a vector of all squares containing checking pieces (always 0, 1 or
2 pieces).
sourceraw docstring

checkmate?clj/s

(checkmate? board)

Tests whether the board position is checkmate.

Tests whether the board position is checkmate.
sourceraw docstring

current-node-idclj/s

(current-node-id game)

Returns the node id of the current node.

Returns the node id of the current node.
sourceraw docstring

dateclj/s

(date game)

The date the game was played, as a joda.time.DateTime object in Clojure, and a string in ClojureScript.

The date the game was played, as a joda.time.DateTime object in Clojure,
and a string in ClojureScript.
sourceraw docstring

do-moveclj/s

(do-move board move)

Do a move (encoded as an integer) from the current board, and returns the new board. The move is assumed to be legal.

Do a move (encoded as an integer) from the current board, and returns the
new board. The move is assumed to be legal.
sourceraw docstring

do-san-moveclj/s

(do-san-move board san-move)

Do the move represented by a SAN string, and return the new board. If no matching move exists, returns nil.

Do the move represented by a SAN string, and return the new board. If no
matching move exists, returns nil.
sourceraw docstring

do-san-move-sequenceclj/s

(do-san-move-sequence board san-move-sequence)

Executes a sequence of moves in short algebraic notation, and returns the new board, assuming that all moves in the sequence are valid, legal moves. Returns nil if the sequence contains an invalid move.

Executes a sequence of moves in short algebraic notation, and returns the
new board, assuming that all moves in the sequence are valid, legal moves.
Returns nil if the sequence contains an invalid move.
sourceraw docstring

do-uci-moveclj/s

(do-uci-move board uci-move)

Do the move represented by a UCI string, and return the new board. If no matching move exists, returns nil.

Do the move represented by a UCI string, and return the new board. If no
matching move exists, returns nil.
sourceraw docstring

do-uci-move-sequenceclj/s

(do-uci-move-sequence board uci-move-sequence)

Executes a sequence of moves in UCI notation, and returns the new board, assuming that all moves in the sequence are valid, legal moves. Returns nil if the sequence contains an invalid move.

Executes a sequence of moves in UCI notation, and returns the new board,
assuming that all moves in the sequence are valid, legal moves. Returns
nil if the sequence contains an invalid move.
sourceraw docstring

en-passant-capture?clj/s

(en-passant-capture? move)

Tests whether a move is an en passant capture.

Tests whether a move is an en passant capture.
sourceraw docstring

eventclj/s

(event game)

The event of the game, as a string.

The event of the game, as a string.
sourceraw docstring

file-countclj/s

(file-count board)

The number of files on a chess board (usually 8)

The number of files on a chess board (usually 8)
sourceraw docstring

find-nodeclj/s

(find-node game node-id)

Returns the node with the given node id, or nil if no such node exists.

Returns the node with the given node id, or nil if no such node exists.
sourceraw docstring

find-node-matchingclj/s

(find-node-matching game predicate & [start-node])

Finds the first (as found by a depth-first search) game tree node matching the given predicate. If no such node is found, returns nil.

Finds the first (as found by a depth-first search) game tree node
matching the given predicate. If no such node is found, returns nil.
sourceraw docstring

flip-boardclj

(flip-board board)

Returns a flipped copy of a board, with the black and white pieces, the side to move, the castle rights and the en passant capture square flipped.

Returns a flipped copy of a board, with the black and white pieces,
the side to move, the castle rights and the en passant capture square
flipped.
sourceraw docstring

game-from-ecnclj/s

(game-from-ecn ecn & {:keys [include-annotations?]})

Creates a game from ECN data.

Creates a game from ECN data.
sourceraw docstring

game-from-pgnclj/s

(game-from-pgn pgn & {:keys [include-annotations?]})

Creates a game from a PGN string.

Creates a game from a PGN string.
sourceraw docstring

game-to-ecnclj/s

(game-to-ecn game & rest)

Exports the game as ECN data, optionally including comments and variations.

Exports the game as ECN data, optionally including comments and
variations.
sourceraw docstring

game-to-pgnclj/s

(game-to-pgn game)

Creates a PGN string from a game, optionally including comments and variations.

Creates a PGN string from a game, optionally including comments and
variations.
sourceraw docstring

game-to-uciclj/s

(game-to-uci game)

Exports the current game state in a format ready to be sent to a UCI chess engine, i.e. like 'position fen' followed by a sequence of moves.

Exports the current game state in a format ready to be sent to a UCI
chess engine, i.e. like 'position fen' followed by a sequence of moves.
sourceraw docstring

games-in-fileclj

(games-in-file file-name & {:keys [format]})

Returns a lazy sequence of all games in an ECN or PGN file. The optional :format keyword parameter can take the values :ecn or :pgn, and is used to specify the file format. If this parameter is ommited, the function tries to guess the file type by inspecting the extension. If the extension is neither ".pgn", ".PGN", ".ecn" nor ".ECN", PGN format is assumed.

Returns a lazy sequence of all games in an ECN or PGN file. The optional
:format keyword parameter can take the values :ecn or :pgn, and is used
to specify the file format. If this parameter is ommited, the function
tries to guess the file type by inspecting the extension. If the extension
is neither ".pgn", ".PGN", ".ecn" nor ".ECN", PGN format is
assumed.
sourceraw docstring

goto-node-idclj/s

(goto-node-id game node-id)

Returns a game equal to the input game, except that :current-node is set to the node with the given node id. If no node with the supplied node id exists in the game, returns nil.

Returns a game equal to the input game, except that :current-node is set to
the node with the given node id. If no node with the supplied node id exists
in the game, returns nil.
sourceraw docstring

goto-node-matchingclj/s

(goto-node-matching game predicate)

Returns a game equal to the input game, except that :current-node is set to the first node matching the given predicate. If no such node is found, returns nil.

Returns a game equal to the input game, except that :current-node is set to
the first node matching the given predicate. If no such node is found,
returns nil.
sourceraw docstring

immediate-draw?clj/s

(immediate-draw? board)

Tests whether the board position is an immediate draw.

Tests whether the board position is an immediate draw.
sourceraw docstring

kingside-castle?clj/s

(kingside-castle? move)

Tests whether a move is a kingside castling move.

Tests whether a move is a kingside castling move.
sourceraw docstring

last-moveclj/s

(last-move board)

The last move played to reach this board position, or nil if we're at the beginning of the game.

The last move played to reach this board position, or nil if we're at the
beginning of the game.
sourceraw docstring

last-move-to-sanclj/s

(last-move-to-san board)

Translate the last move played to reach this board position to short algebraic notation.

Translate the last move played to reach this board position to short
algebraic notation.
sourceraw docstring

(legal-moves board)

Returns a vector of all legal moves for the given board.

Returns a vector of all legal moves for the given board.
sourceraw docstring

main-lineclj/s

(main-line game)

Returns a vector of all nodes along the main line of the game, beginning with the root and selecting the oldest child until a leaf is reached.

Returns a vector of all nodes along the main line of the game, beginning
with the root and selecting the oldest child until a leaf is reached.
sourceraw docstring

make-boardclj/s

(make-board & [fen allow-king-capture?])

Creates a new chess board from a FEN string. If no FEN is supplied, the standard initial position is used.

Creates a new chess board from a FEN string. If no FEN is supplied, the
standard initial position is used.
sourceraw docstring

move-fromclj/s

(move-from move)

The source square of a move

The source square of a move
sourceraw docstring

move-from-sanclj/s

(move-from-san board san-move)

Translate a move string in short algebraic notation to a move from the given board. If no matching move is found, returns nil.

Translate a move string in short algebraic notation to a move from the given
board. If no matching move is found, returns nil.
sourceraw docstring

move-from-uciclj/s

(move-from-uci board uci-move)

Translates a move string in UCI notation to a move from the given board. If no matching move exists, returns nil.

Translates a move string in UCI notation to a move from the given board. If
no matching move exists, returns nil.
sourceraw docstring

move-noneclj/s

source

move-numberclj/s

(move-number board)

Current full move number for the given board.

Current full move number for the given board.
sourceraw docstring

move-promotionclj/s

(move-promotion move)

The piece type the move promotes into, or :none if the move is not a promotion.

The piece type the move promotes into, or :none if the move is not a
promotion.
sourceraw docstring

move-promotion?clj/s

(move-promotion? move)

Tests whether the move is a pawn promotion

Tests whether the move is a pawn promotion
sourceraw docstring

move-textclj/s

(move-text game & {:keys [include-comments? include-variations?]})

The move text of the game in short algebraic notation, optionally including comments and variations.

The move text of the game in short algebraic notation, optionally including
comments and variations.
sourceraw docstring

move-toclj/s

(move-to move)

The destination square of a move

The destination square of a move
sourceraw docstring

move-to-sanclj/s

(move-to-san board move & {:keys [include-move-number?]})

Translates a move to a string in short algebraic notation, optionally including a preceding move number.

Translates a move to a string in short algebraic notation, optionally
including a preceding move number.
sourceraw docstring

move-to-uciclj/s

(move-to-uci move)

Translates a move to a string in UCI notation.

Translates a move to a string in UCI notation.
sourceraw docstring

movesclj/s

(moves game)

A sequence of all moves along the main line of the game, beginning at the root.

A sequence of all moves along the main line of the game, beginning at the
root.
sourceraw docstring

new-gameclj/s

(new-game &
          {:keys [white black event site date round result start-fen
                  other-tags]})

Creates a new game object with the given PGN tags and start position. The seven standard tags that make up the "Seven Tag Roster" in the PGN standard are supplied by individual keyword parameters, as is the start-fen parameter that is used to specify the initial position of the game. If any further PGN tags are desired, they should be supplied in a sequence of two-element vectors of the form [<tag-name> <tag-value>], assigned to the keyword parameter 'other-tags'.

Creates a new game object with the given PGN tags and start position. The
seven standard tags that make up the "Seven Tag Roster" in the PGN standard
are supplied by individual keyword parameters, as is the start-fen parameter
that is used to specify the initial position of the game. If any further PGN
tags are desired, they should be supplied in a sequence of two-element
vectors of the form [<tag-name> <tag-value>], assigned to the keyword
parameter 'other-tags'.
sourceraw docstring

parentclj/s

(parent board)

The parent board of the current board (i.e. the board as it was before the last move was played), or nil if we're at the beginning of the game.

The parent board of the current board (i.e. the board as it was before the
last move was played), or nil if we're at the beginning of the game.
sourceraw docstring

piece-colorclj/s

(piece-color piece)

The color of a piece, :white or :black.

The color of a piece, :white or :black.
sourceraw docstring

piece-color-onclj/smultimethod

The color of the piece on a given square.

The color of the piece on a given square.
sourceraw docstring

piece-countclj

(piece-count board piece)
(piece-count board piece color)

The number of pieces of the given type. You can either supply three arguments representing board, piece color and piece type (e.g (piece-count board :black :rook)) or two arguments representing board and piece with color (e.g. (piece-count board :wb)).

The number of pieces of the given type. You can either supply three
arguments representing board, piece color and piece type
(e.g (piece-count board :black :rook)) or two arguments representing
board and piece with color (e.g. (piece-count board :wb)).
sourceraw docstring

piece-makeclj/s

(piece-make color type)

Converts a color keyword and a piece type keyword to the internal iteger representation of a chess piece of the corresponding color and type.

Converts a color keyword and a piece type keyword to the internal iteger
representation of a chess piece of the corresponding color and type.
sourceraw docstring

piece-onclj/smultimethod

The piece on a given square.

The piece on a given square.
sourceraw docstring

piece-typeclj/s

(piece-type piece)

The type of a piece, given by a keyword of the form :pawn, :knight, etc.

The type of a piece, given by a keyword of the form :pawn, :knight, etc.
sourceraw docstring

piece-type-onclj/smultimethod

The piece type on a given square

The piece type on a given square
sourceraw docstring

(print-board board)

Prints the board to the standard output, for debugging.

Prints the board to the standard output, for debugging.
sourceraw docstring

promote-nodeclj/s

(promote-node game & {:keys [node-id]})

Returns a modified game where the node with the given node id (if no node id is supplied, the current node is used) is moved one place to the left among its siblings. If the node is already the leftmost (oldest) child of its parent node, the game is returned unchanged.

Returns a modified game where the node with the given node id (if no node
id is supplied, the current node is used) is moved one place to the left
among its siblings. If the node is already the leftmost (oldest) child of
its parent node, the game is returned unchanged.
sourceraw docstring

promote-node-to-main-lineclj/s

(promote-node-to-main-line game & {:keys [node-id]})

Returns a modified game where the node with the given node id (if no node id is supplied, the current node is used) is made the main line among its siblings, i.e. moved to the front of the list of child nodes. If the node is already the leftmost (oldest) child of its parent node, the game is returned unchanged.

Returns a modified game where the node with the given node id (if no node
id is supplied, the current node is used) is made the main line among its
siblings, i.e. moved to the front of the list of child nodes. If the node
is already the leftmost (oldest) child of its parent node, the game is
returned unchanged.
sourceraw docstring

queenside-castle?clj/s

(queenside-castle? move)

Tests whether a move is a queenside castling move.

Tests whether a move is a queenside castling move.
sourceraw docstring

rank-countclj/s

(rank-count board)

The number of ranks on a chess board (usually 8)

The number of ranks on a chess board (usually 8)
sourceraw docstring

remove-childrenclj/s

(remove-children game & {:keys [node-id]})

Removes all child nodes of a node (by default, the current node), and returns a modified game with the current node set to the node whose children we just removed.

Removes all child nodes of a node (by default, the current node), and
returns a modified game with the current node set to the node whose
children we just removed.
sourceraw docstring

remove-nodeclj/s

(remove-node game & {:keys [node-id]})

Removes a node (by default, the current node) from the game, and returns a modified game with the current node set to the parent of the deleted node.

Removes a node (by default, the current node) from the game, and returns
a modified game with the current node set to the parent of the deleted
node.
sourceraw docstring

remove-tagclj/s

(remove-tag game tag-name)

Returns a new game equal to the input game, but with the given tag removed (if it exists).

Returns a new game equal to the input game, but with the given tag removed
(if it exists).
sourceraw docstring

resultclj/s

(result game)

The result of the game. Should be one of the strings "1-0", "0-1", "1/2-1/2" and "*".

The result of the game. Should be one of the strings "1-0", "0-1",
"1/2-1/2" and "*".
sourceraw docstring

roundclj/s

(round game)

The tournament round of the game.

The tournament round of the game.
sourceraw docstring

set-tagclj/s

(set-tag game name value)

Returns a new game equal to the input game, but with the given tag set to the given value. If the tag does not exist in the input game, it is added to the end of the tags list.

Returns a new game equal to the input game, but with the given tag set to
the given value. If the tag does not exist in the input game, it is added
to the end of the tags list.
sourceraw docstring

side-to-moveclj/s

(side-to-move game)

The side to move at the current position of the game, :white or :black.

The side to move at the current position of the game, :white or :black.
sourceraw docstring

siteclj/s

(site game)

The site of the game.

The site of the game.
sourceraw docstring

square-from-stringclj/s

(square-from-string sq-str)

Converts a string in standard coordinate notation to a square.

Converts a string in standard coordinate notation to a square.
sourceraw docstring

square-to-stringclj/s

(square-to-string square)

Converts a square to a string in standard coordinate notation.

Converts a square to a string in standard coordinate notation.
sourceraw docstring

static-exchange-evaluationclj

(static-exchange-evaluation board move)

Statically evaluates the material gain or loss of a move. The return value is a number of pawns, using a material scale of pawn = 1, knight = 3, bishop = 3, rook = 5, queen = 9.

Statically evaluates the material gain or loss of a move. The return
value is a number of pawns, using a material scale of pawn = 1,
knight = 3, bishop = 3, rook = 5, queen = 9.
sourceraw docstring

step-backclj/s

(step-back game)

Steps one move backward in the game (goes back to the parent node), and returns the resulting game. The retracted move is not deleted from the game, only the :current-node of the game is changed. If we are already at the beginning of the game, the original game is returned unchanged.

Steps one move backward in the game (goes back to the parent node), and
returns the resulting game. The retracted move is not deleted from the game,
only the :current-node of the game is changed. If we are already at the
beginning of the game, the original game is returned unchanged.
sourceraw docstring

step-forwardclj/s

(step-forward game)

Steps one step forward in the game (moves down to the first child node), and returns the resulting game. If we are already at the end of the game, the original game is returned unchanged.

Steps one step forward in the game (moves down to the first child node),
and returns the resulting game. If we are already at the end of the game,
the original game is returned unchanged.
sourceraw docstring

tag-valueclj/s

(tag-value game tag-name)

Returns the value of the given PGN tag in the game, or nil if no such tag exists.

Returns the value of the given PGN tag in the game, or nil if no such
tag exists.
sourceraw docstring

take-backclj/s

(take-back game)

Takes back the move that led to the current node, and returns a game tree with the corresponding node removed and the current node set to the parent. Does nothing if we're already at the beginning of the game.

Takes back the move that led to the current node, and returns a game tree
with the corresponding node removed and the current node set to the parent.
Does nothing if we're already at the beginning of the game.
sourceraw docstring

terminal?clj/s

(terminal? board)

Tests whether the board position is terminal, i.e. checkmate or an immediate draw.

Tests whether the board position is terminal, i.e. checkmate or an
immediate draw.
sourceraw docstring

to-beginningclj/s

(to-beginning game)

Returns a game identical to the input game, except that current-node is set to the root node.

Returns a game identical to the input game, except that current-node is
set to the root node.
sourceraw docstring

to-beginning-of-variationclj/s

(to-beginning-of-variation game)

Returns a game identical to the input game, except that we have stepped back until reaching the beginning of the variation containing the previous current node. In other words, we step back until we reach a branch point where the current variation started, or to the root of the game.

Returns a game identical to the input game, except that we have stepped
back until reaching the beginning of the variation containing the previous
current node. In other words, we step back until we reach a branch point
where the current variation started, or to the root of the game.
sourceraw docstring

to-endclj/s

(to-end game)

Returns a game identical to the input game, except that current-node is set to the leaf node obtained by following the main line from the root, i.e. by following the sequence of first children from the root node until a leaf node is reached.

Returns a game identical to the input game, except that current-node is
set to the leaf node obtained by following the main line from the root,
i.e. by following the sequence of first children from the root node until
a leaf node is reached.
sourceraw docstring

to-end-of-variationclj/s

(to-end-of-variation game)

Returns a game identical to the input game, except that current node is set to the leaf node obtained by following the current variation to its end, i.e. by following the sequence of first children from the current node until a leaf node is reached.

Returns a game identical to the input game, except that current node
is set to the leaf node obtained by following the current variation to
its end, i.e. by following the sequence of first children from the
current node until a leaf node is reached.
sourceraw docstring

to-fenclj/s

(to-fen board)

Converts the board to a string in Forsyth-Edwards notation.

Converts the board to a string in Forsyth-Edwards notation.
sourceraw docstring

variation-to-sanclj/s

(variation-to-san board uci-moves & {:keys [include-move-numbers]})

Translates a variation from a sequence of UCI moves to a string in short algebraic notation. Used to pretty-print UCI analysis output.

Translates a variation from a sequence of UCI moves to a string in
short algebraic notation. Used to pretty-print UCI analysis output.
sourceraw docstring

white-eloclj/s

(white-elo game)

The Elo of the white player (as an integer), or nil.

The Elo of the white player (as an integer), or nil.
sourceraw docstring

white-playerclj/s

(white-player game)

Name of the white player.

Name of the white player.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close