/// <summary> /// Reset state with the engine /// </summary> void IChessEngine.Reset() { string fen = (initialFEN != null) ? initialFEN : ChessBoard.InitialFENPosition; UciPositionCommand command = new UciPositionCommand(fen); command.Execute(this); }
/// <summary> /// Update the position with the chess engine. Once a move is applied with the /// board, then engine needs to know, so it can analyze the next move whether /// this came from a player or the engine iteself /// </summary> private void UpdateEnginePosition() { // The board constantly updates its FEN, so send the FEN to the engine // Some engines have a limited input buffer, so games with many many // moves will eventually exceed the buffer length and then it breaks. // This method ensures we'll fit in any reasonable buffer lenghth, but // puts the burden on the board to keep it constantly updated // See FenParser class for those details updatingPosition = true; UciPositionCommand command = new UciPositionCommand(board.CurrentFEN); command.Execute(engine); }
/// <summary> /// Sets a new position with the chess engine /// </summary> /// <param name="positionAsFEN">FEN for the new position</param> public void SetPosition(string positionAsFEN) { UciPositionCommand command = new UciPositionCommand(positionAsFEN); command.Execute(this); }