public UltimateTicTacToeNode() { for (int x = 0; x < 9; x++) { for (int y = 0; y < 9; y++) { board[x, y] = -1; } } miniBoard.Reset(); }
public override Node GetNextState(int move) { int[,] nextBoard = (int[, ])board.Clone(); MiniCoord nextCoord = miniBoard; int x = move / 9; int y = move % 9; nextBoard[x, y] = ActivePlayer; nextCoord.Set(x % 3, y % 3); if (MiniWinner(nextCoord) != -1 || MiniFull(nextCoord)) { nextCoord.Reset(); } return(new UltimateTicTacToeNode() { ActivePlayer = (ActivePlayer + 1) % 2, board = nextBoard, miniBoard = nextCoord }); }