Esempio n. 1
0
        public static int sim(int player)
        {
            MonteCarloTreeSearch mcts = new MonteCarloTreeSearch(numOfMCiterations);
            Board board = new Board();

            int totalMoves = Board.DEFAULT_BOARD_SIZE * Board.DEFAULT_BOARD_SIZE;

            for (int i = 0; i < totalMoves; i++)
            {
                board = mcts.findNextMove(board, player);
                if (board.checkStatus() != -1)
                {
                    break;
                }
                player = 3 - player;
            }

            return(board.checkStatus());
        }
Esempio n. 2
0
        public void NextGame()
        {
            endDisplay.SetActive(false);
            mcts  = new MonteCarloTreeSearch(numOfMCiterations);
            board = new Board();
            SetText();

            for (int x = 0; x < 3; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    buttons[x, y].GetComponent <Image>().color         = Color.white;
                    buttons[x, y].GetComponentInChildren <Text>().text = "";
                }
            }

            currentStartingPlayer = 3 - currentStartingPlayer;
            currentPlayer         = currentStartingPlayer;

            if (currentPlayer == 2)
            {
                PerformOpponentMove(2);
            }
        }