Example #1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            HumanPlayer humanPlayer = new HumanPlayer("Moutasem Al-awa", getSelectedSymbol());
            XOSymbol xoSymbolPCPlayer = XOSymbol.EMPTY;

            switch(getSelectedSymbol())
            {
                case XOSymbol.O:
                    xoSymbolPCPlayer = XOSymbol.X;
                    break;
                case XOSymbol.X:
                    xoSymbolPCPlayer = XOSymbol.O;
                    break;
            }
            PCPlayer pcPlayer = new PCPlayer(xoSymbolPCPlayer);

            Player firstPlayer = null;
            firstPlayer = pcPlayer;
            if (isHumanFirst())
                firstPlayer = humanPlayer;

            GameEngine gameEngine = new GameEngine(humanPlayer, pcPlayer, firstPlayer);
            gamePadUC1.GameEngine = gameEngine;

            grbGameSettings.Enabled = false;
            gamePadUC1.Enabled = true;

            if (!isHumanFirst())
            {
                pcPlayer.Play();
                gamePadUC1.AddMove(pcPlayer.GameMove);
            }
        }
Example #2
0
 private void gamePadUC1_MovePlayed(GameEngine gameEngine)
 {
     tracingForm.AddTracingLevel(gameEngine.PCPlayer.IPlayerBrain.GetGamePadNodes());
 }
Example #3
0
 private void gamePadUC1_GameFinished(GameEngine gameEngine)
 {
     showWinner(gameEngine.WinnerPlayer);
     btnStart_Click(null, null);
     tracingForm.Reset();
 }