pkg:clod/com.clodhub/holdem-rules 0.12.0 The rules of Texas hold'em poker for a turn-engine table: dealing, blinds, whose turn it is, legal bets and raises, side pots and winners, with every chip moved through chip-ledger; plus the betting controls' amount model. The rules of Texas hold'em poker, for a table run by turn-engine. It deals each hand, posts the blinds, moves the dealer button, says whose turn it is and what they may do (fold, check, call, bet or raise, and by how much), checks every move, deals the flop, turn and river, works out the main and side pots and who wins each, and decides how long the result stays on screen. Every chip moves through chip-ledger, so no chip is ever lost or made up. It knows nothing about seats joining, clocks, screens or computer play: turn-engine and the other components supply those. On the client side it supplies the betting controls' amount model (steps, quick amounts, all-in) for web, Apple and Android. In detail: Texas hold'em as the game-rules interface a turn engine drives, over a hand state machine. `createGameRules({ranking, ledger, deck, schedule, rules?})` provides `optionNames`, `newRound`, `phase`, `parseMove`, `act`, `defaultMove`, `step`, `outcome`, `voidRound`, `observation`, `records`, `publicView`, `legal` and `prompt`, exactly as turn-engine declares them. A round is `{hand, autoSteps}`; the engine's chip ledger goes in and comes back on every call, and every chip moves through chip-ledger operations (`commit`, `fold`, `endRound`, `returnUncalled`, `buildPots`, `awardPot`, `settle`, `voidHand`), so the ledger's `sidePots`, `oddChipRule` and `minimumUnit` settings decide the pots and amounts. `newRound` draws a shuffled deck from card-deck, reads the blinds from level-schedule, moves the button from the carry it returned last time (dead button, heads-up swap), deals, posts blinds (a short stack posts what it has) and finds the first actor. `phase` says who acts (with the settle plus the time to deal cards), or that the table deals the board by itself (3 s between cards), or that the round is over. `act` checks turn, stage and amount, handles short all-in raises (a short raise reopens the betting only when short raises add up to a full one) and goes on to the next actor, street, runout or settlement. `outcome` gives how long to hold the result (6 s when nobody showed down, 22 s a showdown, 27 s when a kicker decided, 42 s for a draw) and a history entry with the winners. `observation` is poker-strategy's DecisionInput; `records` are the hole cards for private-views; `legal` is all false when paused. The hand state machine (`createHoldem`: `newHand`, `legalActions`, `apply`, `autoAction`, `runoutStep`, `settle`, `voidHand`, `view`, `stacks`, `chipsInPlay`, `parseAction`, `attachLedger`) is the lower layer. Client side, `implementation/web|apple|android` hold the betting controls' amount model (step, quick amounts, nudging, all-in detection) with no screen code. Examples A nine-person tournament table; a heads-up final; a short stack all-in against two deeper stacks with a side pot; a split pot on a board play; a hand voided when the tournament is cancelled; a coach who stops at the runout to explain the pots. Package URL: pkg:clod/com.clodhub/holdem-rules@0.12.0 Class: Texas hold'em rules (pkg:clod/com.clodhub/holdem-rules-class@1.1.0): Blinds, betting rounds, legal actions and showdown for Texas hold'em. Any component of this class can fill a recipe slot that asks for it. Category games/cards/poker; https://clodhub.com/classes/holdem-rules-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Fholdem-rules-class Provides (1) - game-rules (com.clodhub/game-rules 1.0.0): The game-rules interface a turn engine drives, provided for Texas hold'em. Build it with createGameRules(deps, settings, pacing); methods named `GameRules.` are members of the object it returns. A round is { hand, autoSteps }: JSON-safe and opaque to the engine. The chip ledger (com.clodhub/chip-ledger) is passed in and returned on every call that moves chips; the hand moves chips only through chip-ledger operations, so the ledger's sidePots, oddChipRule and minimumUnit settings decide the pots. Every operation is pure: it returns new values and never changes its arguments. Engine contract: at the start of a round call newRound with the players still in, keep the returned carry for the next round and write the returned ledger back; while phase(...).stage is acting, wait for a move, parseMove it and act it (or act defaultMove with auto true), writing the ledger back every time; while it is auto, call step after autoDelayMs; when it is over, outcome gives holdMs for the result pause, result for the clients and historyEntry for round-history; to cancel mid-round, voidRound returns every wager through the ledger. The lower layer, the hand state machine, is createHoldem; its members are the `Holdem.` methods. Server: TypeScript `implementation/server/index.ts` (rules.ts, holdem.ts, pots.ts, types.ts). Client betting controls: TypeScript `implementation/web/betting.ts`; Swift `implementation/apple/Sources/Betting.swift` and Kotlin `com.clodhub.holdem` `Betting.kt` have BetRange (adjusted, allows, canSlide, kind, snap rounding down), betStep, betPresets, callIsAllIn and betIsAllIn. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Fgame-rules Requires (5) - 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 provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Fcard-deck - chip-ledger (com.clodhub/chip-ledger 1.0.0): Whole-number chip accounting: stacks, bets, pots and side pots, odd chips. No game rules and no card knowledge: callers say who won each pot. Every function returns a new ledger and never changes its input. TypeScript, `implementation/server/ledger.ts`. Methods named `LedgerApi.` are members of the object createLedgerApi returns (the operations a tournament calls, with the settings bound). components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Fchip-ledger - level-schedule (com.clodhub/level-schedule 1.0.0): Stakes that rise on a timer. A level is {label, values}: the values are whatever the game steps up (blinds, an ante, a target score); the component never looks inside them except to scale them. TypeScript, `implementation/server/levels.ts`. Methods named `ScheduleApi.` are members of the object createScheduleApi returns: the tournament's view, with the clock reading as the only argument. components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Flevel-schedule - hand-ranking (com.clodhub/hand-ranking 1.0.0): The best five-card poker hand out of five to seven cards. A higher score wins; equal scores tie. TypeScript, `implementation/server/index.ts` (ranking.ts, codes.ts). Build a ranking with createHandRanking(codes) over card-deck's cardCodes, or use the ready-made handRanking; methods named `HandRanking.` are members of that object. components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Fhand-ranking - rules-settings (com.clodhub/rules-settings 1.0.0): A house rules file checked against its schema and read by path. The engine form is `RulesReader.value(path)` over checked rules, from createRulesSettings(rules) or loadRulesSettings({rulesFile, strict}, folder); methods named `RulesReader.` are members of that object. The `rulesFile` setting is a name (a lower-case slug, default house-rules), not a path: the rules are /.json with their schema beside them as /.schema.json. The checker supports type, enum, const, minimum, maximum, minLength, maxLength, pattern, items, minItems, maxItems, properties, required, additionalProperties, oneOf, anyOf and local $ref; annotation keywords are ignored and any other keyword makes the schema unusable. Browser and server: TypeScript `implementation/web/schema.ts`; file loading (server only): `implementation/server/rules.ts`, which also exports everything of schema.ts. components that provide it: https://clodhub.com/components.txt?provides=com.clodhub%2Frules-settings Settings (3) The installer collects three optional settings. `seats` is the number of seats at the table (whole number of at least 2; default 9); it decides who is next round the table and where the odd chip of a split pot goes. `minimumOpeningBetBigBlinds` is the smallest first bet of a betting round, and the smallest raise at the start of a round, in big blinds (whole number of at least 1; default 1, the usual no-limit rule; 2 makes the smallest bet twice the big blind). `revealAtRunout` (true or false; default true) turns every remaining hand face up as soon as nobody can bet any more, as in televised poker; false keeps them hidden until the showdown. When the application gives a rules file through rules-settings, its `players.maximum` and `betting.minimum_opening_bet_big_blinds` are used instead of the first two. - seats: integer; optional, default 9 - minimumOpeningBetBigBlinds: integer; optional, default 1 - revealAtRunout: boolean; optional, default true Depends on components: none How to use in a recipe A recipe uses it through a slot of class Texas hold'em rules (pkg:clod/com.clodhub/holdem-rules-class 1.1.0), naming pkg:clod/com.clodhub/holdem-rules as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (game-rules) to the slots that use it. It fills what the component needs (card-deck, chip-ledger, level-schedule, hand-ranking and rules-settings) from slots whose components provide them. The recipe sets seats, minimumOpeningBetBigBlinds and revealAtRunout; any it leaves out takes its default. - as a slot in recipe.json components: {"id":"holdem-rules","class":{"name":"pkg:clod/com.clodhub/holdem-rules-class","version":"1.1.0","digest":"1664db6eb3bc74d855ae5998c6bdcc7dc2a9c07b2b139477d209209357d47c4f"},"preferred":{"name":"pkg:clod/com.clodhub/holdem-rules","version":"0.12.0"}} - in place of another component of the class: clod fetch holdem-rules@0.12.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=holdem-rules@0.12.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot holdem-rules) For developers: how an application uses it turn-engine calls this component for everything that happens inside a round and owns the room, clocks, players, pauses, computer players and the tournament around it. Binding: `ranking` is poker-hand-ranking's operations; `ledger` is chip-ledger's operations as they are (the ledger value travels through the engine, not through this component); `deck` is card-deck's `createShuffledDeck`; `schedule` is level-schedule's `levelInfo` bound to the table's Schedule (levels with values `{sb, bb}`); `rules` (optional) is rules-settings `value(path)` bound to the loaded rules. At the start of a round the engine calls `newRound` with the players still in, the tournament's ledger and its random source, and keeps the returned `carry`. It then reads `phase`: while acting it waits its decision clock and calls `act` with a `parseMove`d move (or `defaultMove` with `auto: true`); while auto it calls `step` after `autoDelayMs`; when over it reads `outcome` (hold time, result for clients, history entry for round-history). Every call that moves chips takes and returns the ledger; the ledger must be the one last returned (chips of players outside the round may change in between, for a rebuy). Clients get `publicView`, `legal` and the hole cards from `records` through private-views; computer players get `observation`, which is poker-strategy's DecisionInput. Web, Apple and Android controls call the amount model with the `bet` range from `legal`. Accounts and services No deployed service, account or key. Pure functions; no clocks and no storage. A hand serialises to about a few kilobytes of JSON. How it is checked `node --test tests/server.test.ts tests/rules.test.ts tests/web.test.ts` plays scripted hands (heads-up to showdown, three-handed fold-out, dead button and heads-up positions, minimum raise sizes and refused amounts, short all-in that does not reopen betting, short raises that add up to a full raise, side pots won by different players, uncalled chips returned, split pots with the odd chip clockwise from the button, folded chips above the last live layer, runout, voluntary show, view masking, void) and 60 random games of 2 to 9 players on the lower layer; `tests/rules.test.ts` plays eight scripted rounds through the interface only (with a fake deck, a fake schedule, and both the real chip ledger and an independent fake ledger) and asserts the same public facts after every step, the same result and positions as the lower layer, the hold time and the history entry; covers each of the 14 operations (pacing, codes, observation shape, records, prompt, paused legal, void, settings from the rules file, ledger mismatch, minimum unit, `sidePots` off and `first-listed` odd chip through the ledger, ledger call order) and 40 random games through the interface with the ledger balanced after every step. Chip-ledger, card-deck and poker-hand-ranking are copies of the current provider files under `tests/support/`. `python3 tests/native.py apple` compiles and runs the Swift amount model against the same fixture the web tests read. `python3 tests/native.py android` does the same with kotlinc and java (written, not run: kotlinc is not installed on the build machine). `authoring/differential-vs-recipe.ts` (not packaged) drove the recipe's engine.ts and the lower layer (with the real chip ledger) with the same decks and the same random legal actions over 540 hands and 4409 actions (112 refused identically) and compared stacks, bets, street, actor, bet to match, pots, winners, shown cards and positions after every action: no difference except the one hand where the recipe loses chips (see SOURCE.md). - `node --test tests/server.test.ts tests/rules.test.ts 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 A round in progress can be stored as the Round value. Removing the component removes the files under components/holdem-rules/; nothing is stored. Tags: cards, games, holdem, poker, rules Targets: client android, ios, macos, tvos, web, windows; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/holdem-rules release v0.12.0; digest sha256:9145f12927f28b2174796e6c35dcb647c29d691170512c827eb9553e97d45514 Release: features Line 0.12: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/holdem-rules/0.12.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/holdem-rules/0.12.0 Bundle download: GET https://clodhub.com/api/components/holdem-rules/0.12.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/holdem-rules-class@1.1.0 1664db6eb3bc74d855ae5998c6bdcc7dc2a9c07b2b139477d209209357d47c4f com.clodhub/game-rules 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, 46 files (listed on the details page) Suitable for jobs: holdem-rules profile any: cost none; load none; regions any; compliance none Notes: Pure library. No hosted service, account or provider limit applies. A full random game of nine players plays in well under a millisecond per action on the build machine. Data migration: this component keeps no data Maintainers: Level N Ltd; https://github.com/clodhub/holdem-rules/issues; updates https://github.com/clodhub/holdem-rules/releases (manual) What you download holdem-rules-0.12.0.tar, from release v0.12.0 of clodhub/holdem-rules: 46 files - Documents and manifests (8): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (9): android/ (1), apple/ (1), server/ (5), web/ (2) - Tests (13): android/ (1), apple/ (1), fixtures/ (1), native.py, rules.test.ts, server.test.ts, ... - Interface documents (6): game-rules.json, required-card-deck.json, required-chip-ledger.json, required-hand-ranking.json, required-level-schedule.json, required-rules-settings.json - Class files: the class's interfaces and shared checks (4): holdem-rules-class/ (4) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 9 of them into the application under components/holdem-rules/: android 1, apple 1, server 5, web 2 Not included: the components that provide what it requires (com.clodhub/card-deck, com.clodhub/chip-ledger, com.clodhub/level-schedule, com.clodhub/hand-ranking, com.clodhub/rules-settings), 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.12.0 features (2026-11-26T11:27:49.333Z) sha256:9145f12927f28b2174796e6c35dcb647c29d691170512c827eb9553e97d45514 Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/holdem-rules/details.txt?version=0.12.0 Page: https://clodhub.com/components/holdem-rules; JSON: https://clodhub.com/api/components/holdem-rules/0.12.0; connections diagram: https://clodhub.com/api/components/holdem-rules/0.12.0/connections.svg Copyright Level N Ltd 2026