static void Main(string[] args) { // Get 5 cards Hand hand = Get5Cards(); // Evaluate what kind of hand HandType ht1 = hand.Evaluate(); int highest1 = hand.cards.Max().rank; // Get 5 other cards Hand hand2 = Get5Cards(); // Evaluate type HandType ht2 = hand2.Evaluate(); int highest2 = hand2.cards.Max().rank; // If types are different, better one wins if (ht1 > ht2) { Console.WriteLine("Hand 1 (" + ht1 + (") is better than hand 2 (" + ht2 + ").")); } else if (ht1 < ht2) { Console.WriteLine("Hand 2 (" + ht2 + (") is better than hand 1 (" + ht1 + ").")); } // If types are same, evaluate with a tie breaker //Hand winner = TieBreaker(Hand ht1, Hand ht2, int highest1, int highest2); /* * else if (highest1 > highest2) * { * Console.WriteLine("Hand 1 wins with " + hand.cards.Max() + "."); * Console.ReadLine(); * } * else * { * Console.WriteLine("Hand 2 wins with highest " + hand2.cards.Max() + "."); * Console.ReadLine(); * } */ Console.ReadLine(); }
static void Main(string[] args) { Hand hand = Get5Cards(); HandType ht1 = hand.Evaluate(); Hand hand2 = Get5Cards(); HandType ht2 = hand2.Evaluate(); // If types are different, better one wins if (ht1 > ht2) { Console.WriteLine("Hand 1 is better"); } else if (ht1 < ht2) { Console.WriteLine("Hand 2 is better"); } else // If types are same, evaluate with a tie breaker { TieBreak(ht1, hand, hand2); } Console.ReadLine(); }