Beispiel #1
0
        public void CheckSpecialHands2()
        {
            GamingTable gamingTable = new GamingTable();

            Dictionary <int, HandWarGame <CardWarGame> > players = new Dictionary <int, HandWarGame <CardWarGame> >();

            HandWarGame <CardWarGame> Hand1 = new HandWarGame <CardWarGame>();

            HandWarGame <CardWarGame> Hand2 = new HandWarGame <CardWarGame>();

            Hand2.AddCard(new CardWarGame(CardValueEnum.Five, CardColorEnum.Spade));
            Hand2.AddCard(new CardWarGame(CardValueEnum.Six, CardColorEnum.Spade));
            Hand2.AddCard(new CardWarGame(CardValueEnum.Seven, CardColorEnum.Spade));
            Hand2.AddCard(new CardWarGame(CardValueEnum.Height, CardColorEnum.Spade));

            HandWarGame <CardWarGame> Hand3 = new HandWarGame <CardWarGame>();

            players.Add(1, Hand1);
            players.Add(2, Hand2);
            players.Add(3, Hand3);


            TableHistory tableHistory = gamingTable.PlayGameWhithGivenHand(players);

            Assert.AreEqual(2, tableHistory.GetHistories()[0].GetWinner());
        }
Beispiel #2
0
        [TestMethod, Timeout(50 * numberGamesToPlay)] // ms
        public void CheckNoInfiniteLoop()
        {
            IGamingTable gamingTable = new GamingTable();

            TableHistory tableHistory = gamingTable.PlayMultipleGames(2, numberGamesToPlay);

            int sum = 0;

            foreach (GameHistory gameHistory in tableHistory.GetHistories())
            {
                sum += gameHistory.GetNumberOfFolds();
            }
            Console.WriteLine("Average number of fold per game : " + sum / numberGamesToPlay);

            tableHistory.PrintScoreBoard();
        }
Beispiel #3
0
        public void CheckSpecialHands3()
        {
            IGamingTable gamingTable = new GamingTable();

            Dictionary <int, HandWarGame <CardWarGame> > players = new Dictionary <int, HandWarGame <CardWarGame> >();

            HandWarGame <CardWarGame> Hand1 = new HandWarGame <CardWarGame>();

            HandWarGame <CardWarGame> Hand2 = new HandWarGame <CardWarGame>();

            HandWarGame <CardWarGame> Hand3 = new HandWarGame <CardWarGame>();

            players.Add(1, Hand1);
            players.Add(2, Hand2);
            players.Add(3, Hand3);


            TableHistory tableHistory = gamingTable.PlayGameWhithGivenHand(players);

            Assert.AreEqual(-1, tableHistory.GetHistories()[0].GetWinner()); //No winner
        }
Beispiel #4
0
 // Initialize the data members
 public void Start()
 {
     gamingTable = transform.parent.parent.GetComponent <GamingTable>();
     image       = GetComponent <Image>();
 }