Module deck

Source
Expand description

§Deck

Building on the previous card definition, let’s look at the value table for a standard 52-card deck

2345678910JQKA
Clubs983061640992954295578311082379213121342286258423187168120553358953367144223134253349268471337
Diamonds819861477792791095415111066059211489342123058406867167957353357321367127903134237029268455017
Hearts738581396512709815333831057931210676542041778398739167876073356508567119775134228901268446889
Spades698261356192669495293511053899210273342001458394707167835753356105367115743134224869268442857

Functions§

arrange
Given the deck of cards and the new position of each cards, return the new deck with new arrangement.
create
Create the deck of 52 cards
deal
Deal cards from the deck to each hand in a certain number
is_flush
Check if the deck is a flush
is_straight
Returns true if the cards are a straight (include wheel straight).
unique5
This function takes a deck of cards with up to five cards and generates a unique identifier that is independent of the card order