public bool MakeMove(TicTacToeMove move) { var(player, i, j) = move; if (!CheckBounds(i, j)) { return(false); } if (player.Mark == CurrentMove && Board[i, j] == TicTacToeMarkEnum.NaN) { Board[i, j] = player.Mark; CurrentMove = CurrentMove == TicTacToeMarkEnum.O ? TicTacToeMarkEnum.X : TicTacToeMarkEnum.O; } else { return(false); } // move is done GameHistory.Add(move); if (GameEnd()) { OnGameEnd?.Invoke(); } return(true); }
public bool MakeMove(TicTacToePlayer player, int i, int j) { var move = new TicTacToeMove(player, i, j); return(MakeMove(move)); }