public bool MakeMove(TicTacToeMove move, TicTacToeBoardValue boardValue) { bool isValid = this.IsValidMove(move); if (isValid) { this.values[move.X, move.Y] = boardValue; } return(isValid); }
public IEnumerable <TicTacToeMove> GetOpenMoves() { List <TicTacToeMove> openMoves = new List <TicTacToeMove>(); for (int y = 0; y < 3; y++) { for (int x = 0; x < 3; x++) { TicTacToeMove move = new TicTacToeMove(x, y); if (this.IsValidMove(move)) { openMoves.Add(move); } } } return(openMoves); }
public bool IsValidMove(TicTacToeMove move) { return(move != null && this.values[move.X, move.Y] == null); }