public void playTwoSetMatch(Individual player1, Individual player2)
        {
            /*
             *  play a two game match, each time another player get to start
             */
            int result = 0;

            // set both players the same board instance
            player1.setBoard(board);
            player2.setBoard(board);

            // make two iteration, each time let another player start (change the order of parameters in playGame method)
            board.resetBoard();
            result += playGame(player1, player2);
            board.resetBoard();
            result += playGame(player2, player1);
        }
Beispiel #2
0
        private void playAgainst_Click(object sender, EventArgs e)
        {
            initializeFunctionTerminalSets();
            Board board = new Board();
            Game  game  = new Game(board);

            selectRandomMaxIndex = bestEvalSelectMethod.SelectedIndex == 0;
            Individual PlayerOne = new Individual(board, "Player One", selectRandomMaxIndex, functionList, terminalList);
            Individual PlayerTwo = new Individual(board, "Player Two", selectRandomMaxIndex, functionList, terminalList);

            PlayerOne.setValue(1);
            PlayerTwo.setValue(2);
            GameGui gui = new GameGui(game, PlayerTwo);

            this.Hide();
            gui.ShowDialog();
            this.Show();
            PlayerOne.setIsHumanPlayer(true);
            PlayerTwo.setIsHumanPlayer(true);
            PlayerOne.setBoard(board);
            PlayerTwo.setBoard(board);
        }