public TryMoveReturnObj TryMove(Move move, ChessForm form1) { //ChessForm.MessageShow(move.ToString()); if (!IsLegalMove(move)) { return(new TryMoveReturnObj() { IsSuccesful = false }); } TryMoveReturnObj output = new TryMoveReturnObj(); output.IsSuccesful = true; this.Move(move); this.promoteIfNeeded(); if (currentBoard.isMate()) { output.IsGameOver = true; output.IsMate = true; if (this.currentBoard.IsWhiteTurn) { output.IsMateForBlack = true; } else { output.IsMateForWhite = true; } } if (this.isDraw()) { output.IsGameOver = true; output.IsDraw = true; output.IsStaleMate = this.currentBoard.IsStaleMate(); output.Is3FoldRepetition = this.is3FoldRepetition(); output.Is50MoveRule = this.is50MoveRule(); output.IsInsufficientMaterialForWhite = this.currentBoard.isInsufficientMaterialForWhite(); output.IsInsufficientMaterialForBlack = this.currentBoard.isInsufficientMaterialForBlack(); } return(output); }