B7 · Codemojex
Codemojex — the reference game.
Codemojex is a competitive game in the Mastermind family: players race to decode a secret of six emoji, for keys and prizes, against a clock. This chapter writes it end to end as the BCS exemplar — a generic engine where a classic live room and a blind Golden Room are two modes of the same branded model, over identity, a Postgres floor, an EchoStore cache, an EchoMQ bus, and a Phoenix surface.
Six modules, three dives each, in three movements — the model, the play, and the live game. All six modules are built — the model, the play, and the live game, end to end. The current code is a skeleton; these modules write the complete game, both modes, on the core already standing.
The six modules
each three dives — the complete game, both modesThe Game as Branded Systems
Every entity a branded id that is the primary key and the address in every layer — USR, PLR, ROM, GAM, GES and the rest — over four layers, with the privacy line a player never crosses.
Rooms, Modes, and the Secret
A room is a template carrying a mode; a game snapshots it and pins a secret of six distinct codes, immutable for its life and, in a Golden Room, sealed behind a commitment until reveal.
B7.3Guesses on Fair Lanes
A guess of six codes, locked positions overlaid, charged on the room’s currency path, then a branded job on the player’s PLR lane. The bus rotates service so one masher cannot starve the field.
Scoring, Tiers, and Settlement
Distance per position to a score out of 600 across thirty tiers for live rooms, and one batch settlement paying the top players for sealed Golden Rooms. Settlement is a strategy the game selects.
B7.5The Economy and the Bank
Keys, clips, and diamonds on separate paths; a transactional wallet on Postgres; a bank escrow per game that the pool accrues in and pays out from after a published rake.
B7.6The Live Surface on Phoenix
A JSON API through one facade behind privacy-safe views, a game channel that pushes live results with no per-game process, the supervised tree shipped on Fly.
The chapter, in one law
codemojex · docs, schemas, the modelCodemojex is the reference implementation — the game whose code proves the architecture rather than describing it — and a member of the Mastermind family, built as a generic engine. A secret of six emoji codes, guesses that cost a currency, a score or, in a Golden Room, no feedback at all until a single settlement, modelled in BCS and run over the layers the course has built. Branded ids — USR, PLR, ROM, RMP, GAM, GES, EMS, RSC, TXN, BNK and the commerce, growth, and analytics kinds — are the primary keys; Postgres is the system of record for money and a game’s secret; EchoStore caches what is immutable for a game; EchoMQ carries guesses on fair per-player lanes to one scorer; and Phoenix serves a privacy-safe surface, supervised and shipped on Fly. The classic live room and the blind Golden Room are two modes of the same engine, so a radical variant needs no new identity types. Six modules write it whole: the model, rooms and the secret, guesses on fair lanes, scoring and settlement, the economy and the bank, and the live surface. Grounded in the codemojex app and in the identity, bus, store, and floor the earlier chapters built.
The standalone course
/codemojex · nine chaptersCodemojex — the course
The standalone course over the shipped engine: nine chapters (C0–C8) of three dives each, from the identity law to the production node, in its own Telegram-blue calibration of this contract sheet.
/codemojex/commerceC6 — The Revenue Ledger and the KeyShop
What B7 does not cover: the house’s signed RVL ledger and the multi-rail KeyShop pay-in behind an exactly-once gate; cash-out carried forward.
C8 — Production Deployment
The supervision tree, the pinned release image, and the pragmatic single-thread Valkey node, taught in full.
The doors
the sibling coursesEchoMQ — the protocol, in depth
The bus B3 narrates, taught rung by rung: the keyspace, the Lua inventory, and the 3.0 Stream Tier — XADD, XREADGROUP, XACK — with conformance on Valkey.
Redis Patterns Applied
The substrate patterns under the bus: sorted sets, atomic Lua moves, locks, and streams — the judgement layer.
/echo-persistenceEcho Persistence — the durable floor
Beneath the volatile tiers: the Graft page engine built twice, the commit-LSN loop, and the stream archive on Tigris. Where Part I says state lives somewhere, this says where it lives durably.
References
sources · relatedSources
- King — Announcing Snowflake (2010)the branded ids that are Codemojex's primary keys
- Helland — Life Beyond Distributed Transactions (CIDR 2007)durable entities and a system of record a game can audit
- Kreps — The Log (LinkedIn Engineering)the queues and streams that carry guesses and rebuild derived state
- Erlang/OTP — the ets modulethe read-hot cache that holds a game's immutable secret and set
Related
- BCS — the course homethe law, the id anatomy, the chapter map
- Echo Persistencethe durable floor beneath the bus