Exemplo n.º 1
0
        /// <summary>
        /// Runs the algorythm of showdown of poker game.
        /// </summary>
        protected void Showdown()
        {
            foreach (Card card in _table)
            {
                _player1.Hand.Add(card);
                _player2.Hand.Add(card);
            }
            DrawCards.DisplayCards(_player1.Hand, 1);
            Console.SetCursorPosition(0, 14);
            Console.WriteLine("COMPUTER'S HAND");
            DrawCards.DisplayCards(_player2.Hand, 2);

            // processing the hands
            HandValue p1Hand = _firstChecker.CheckCombination(_player1.Hand);
            HandValue p2Hand = _firstChecker.CheckCombination(_player2.Hand);



            DisplayBanks();
            Console.SetCursorPosition(0, 36);
            if (p1Hand > p2Hand)
            {
                Console.WriteLine("Player1 wins");
                Console.WriteLine("Player1 Combination: {0}", p1Hand.Combination);
                Console.WriteLine("Player2 Combination: {0}", p2Hand.Combination);
                _player1.WinBank(_bank);
            }
            else
            {
                Console.WriteLine("Player2 wins");
                Console.WriteLine("Player1 Combination: {0}", p1Hand.Combination);
                Console.WriteLine("Player2 Combination: {0}", p2Hand.Combination);
                _player2.WinBank(_bank);
            }
            _bank = 0;
            DisplayBanks();
        }