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§

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

Enums§

  • The common card denominations (Ace, Two.., King, Joker)
  • 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
  • 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
  • The four card suits in a common (french-suited) deck of cards

Type Aliases§

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