chess-legal-moves
Version:
Analyses a given chess game position in Fen notation to return legal moves and provides the next game position after a given move
48 lines (47 loc) • 1.17 kB
TypeScript
import { IGameState, IScan } from './types';
/**
* The Game class
*
* @public
*/
export default class Game {
state: IGameState;
fen: string;
scan: IScan;
/**
* The class constructor to build a Game instance
* @param fenString - a string in FEN notation representing a particular game position
*
* @public
*/
constructor(fenString: string);
/**
* Updates fen property with a new string in FEN notation
* @param newFen - a new string in FEN notation to update fen property
*
* @internal
*/
private updateFen;
/**
* Updates state property with a new state
* @param newState - a new state to update state property
*
* @internal
*/
private updateState;
/**
* Updates scan property with a new scan
*
* @internal
*/
private updateScan;
/**
* Adds a move to the game
* @param move - a move in long UCI notation to be added to the game
* @returns a new string in FEN notation to represent the game after the added move
*
* @public
*/
addMove(move: string): string;
private checkIfLegalMove;
}