private void Validate() { var validationResult = BoardValidator.Validate(this); if (validationResult != BoardExceptionType.None) { switch (validationResult) { case BoardExceptionType.Checkmate: GameState = GameState.Checkmate; break; case BoardExceptionType.MaterialDraw: GameState = GameState.Drawn; break; case BoardExceptionType.Stalemate: GameState = GameState.StaleMate; break; default: throw new BoardException(validationResult, $"{Fen} : Invalid board setup."); } } }
public Result <int[]> Solve(SudokuBoard board) { Result <int[]> result = new Result <int[]>(); Result validationResult = _boardValidator.Validate(board); if (!validationResult.IsSuccess) { result.Error = validationResult.Error; return(result); } return(_solver.Solve(board)); }