MasterDeck - lcrocker/ojpoker GitHub Wiki
MasterDeck
Every game or simulation begins with a full deck of some kind that I call a
MasterDeck
.
This determines the initial state of the "live" decks actually
used for dealing cards, and such things as which cards are allowed, whether
duplicates are allowed, etc.
If you are playing Skat, for exmaple, you would begin with a 32-card German
deck with no cards below seven.
Error checking in the system would detect if, say, a five were to appear in a
hand or deck associated with that master.
The master also determines whether aces are high
or low, and does appropriate adjustments and error checking.
Master decks are generally named after the place where they are commonly used, or the specific games they are designed for playing, and you choose the master for your game by name. The common English/American 52-card deck most of you are familiar with can be summoned by the names "english" or "poker" or "bridge", for example. If your game is California lowball, where aces are low and a joker is included in the deck, ask for a "lowball" deck.
The contents and descriptions of all the master decks are kept in a
JSON5 document for ease of human editing.
Build scripts compile this into Dart and Rust code for the libraries,
though these source files are also checked into the repo so you don't
have to build them unless you want to change something.
If you do want to add a new deck, or add some aliases for an existing
deck, edit the JSON5 file, then run the build_master_deck_code.ts
script in the data
directory to rebuild the source files.
Source files
Dart · Rust · JSON data · Build script