Exemplo n.º 1
0
        public MCTS(int boardSize, int[,] currentBoard)
        {
            //ROOT NODE INITIALIZED
            BOARDSIZE            = boardSize;
            ROOTNODE             = new node();
            ROOTNODE.boardConfig = new int[BOARDSIZE, BOARDSIZE];
            ROOTNODE.nodeNumber  = currentNodeNumber;
            ROOTNODE.nextPlayer  = currentTurn;

            ROOTNODE.visitCount += 1;
            ROOTNODE.isRoot      = true;

            currentNodeNumber += 1;

            copyArray(currentBoard, ROOTNODE.boardConfig);

            boardOps = new boardOperations(BOARDSIZE);
        }
Exemplo n.º 2
0
        private void btnGenerate_Click(object sender, RoutedEventArgs e)
        {
            boardSize = Convert.ToInt16(txtBoardSize.Text);
            int tileCount = 0;

            for (int i = 0; i < boardSize; i++)
            {
                StackPanel tempPanel = new StackPanel();
                tempPanel.Orientation = Orientation.Horizontal;

                for (int j = 0; j < boardSize; j++)
                {
                    Button tempBtn = new Button();
                    tempBtn.Width  = 50;
                    tempBtn.Height = 50;
                    tempBtn.Name   = "b_" + i + "_" + j;

                    tempBtn.Background = Brushes.BurlyWood;

                    tempBtn.Click += tempBtn_Click;

                    tilesDictionary.Add(i + "_" + j, tempBtn);

                    tempPanel.Children.Add(tempBtn);

                    tileCount += 1;
                }

                stackBoard.Children.Add(tempPanel);
            }

            //INITIALIZE BOARD
            boardOps           = new boardOperations(boardSize);
            boardConfiguration = new int[boardSize, boardSize];
            boardConfiguration = boardOps.initializeBoard(boardConfiguration);
        }