Beispiel #1
0
        private void processWinners(bool oneLeft = false)
        {
            HandComparer hc = new HandComparer(table.Players, table.tableCards);

            Player[] winners = hc.Evaluate();

            string winsOrTies = "wins";

            if (winners.Length > 1)
            {
                winsOrTies = "ties";
            }

            int prize = table.Pot / winners.Length;

            foreach (Player p in winners)
            {
                p.Stack += prize;
                Console.Write("\nPlayer " + p.ID + " " + winsOrTies + " main pot: " + prize + " chips.\n");
                if (oneLeft == false)
                {
                    Console.Write("With hand: " + p.Hand.Name.ToString().Replace("_", " ") + " (");

                    foreach (Card c in p.Hand.Cards)
                    {
                        Console.Write(c.Rank + c.Suit + " ");
                    }

                    Console.Write(")\n");
                }
            }
        }
Beispiel #2
0
        // finds a specific hand for testing.
        public void test()
        {
            int count = 0;

            HandComparer hc = new HandComparer(Players, tableCards);

            Player[] winners = null;
            do
            {
AGAIN:
                ++count;
                Reset();
                DrawCards();
                Console.Write("\n\n");
                ShowHands();

                winners = hc.Evaluate();

                if (winners != null)
                {
                    foreach (Player p in winners)
                    {
                        Console.Write("\n\nWINNER IS: " + p.ID);
                        Console.Write("\n\nWITH HAND: " + p.Hand.Name.ToString().Replace("_", " "));
                        Console.Write("\n\nCARDS: ");
                        foreach (Card card in p.Hand.Cards)
                        {
                            Console.Write(card.Rank + card.Suit + " ");
                        }
                    }
                }
                else
                {
                    Console.Write("\n\nTHERE IS A TIE");
                    goto AGAIN;
                }

                Console.WriteLine("\nCOUNT: " + count);
            } while (winners[0].Hand.Name != HandName.Straight_Flush);
        }