//override the function for retrieving a new state from a given move public override Board MakeMove(Move m) { MoveTicTac move = (MoveTicTac)m; int nextPlayer = GetNextPlayer(move.player); int[,] copy = new int[ROWS, COLS]; Array.Copy(board, 0, copy, 0, board.Length); copy[move.y, move.x] = move.player; BoardTicTac newBoardState = new BoardTicTac(copy, nextPlayer); return(newBoardState); }
//override the member function for getting the available moves from the current state public override Move[] GetMoves() { List <Move> moves = new List <Move>(); for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLS; j++) { if (board[i, j] != 0) { continue; } MoveTicTac m = new MoveTicTac(j, i, player); moves.Add(m); } } return(moves.ToArray()); }