Crate card_play

Crate card_play 

Source
Expand description

§Card Play

A set of types, methods and functions for manipulating playing cards (common french-suited with or without jokers). Support for cutting, merging, both human style and fully random ordering shuffles, measuring shuffle quality (rising sequence based), drawing cards, moving cards in a deck etc. Handles card stacks containing more than one deck. Target user is someone who want to manipulate the deck such as magicians, etc. rather than users looking for an engine for card games. The solitaire_cypher was the first use.

Structs§

Cards
Container for an ordered collection of cards (i.e. a stack)
IllegalStringError
from_str() could not create the requested type
TwoStacks
Container for two ordered collections of cards, by convention (top, bottom), as you would obtain after a cut

Enums§

Card
The common card denominations (Ace, Two.., King, Joker)
JokerId
Used to differentiate the two Jokers in a deck of cards. In a Cards::new() deck with Jokers, the next to last card is JokerId::A, and the last card is JokerId::B
MergeType
Argument type specifying how two stacks of cards are to be merged - perfect “In” shuffle, perfect “out” shuffle or shuffled such that the next card to the output has equal odds of coming from either stack
Suit
The four card suits in a common (french-suited) deck of cards

Type Aliases§

DefCardValue
Bounded default card value
JokersPerDeck
Bounded argument type for specifying number of jokers per deck of cards
NoiseLevel
Bounded argument type for specifying level of randomness. 0 -> none, 10 -> the largest standard deviation