diff --git a/scoring.go b/scoring.go index 8b0673c..b8b0342 100644 --- a/scoring.go +++ b/scoring.go @@ -54,14 +54,14 @@ func (ph *PokerHand) calculateScore() { if ph.Hand.containsStraightFlush() { ph.Type = StraightFlush ph.Score = ScoreStraightFlush - ph.Score += 1000 * ph.Hand.HighestRank().Score() + ph.Score += ph.Hand.HighestRank().Score() return } if ph.Hand.containsFourOfAKind() { ph.Type = FourOfAKind ph.Score = ScoreFourOfAKind - ph.Score += 1000 * ph.Hand.fourOfAKindRank().Score() + ph.Score += 10000 * ph.Hand.fourOfAKindRank().Score() ph.Score += 100 * ph.Hand.fourOfAKindKicker().Score() return } @@ -69,8 +69,7 @@ func (ph *PokerHand) calculateScore() { if ph.Hand.containsFullHouse() { ph.Type = FullHouse ph.Score = ScoreFullHouse - // FIXME write a good test for this - ph.Score += 1000 * ph.Hand.fullHouseTripsRank().Score() + ph.Score += 10000 * ph.Hand.fullHouseTripsRank().Score() ph.Score += 100 * ph.Hand.fullHousePairRank().Score() return } @@ -110,27 +109,27 @@ func (ph *PokerHand) calculateScore() { if ph.Hand.containsThreeOfAKind() { ph.Type = ThreeOfAKind ph.Score = ScoreThreeOfAKind - ph.Score += 1000 * ph.Hand.threeOfAKindTripsRank().Score() + ph.Score += 10000 * ph.Hand.threeOfAKindTripsRank().Score() ph.Score += 100 * ph.Hand.threeOfAKindFirstKicker().Score() - ph.Score += 10 * ph.Hand.threeOfAKindSecondKicker().Score() + ph.Score += ph.Hand.threeOfAKindSecondKicker().Score() return } if ph.Hand.containsTwoPair() { ph.Type = TwoPair ph.Score = ScoreTwoPair - ph.Score += 1000 * ph.Hand.twoPairBiggestPair().Score() + ph.Score += 10000 * ph.Hand.twoPairBiggestPair().Score() ph.Score += 100 * ph.Hand.twoPairSmallestPair().Score() - ph.Score += 10 * ph.Hand.twoPairKicker().Score() + ph.Score += ph.Hand.twoPairKicker().Score() return } if ph.Hand.containsPair() { ph.Type = Pair ph.Score = ScorePair - ph.Score += 1000 * ph.Hand.pairRank().Score() + ph.Score += 10000 * ph.Hand.pairRank().Score() ph.Score += 100 * ph.Hand.pairFirstKicker().Score() - ph.Score += 10 * ph.Hand.pairSecondKicker().Score() + ph.Score += ph.Hand.pairSecondKicker().Score() ph.Score += ph.Hand.pairThirdKicker().Score() return } diff --git a/scoring_test.go b/scoring_test.go index febfd16..957df24 100644 --- a/scoring_test.go +++ b/scoring_test.go @@ -47,9 +47,9 @@ func TestHandDescripionBug(t *testing.T) { assert.Equal(t, weirdOne.Description(), "two pair, tens and sevens with a nine") scoreShouldBe := ScoreTwoPair - scoreShouldBe += 1000 * TEN.Score() + scoreShouldBe += 10000 * TEN.Score() scoreShouldBe += 100 * SEVEN.Score() - scoreShouldBe += 10 * NINE.Score() + scoreShouldBe += NINE.Score() assert.Equal(t, weirdOne.Score, scoreShouldBe) cards := weirdOne.Hand