rchess (version 0.1)

Chess: Chess Class

Description

Chees class.

Usage

Chess

Arguments

Format

An R6Class generator object

Methods

  • new Creating a new instance of Chess class.
  • ascii Print the board via console.
  • clear Remove all pieces from the board.
  • fen Return the actual Forsyth Edwards notation.
  • pgn Return Portable Game notation.
  • get Return the piece in a spicific square argument.
  • history Return a vector containing the moves of the current game. If the argument verbose=TRUE is added the method return a data frame.
  • game_over Returns TRUE if the game has ended via checkmate, stalemate, draw, threefold repetition, or insufficient material. Otherwise, returns FALSE.
  • in_check Returns true or false if the side to move is in check.
  • in_checkmate Returns true or false if the side to move has been checkmated.
  • in_draw Returns true or false if the game is drawn 50 move rule or insufficient material.
  • in_stalemate Returns true or false if the side to move has been stalemated.
  • in_threefold_repetition Returns true or false if the current board position has occurred three or more times.
  • insufficient_material Returns true if the game is drawn due to insufficient material (K vs. K, K vs. KB, or K vs. KN); otherwise false.
  • move Attempts 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:
  • moves Returns 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_fen Returns a validation object specifying validity or the errors found within the FEN string.
  • load
  • load_pgn Load the moves of a game stored in Portable Game Notation.
  • put Place a piece on square where piece is an object.
  • remove Remove and return the piece on square.
  • reset Reset the board to the initial starting position.
  • square_color Returns the color of the square (light or dark).
  • turn Returns the current side to move.
  • undo Takeback the last halfmove, returning a move object if successful.
  • header Allows header information to be added to PGN output. Any number of key value pairs can be passed to header().
  • get_header Get header of the actual game via list object.
  • history_detail Return a detailed version for history(verbose=TRUE).
  • summary Print a summary of the object.
  • plot Plot the object via chessboarjs. You can add type ggplot.
  • print Print the summary ob the Chess object.