public Player(Hand hand) { if (hand == null) throw new ArgumentNullException("Player Instantiation Error", "Player hand was null"); _hand = hand; Name = "test"; HandType = HandEvaluator.GetHandType(_hand.Cards); }
public static void TestHandOrder(List<Card> cards) { Hand orderedHand = new Hand(cards); Debug.Assert(orderedHand.Cards is List<Card>, "Type Error", "orderedHand.Cards is not actually a List<Card>!"); Debug.Assert(orderedHand is Hand, "Type Error", "orderedHand is not actually a Hand!"); Console.WriteLine(orderedHand); Console.ReadKey(); }
public void DrawNewHand(Deck deck) { Hand = new Hand(deck.DrawCards(5)); }
public Player(string name, Hand hand) { Name = name; Hand = hand; }
public void DrawNewHand(Deck deck) { _hand = new Hand(deck.DrawCards(5)); HandType = HandEvaluator.GetHandType(_hand.Cards); }
public static void TestDrawingAHand() { var deck = new Deck(); deck.Shuffle(); //Creating and printing a hand was known to be working at this time. var hand = new Hand(deck.DrawCards(5)); Console.WriteLine("The drawn cards were: " + hand.ToString()); Console.ReadKey(); }
public static int GetHandType(Hand Hand) { List<Card> hand = Hand.Cards; bool isFlush = IsFlush(hand); bool isStraight = IsStraight(hand); if (isStraight && isFlush) return (int)HandType.StraightFlush; else if (ContainsSetOfX(4, hand)) return (int)HandType.FourOfAKind; else if (ContainsSetOfX(3, hand) && ContainsSetOfX(2, hand)) return (int)HandType.FullHouse; else if (isFlush) return (int)HandType.Flush; else if (isStraight) return (int)HandType.Straight; else if (ContainsSetOfX(3, hand)) return (int)HandType.ThreeOfAKind; if (ContainsTwoPairs(hand)) return (int)HandType.TwoPair; else if (ContainsSetOfX(2, hand)) return (int)HandType.Pair; else return (int)HandType.HighCard; }