Skip to content

Commit

Permalink
Merge pull request #27 from daithihearn/prevround
Browse files Browse the repository at this point in the history
fix: must follow on cold card
  • Loading branch information
daithihearn authored Feb 1, 2024
2 parents 6e87a38 + f1f2b1f commit 74058c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/game/game-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func isFollowing(myCard CardName, myCards []CardName, currentHand Hand, suit Sui

var mySuitedCards []Card
for _, card := range myCards {
if mySuit == leadOut.Suit {
if card.Card().Suit == leadOut.Suit {
mySuitedCards = append(mySuitedCards, card.Card())
}
}
Expand Down
8 changes: 8 additions & 0 deletions pkg/game/game-utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,14 @@ func TestGameUtils_isFollowing(t *testing.T) {
suit: Diamonds,
expectedResult: true,
},
{
name: "Must follow a cold card",
myCard: JACK_HEARTS,
myCards: []CardName{JACK_HEARTS, FIVE_HEARTS, TWO_SPADES},
currentHand: Hand{LeadOut: FIVE_SPADES},
suit: Clubs,
expectedResult: false,
},
{
name: "Following",
myCard: THREE_CLUBS,
Expand Down

0 comments on commit 74058c9

Please sign in to comment.