Each of the players is dealt 6 cards, and must contribute two cards to a secret hand (sometimes called the 'kitty' or the 'crib'), later scored by the dealer.
Very briefly, it is a card game played between two or three people (for simplicity, I'll only consider two-player games here). The GameĪn excellent overview of the game can be found here, so I won't go too far into the details. I'll show you how to write a library to score a cribbage hand, and share a couple of the challenges along the way. After Googling for existing scoring algorithms and not finding any, I set about writing my own. There are many interesting problems associated with that goal, but one of the core requirements would be a way to score a hand. Since MSN games removed multi-player cribbage from their list of online games, I've been interested in writing my own.