Esempio n. 1
0
        public MainWindow(bool isAi, string player1Name, string player2Name)
        {
            InitializeComponent();
            ScoreBoardView.CreatePlayer();
            Player1Text.Text = player1.firstName = player1Name;

            if (isAi)
            {
                Player2Text.Text = player2.firstName = "AI";
            }
            else
            {
                Player2Text.Text = player2.firstName = player2Name;
            }

            this.isAI = isAi;

            playerTurn = RandomizeStartingPlayer();
            playerTurnColors(playerTurn);

            if (isAI && playerTurn == 1)
            {
                int aistep = game.aiStepInd();
                game.gameStep(aistep, playerTurn + 1);
                playerTurn = (playerTurn + 1) % 2;

                playerTurnColors(playerTurn);
            }

            drawBoard();
        }
Esempio n. 2
0
        public void ComplexValueTest()
        {
            BoardMesh testBoard = new BoardMesh();

            for (int i = 0; i < 64; i++)
            {
                testBoard.gameMesh[i].field_owner = 0;
            }
            testBoard.gameMesh[0].field_owner  = 4;
            testBoard.gameMesh[1].field_owner  = 1;
            testBoard.gameMesh[2].field_owner  = 1;
            testBoard.gameMesh[3].field_owner  = 2;
            testBoard.gameMesh[32].field_owner = 4;
            testBoard.gameMesh[33].field_owner = 1;
            testBoard.gameMesh[34].field_owner = 2;
            testBoard.gameMesh[40].field_owner = 1;
            testBoard.gameMesh[48].field_owner = 1;
            testBoard.gameMesh[56].field_owner = 1;


            int expected = 0;
            int actual   = testBoard.aiStepInd();

            Assert.AreEqual(expected, actual);
        }