public static int GetScore(PokerCard firstCard, PokerCard secondCard, IList <PokerCard> boardCards) { var hand = CurrentHandService.GetHand(firstCard, secondCard, boardCards); switch (hand) { case Hand.RoyalFlush: return(RoyalFlush); case Hand.StraightFlush: return(StraightFlush); case Hand.FourOfKind: return(Foursome); case Hand.FullHouse: return(FullHouse); case Hand.Flush: return(Flush); case Hand.Straight: return(Straight); case Hand.ThreeOfAKind: return(Threesome); case Hand.TwoPair: return(TwoPair); case Hand.OnePair: return(OnePair); case Hand.HighCard: return(SumCardRanks(firstCard, secondCard)); default: return(SumCardRanks(firstCard, secondCard)); } }
public static Hand GetHand(PokerCard firstCard, PokerCard secondCard, IList <PokerCard> communityCards) { var allCards = new List <PokerCard>(communityCards) { firstCard, secondCard }; return(GetHand(allCards)); }
public void score_is_1000_if_we_have_a_pair() { var card1 = new PokerCard("K", Suit.clubs); var card2 = new PokerCard("K", Suit.hearts); var boardCards = new List <PokerCard>(); var score = HandScoreCalculator.GetScore(card1, card2, boardCards); Assert.That(score, Is.EqualTo(1000)); }
public void score_is_the_sum_of_ranks() { var card1 = new PokerCard("10", Suit.clubs); var card2 = new PokerCard("9", Suit.hearts); var boardCards = new List <PokerCard>(); var score = HandScoreCalculator.GetScore(card1, card2, boardCards); Assert.That(score, Is.EqualTo(19)); }
private static int SumCardRanks(PokerCard firstCard, PokerCard secondCard) { return(firstCard.Rank + secondCard.Rank); }