pkg:clod/com.clodhub/card-deck 0.11.0 A standard 52-card deck, optionally several decks and jokers: create, shuffle through an injected random source, deal, burn, and read card codes on server, web, Apple and Android. Every card game needs the same data: which cards exist, how to name them, how to shuffle them fairly, and how to hand them out. This component holds that and nothing about any particular game. A card is a two-character code (rank 2-9, T, J, Q, K, A, then suit c, d, h, s; jokers are `*r` and `*b`). A `Deck` is an immutable pair of piles: cards still to deal and cards burned. `shuffleDeck` shuffles through an injected random source, so tests can replay a deal. Clients get the data side of cards (colour, suit glyph, court name, rank label) without any drawing code; faces belong to `card-graphics`. Examples A hold'em table shuffles a single deck each hand. A game with several decks (a shoe) sets `decks` to 6. A rummy-style game sets `jokers` to true. A test fixes the deal by injecting a source that reorders the deck in a known way. Package URL: pkg:clod/com.clodhub/card-deck@0.11.0 Class: Card deck (pkg:clod/com.clodhub/card-deck-class@1.1.0): A deck of playing cards: building, dealing and naming cards. Any component of this class can fill a recipe slot that asks for it. Category games/cards; https://clodhub.com/classes/card-deck-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Fcard-deck-class Provides (1) - card-deck (com.clodhub/card-deck 1.0.0): Playing cards: create, shuffle, deal and burn, plus card codes, colours and names. Server and rules code: TypeScript `implementation/server/deck.ts`. Client card facts: TypeScript `implementation/web/cards.ts` (cardFacts, rankLabel), Swift `CardCode` (`implementation/apple/Sources/CardCodes.swift`) and Kotlin `com.clodhub.deck.CardCode` (`implementation/android/.../CardCode.kt`). Every deck operation returns a new deck and leaves its arguments unchanged. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Fcard-deck Requires (1) - random-source (com.clodhub/random-source 1.0.0): Random numbers behind one interface: a seeded generator (Mulberry32) tests can replay, and a source backed by the platform's cryptographic generator. TypeScript, `implementation/server/random.ts`. Methods named `RandomSource.` are members of the object the factories return. components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Frandom-source Settings (2) The installer collects two settings. `decks` is how many 52-card packs to combine (whole number, 1 to 8; default 1). `jokers` adds two jokers per pack when true (default false). - decks: integer; optional, default 1 - jokers: boolean; optional, default false Depends on components: none How to use in a recipe A recipe uses it through a slot of class Card deck (pkg:clod/com.clodhub/card-deck-class 1.1.0), naming pkg:clod/com.clodhub/card-deck as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (card-deck) to the slots that use it. It fills what the component needs (random-source) from slots whose components provide it. The recipe sets decks and jokers; any it leaves out takes its default. - as a slot in recipe.json components: {"id":"card-deck","class":{"name":"pkg:clod/com.clodhub/card-deck-class","version":"1.1.0","digest":"a7cf8847deeaf2c5e26cd26967dafb5f43302b45f68dc17c8fad982237f5d21b"},"preferred":{"name":"pkg:clod/com.clodhub/card-deck","version":"0.11.0"}} - in place of another component of the class: clod fetch card-deck@0.11.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=card-deck@0.11.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot card-deck) For developers: how an application uses it Server code builds a deck from the settings, shuffles it with the `random-source` the recipe connects, and deals with `deal(deck, n)`. Cards come off the end of the pile, first card first. Rules components (`holdem-rules`, `poker-hand-ranking`, `poker-odds`) use `parseCard`, `rankOf` and `suitOf`. Client code uses `cardFacts` (web) or `CardCode` (Apple, Android) to decide colour, glyph and court name before handing the result to a graphics component. The required `random-source` is used through one method, `shuffle(items)`; a created fair-shuffle source (`createSource`, `seededSource`, `secureSource`, `sourceFrom`) has it, and so does any object with that method, so the component is testable without the shuffle component. `cardCodes` is the `CardCodes` object (ranks, suits, names, `rankOf`, `suitOf`, `fullDeck`) that poker-hand-ranking takes. Accounts and services No deployed service and no accounts; local library functions only. How it is checked `tests/web.test.ts` (required-local) checks the 52-card pack, jokers and decks counts, code parsing against `tests/fixtures/cards.json`, shuffling through an injected source, `cardCodes`, deal order and errors, burn, and a nine-player hold'em deal. `tests/native.py apple` compiles `CardCode.swift` with swiftc and checks the same fixture (run and passed on this machine). `tests/native.py android` compiles `CardCode.kt` with kotlinc and checks the same fixture; kotlinc is not installed here, so it was written but not run. `authoring/integration.test.ts` (not packaged) deals with the real fair-shuffle sibling and ranks with the real poker-hand-ranking sibling. - `node --test tests/web.test.ts` (web, required-local; tools: node 26.5) - `python3 tests/native.py apple` (apple, platform; tools: python3 3.12, swiftc 6.4) - `python3 tests/native.py android` (android, platform; tools: python3 3.12, kotlinc 2.2, java 26.0) Updates Patch updates replace the files only. Card codes and the order of `createDeck` are part of the contract: changing either is a new major version. The component keeps no data. Tags: card, cards, deck, games Targets: client android, ios, macos, tvos, web, windows; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/card-deck release v0.11.0; digest sha256:d79e4d39b938cf92e54ad31089e1f113a03d33819e5bf9e9228651d424e61881 Release: features Line 0.11: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/card-deck/0.11.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/card-deck/0.11.0 Bundle download: GET https://clodhub.com/api/components/card-deck/0.11.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/card-deck-class@1.1.0 a7cf8847deeaf2c5e26cd26967dafb5f43302b45f68dc17c8fad982237f5d21b com.clodhub/card-deck 1.0.0 entry modules: android android/src/main/java, ios apple/Sources, macos apple/Sources, server server/index.ts, tvos apple/Sources, web web/index.ts, windows web/index.ts shared behaviour suites: shared Platforms: android, ios, macos, server, tvos, web, windows Toolchains: android >=8.0.0, ios >=17.0.0, java >=17.0.0 <27.0.0, kotlin =2.4.21, macos >=14.0.0, node >=26.5.0 <27.0.0, swift =6.4.2, tvos >=17.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 30 files (listed on the details page) Suitable for jobs: card-deck profile any: cost none; load none; regions any; compliance none Notes: Pure library; no provider limits apply. Data migration: this component keeps no data Maintainers: Level N Ltd; https://github.com/clodhub/card-deck/issues; updates https://github.com/clodhub/card-deck/releases (manual) What you download card-deck-0.11.0.tar, from release v0.11.0 of clodhub/card-deck: 30 files - Documents and manifests (8): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (6): android/ (1), apple/ (1), server/ (2), web/ (2) - Tests (5): android/ (1), apple/ (1), fixtures/ (1), native.py, web.test.ts - Interface documents (2): card-deck.json, required-random-source.json - Class files: the class's interfaces and shared checks (3): card-deck-class/ (3) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 6 of them into the application under components/card-deck/: android 1, apple 1, server 2, web 2 Not included: the components that provide what it requires (com.clodhub/random-source), each a separate download; the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.11.0 features (2026-11-26T11:24:27.968Z) sha256:d79e4d39b938cf92e54ad31089e1f113a03d33819e5bf9e9228651d424e61881 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/card-deck/details.txt?version=0.11.0 Page: https://clodhub.com/components/card-deck; JSON: https://clodhub.com/api/components/card-deck/0.11.0; connections diagram: https://clodhub.com/api/components/card-deck/0.11.0/connections.svg Copyright Level N Ltd 2026