Пример #1
0
 private static void RunGame(MonopolyGame game)
 {
     for (int i = 0; i < game.RoundsToPlay; i++)
     {
         game.PlayRound();
     }
 }
Пример #2
0
        static void Main(string[] args)
        {
            int count;

            while (true)
            {
                Console.WriteLine("Ilu graczy?");
                string choice = Console.ReadLine();
                if (int.TryParse(choice, out count))
                {
                    if (count > 1)
                    {
                        break;
                    }
                }
            }
            List <string> players = new List <string>();

            for (int i = 0; i < count; i++)
            {
                Console.WriteLine("Podaj imię gracza o numerze " + (i + 1) + ":");
                players.Add(Console.ReadLine());
            }

            MonopolyGame.INITIALIZE(players);
            MonopolyGame.Game();
        }
Пример #3
0
        private static void BeginGamePlay(string[] args)
        {
            MonopolyGame game = new MonopolyGame(args);

            RunGame(game);

            Console.ReadLine();
        }
        public void TestGameRoundsPlayed(int numberOfPlayers, int roundsToPlay)
        {
            MonopolyGame game = new MonopolyGame(players.ToList().GetRange(0, numberOfPlayers), 1);

            for (int i = 0; i < roundsToPlay; i++)
            {
                game.PlayRound();
            }

            game.Players.ForEach(p => Assert.AreEqual(p.RoundsPlayed, roundsToPlay));
        }
        public void TestPlayerOrderIsConsistent(int roundsToPlayer)
        {
            MonopolyGame game = new MonopolyGame(players.ToList().GetRange(0, 2), 1);

            IPlayer player1 = game.Players[0];
            IPlayer player2 = game.Players[1];

            for (int i = 0; i < roundsToPlayer; i++)
            {
                game.PlayRound();

                Assert.AreEqual(player1, game.Players[0]);
                Assert.AreEqual(player2, game.Players[1]);
            }
        }
        static void Main(string[] args)
        {
            string inputValue;
            int tmpValue=0;
            int totlalPlayers = 0;
            int totlalPlayerRound = 0;

            Console.WriteLine("*****************  Monopoly Game   *****************");

            //asks for input value of number of players
            do
            {
                SetNumberOfPlayers();
                inputValue = Console.ReadLine();

            } while (!int.TryParse(inputValue, out tmpValue) ||
                (int.Parse(inputValue) < 2 || int.Parse(inputValue) > 8));

            totlalPlayers = int.Parse(inputValue);

            //asks for inpt value of play-round
            do
            {
                SetPlayRound();
                inputValue = Console.ReadLine();

            } while (!int.TryParse(inputValue, out tmpValue) ||
                (int.Parse(inputValue) < 1 || int.Parse(inputValue) > 20));

            totlalPlayerRound = int.Parse(inputValue);

            //Create MonopolyGame Instance and do the play
            MonopolyGame monopolyGame = new MonopolyGame(totlalPlayers, totlalPlayerRound);

            Console.WriteLine("Please enter any key to continue...");
            Console.ReadKey();
        }
Пример #7
0
 private void Form1_Load(object sender, EventArgs e)
 {
     this.Text = "Monopoly";
     MonopolyGame Game = new MonopolyGame();
 }
Пример #8
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            MonopolyGame game = new MonopolyGame();

            game.Start(this);
        }
        public void TestGeneratePlayerListFromArgs()
        {
            MonopolyGame game = new MonopolyGame(new string[] { "Car", "Horse", "20" });

            Assert.AreEqual(game.Players.Count, 2);
        }
 public void TestCreateMonopolyGameIllegalNumberOfPlayersException(int numberOfPlayers)
 {
     MonopolyGame game = new MonopolyGame(players.ToList().GetRange(0, numberOfPlayers), 1);
 }
        public int TestCreateMonopolyGame(int numberOfPlayers)
        {
            MonopolyGame game = new MonopolyGame(players.ToList().GetRange(0, numberOfPlayers), 1);

            return game.Players.Count;
        }