Chees class.
Methods
newCreating a new instance of Chess class.asciiPrint the board via console.clearRemove all pieces from the board.fenReturn the actual Forsyth Edwards notation.pgnReturn Portable Game notation.getReturn the piece in a spicific square argument.historyReturn a vector containing the moves of the current game. If the argumentverbose=TRUEis added the method return a data frame.game_overReturns TRUE if the game has ended via checkmate, stalemate, draw, threefold repetition, or insufficient material. Otherwise, returns FALSE.in_checkReturns true or false if the side to move is in check.in_checkmateReturns true or false if the side to move has been checkmated.in_drawReturns true or false if the game is drawn 50 move rule or insufficient material.in_stalemateReturns true or false if the side to move has been stalemated.in_threefold_repetitionReturns true or false if the current board position has occurred three or more times.insufficient_materialReturns true if the game is drawn due to insufficient material (K vs. K, K vs. KB, or K vs. KN); otherwise false.moveAttempts to make a move on the board, returning a move object if the move was legal, otherwise null. The .move function can be called two ways, by passing a string in Standard Algebraic Notation SAN:movesReturns a vector of legals moves from the current position. The function takes an optional parameter which controls the single square move generation and verbosity.validate_fenReturns a validation object specifying validity or the errors found within the FEN string.loadload_pgnLoad the moves of a game stored in Portable Game Notation.putPlace a piece on square where piece is an object.removeRemove and return the piece on square.resetReset the board to the initial starting position.square_colorReturns the color of the square (light or dark).turnReturns the current side to move.undoTakeback the last halfmove, returning a move object if successful.headerAllows header information to be added to PGN output. Any number of key value pairs can be passed toheader().get_headerGet header of the actual game via list object.history_detailReturn a detailed version forhistory(verbose=TRUE).summaryPrint a summary of the object.plotPlot the object with chessboard.js or ggplot2.printPrint the summary ob the Chess object.
Methods
Chess$new()
Create a game from a FEN position.
Usage
Chess$new(fen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1")