Youssef Jedidi
← All work

Independent project · 2026

Sole developer · Playable product · private online beta · 2026

Chkobba: one rules engine for every way to play

A Tunisian card game where one pure rules engine drives local play, bots, replays, simulations and private online rooms.

Role
Sole developer
Status
Playable product · private online beta
Chkobba Café theme showing a live solo table with cards, scores, and action receipts
Café theme. A solo match in the hosted build: cards, scores and the move log.

Background

Chkobba has hidden hands and captures with many legal combinations. If local play, bots, replays and online rooms each tracked the rules separately, they would drift apart.

Key decision

Every mode calls one pure function, applyAction(state, action). Bots and online players get a filtered view, so they never see other hands or the deck order.

React draws the table. Bots play from a restricted view and are compared in seeded arena runs. Online, a Durable Object per room checks each move and sends every player their own view.

React · TypeScript · Vite · Vitest · Cloudflare Workers · Durable Objects · WebSockets · Glicko-2

FULL GAME STATEevery hand, deck order and the seedSeeded RNGrng.ts · seededShuffleshuffle and dealapplyAction(state, action)src/game/reducer.tsPLAY_CARD · START_NEXT_ROUND · REMATCHpure and deterministic:same state + action, same resultthrows on an illegal moveOnline, this box is one Cloudflare Durable Object per roomworker/chkobba-room-worker.tsLocal tablesrc/app/App.tsxtap a card, pick a capture:a legal-move intentPLAY_CARDnext stateBot arenasrc/bots/botArena.tsseeded schedules, mirroredseeds and seat swaps,Glicko-2 ratingsbot gamescreateBotView()own hand, others’ card countsunknownCards = deck − seenstateBot agentsheuristicBot.tspick one legal movePLAY_CARDreduceOnlineRoom✓ client is in the room✓ actionId not seen before✓ game is in play✓ it is this seat’s turn✓ client owns the seatintentrejectredactOnlineRoomForClientother hands → hidden:<seat>:<i>seed → redactednext stateROOM_STATE, built per playerPlayers’ browserssrc/online/client.tsone WebSocket each,beta

Overview

One rulebook, four callers. It follows a move from the deal to each player’s screen; pick a step to stop on it.

  1. Shuffle and deal

    A seeded RNG shuffles and deals into the full game state: every hand, the deck order and the seed.

  2. A move at the local table

    Tapping a card and a capture sends PLAY_CARD to applyAction. The reducer is pure: the same state and action always give the same result, and an illegal move throws.

  3. Bots see a projection

    A bot never reads the state. createBotView gives it its own hand, the other players’ card counts, and the cards it has not seen yet.

  4. The bot plays like a player

    The bot picks one legal move from that view and sends the same PLAY_CARD action through the same reducer.

  5. The bot arena

    The arena runs bot-only games on seeded schedules, with mirrored seeds and seat swaps, and rates bots with Glicko-2. It uses the same reducer.

  6. An online intent is checked

    Online, each room is one Cloudflare Durable Object. Before applyAction runs, it checks that the client is in the room, the actionId is new, the game is in play, it is this seat’s turn, and the client owns the seat. Anything else is rejected.

  7. Each player gets their own view

    The new state is redacted per player before it is sent: other hands become hidden placeholders and the seed is removed. Each browser gets its own ROOM_STATE over its WebSocket.

Figure 1. One rulebook, four callers. The local table, the bot arena, the bots and the online room all call the same pure reducer. Bots and online players only ever receive a projection: createBotView hides other hands and deck order, and the room redacts hands and the seed before each message.

Where it stands

The game is playable online. 133 tests cover the rules, bots, localization and full online rounds, and any game can be replayed from its seed.

Online rooms are in beta, and bot ratings are used for tuning. Next are Safari and Firefox checks and a native speaker’s review of the Tunisian wording. The source is private.

The same Chkobba table rendered with the blue and pink Pixel theme
Pixel theme. The same table in another theme. The rules engine doesn’t change.
Chkobba Café theme lobby with local, computer, experimental, and online routes
Lobby. Local play, games against the computer, and private online rooms.

Links