Durak
Durak is a card game for two to six players at a kitchen table drawn in 3D, an oak table under a green checked cloth, played with the Russian Atlas deck. Every page joins one room, which holds the table, deals the cards and decides every move. Nobody’s page receives a card it may not see.
Run it
Section titled “Run it”From the repository’s root, in two terminals:
pnpm room:durakbuilds the room and starts it onws://localhost:8795.pnpm dev:durakserves the page onhttp://localhost:4211.
Each tab joins as its own player; ?name= names the player, and ?room= sets the room’s address.
Two ways to sit down
Section titled “Two ways to sit down”Durak opens on a choice of two buttons.
Quick play seats the player at the table Play opened, with anyone else there who pressed it. The table deals 12 seconds after the first Quick play, to those who pressed it, and fills the seats up to four with bots. Players still choosing, and players who join during a round, watch it; Deal me in next puts them in the next deal, which starts 10 seconds after a round ends.
Play with friends moves the player to a private table of their own, which Play never fills. The player’s friends join the player from Friends in the Spawnite app, where the player shows as playing Durak, with Join. A friend’s QR code, or the friend’s handle, adds the friend as a friend first. The player who has been at the table longest is the host: the host picks how many bots to add, none to five, enough to make three seats until the host picks, and presses Start with two seats or more. A room that cannot teleport, such as the one pnpm room:durak runs, turns its table into the private table instead, when the player is the only player in it.
The rules
Section titled “The rules”Durak is played here by the podkidnoy rules, with throw-ins, and without passing the attack on (perevodnoy):
- The deal. A set of 36, six to ace. Each player gets six cards. The next card is turned face up under the deck, and its suit is trump; it is drawn last. Six players take the whole deck, and the last card dealt names trump and stays in its hand.
- The first attack. The player with the lowest trump attacks the next player, in turn order.
- A bout. The attacker leads any card. While the bout runs, the attacker and every other player still in may add a card whose rank is already on the table. A bout holds six attack cards at most, and no more than the defender held as it began.
- Defending. The defender beats each attack card with a higher card of its suit, or with any trump when it is not a trump. The defender may take instead; the others may then still add cards before the defender picks them all up.
- The bout’s end. Once every attack card is beaten, or the defender takes, a 4-second throw-in window opens: a ring beside the bout empties, and any other player may add a card, which opens it again once the defender has answered. The bout ends as the window closes, or at once when it holds all it may. The window lasts the same whatever anyone holds, so the moment a bout ends tells nobody what the others hold. Beaten cards go face down to the discard pile.
- Refilling. Hands refill to six from the deck, the attacker first, the others in turn order, and the defender last.
- The next attack. After a beaten bout the defender attacks next. After a take, the player after the defender does.
- The end. A player whose hand empties once the deck is empty is out, and safe. The last player holding cards is the durak. When the last cards leave every hand at once, the round is a draw.
Each decision has 30 seconds. When the clock runs out, the table moves for the player it waits on: a defender takes, and a lead plays the lowest card. A bot, or a player who left the room, moves after 1.2 seconds. A player who comes back with the same account takes back their seat and hand.
Playing a card
Section titled “Playing a card”The player’s own hand stands over the near edge of the table, sorted by suit with the trumps last. The cards the player may play stand up and the rest dim; Tab reaches them as buttons too. A tap picks a card and a second tap plays it: a lead, a throw-in, or a defence of the first attack card it beats. With a card picked, a tap on an attack card in the bout beats that one. While the defender may take, Take sits on the cloth under the bout, saying how many cards the defender would pick up. While the window runs, a player with a card to add sees Throw in? by the ring, and the cards that player may add stand up.
What it builds on
Section titled “What it builds on”The rules are plain functions over one state object, in src/rules/durak.ts, tested with whole rounds of bots for two to six. src/rules/table.ts runs them in the room: the lobby, the host, the quick table’s clock, the seats, the bots and the clock of each decision. The round’s state is a Reach.Authority trait, each player’s hand a Reach.Owner trait on the player entity, and the table every page sees holds only the counts, the trump and the bout. Moves are commands of the plugin in src/game.ts, refused with the rules’ own reasons, and the page runs the same checks over what it may see for its hints and buttons. A private table is a room kind the game declares, which teleportPlayers opens with a join hint.
The cards kit under src/kits/cards/ is copied from Crazy Eights, and its card view draws Durak’s own atlas, src/assets/atlas-deck.webp. The atlas holds the 36 cards and a back of the Atlas deck, the Soviet pattern after Adolf Charlemagne’s 1860s design, drawn by Dmitry Fomin and dedicated to the public domain (CC0) on Wikimedia Commons. Its corners carry J, Q, K and A in place of the Cyrillic В, Д, К and Т.