#cards #playing-cards #french-suited-cards

playin-cards

♠ Library for French-suited playing cards

3 releases

0.1.2 Mar 24, 2023
0.1.1 Aug 20, 2022
0.1.0 Aug 6, 2022

#1165 in Text processing

MIT license

32KB
551 lines

PLAYIN-CARDS

A crate for representing, formatting, and parsing French-Suited playing cards. The main objective of the project is to provide utility to crates implementing card games or card-game analysis.

Design

In keeping with the goals of being a lightweight library, as well as best practices with regard to separation of concerns, playin-cards is designed to be minimal, limiting its scope only the representation and conversion of playing cards. As such, it does not not provide shuffling, the concept of hands, or the concept of rank values. Such concerns are specific to the application using playin-cards and are therefore left to consumers to implement. This design maximizes the breadth of use-cases of playin-cards while minimizing its dependencies.

Features

  • Jokers
  • Iterable ranks and suits
  • ASCII and Unicode representations of cards, ranks, and suits
  • Copy semantics for all types
  • Single character representations of cards: 🃞
  • Convert single char to rank or suit
  • Convert 2-character str to card
  • Generate a shoe of arbitrary number of decks, with or without Jokers

Dependencies

~2MB
~46K SLoC