コード例 #1
0
        private MatchResult OneMatch()
        {
            IPlayer player1 = PlayerFactory.Create(firstPlayerComboBox.Text);
            IPlayer player2 = PlayerFactory.Create(secondPlayerComboBox.Text);

            GameManager.GameManager gm = new GameManager.GameManager(player1, player2, 9, 9);
            return(gm.Play());
        }
コード例 #2
0
 public void Collect(int times = 1000)
 {
     for (int i = 0; i < times; i++)
     {
         ProgrammedAttackingPlayer p1 = new ProgrammedAttackingPlayer();
         ProgrammedAttackingPlayer p2 = new ProgrammedAttackingPlayer();
         GameManager.GameManager   gm = new GameManager.GameManager(p1, p2);
         gm.PlayerPlayed += Gm_PlayerPlayed;
         gm.Play();
     }
 }
コード例 #3
0
ファイル: GameTest.cs プロジェクト: EricWebsmith/TankWorld
        private BatchMatchResult PlayGame(IPlayer player1, IPlayer player2, int playTimes = 100)
        {
            BatchMatchResult bResult = new BatchMatchResult();

            bResult.Total = playTimes;
            for (int i = 0; i < playTimes; i = i + 2)
            {
                GameManager.GameManager gm1 = new GameManager.GameManager(player1, player2, 9, 9);
                var result1 = gm1.Play();
                //Switch Positions
                GameManager.GameManager gm2 = new GameManager.GameManager(player2, player1, 9, 9);
                var result2 = gm2.Play();

                switch (result1)
                {
                case Core.MatchResult.Player1Won:
                    bResult.Player1Won++;
                    break;

                case Core.MatchResult.Player2Won:
                    bResult.Player2Won++;
                    break;

                case Core.MatchResult.Tie:
                    bResult.Tie++;
                    break;
                }

                switch (result2)
                {
                case Core.MatchResult.Player1Won:
                    bResult.Player2Won++;
                    break;

                case Core.MatchResult.Player2Won:
                    bResult.Player1Won++;
                    break;

                case Core.MatchResult.Tie:
                    bResult.Tie++;
                    break;
                }
            }
            Debug.Print("Result:");
            Debug.Print("Player 1 Red Won:" + bResult.Player1Won.ToString());
            Debug.Print("Player 2 Blue Won:" + bResult.Player2Won.ToString());
            Debug.Print("Tie:" + bResult.Tie.ToString());
            return(bResult);
        }
コード例 #4
0
ファイル: GameTest.cs プロジェクト: EricWebsmith/TankWorld
 public void GameSmockTest()
 {
     GameManager.GameManager gm = new GameManager.GameManager(new WanderingPlayer(), new WanderingPlayer());
     gm.Play();
 }