Skip to content
← All projects

Circolo a Vapore

A gaming club that lives on a localhost port: briscola, scala 40, machiavelli, sette e mezzo, snakes & ladders and solitaire, opened from the browser of anyone on the same Wi-Fi. Bots take the free seats, every table has its own chat, and the cards are hand-drawn in SVG inside the project. It was written entirely by Claude — I only supplied the ideas.

Node.jsTypeScriptExpressSocket.IOesbuildESLintSVGHTMLCSSClaude Code
Screenshot of Circolo a Vapore

The six games

The Circolo has six tables inside, each with its own rules and its own interface:

  • Briscola, 2 to 5 players: every player for themselves at two, three and five, partners across the table at four. With three players a 2 comes out of the deck, as tradition demands. The points you’ve taken are only revealed at the end — and they’re hidden server-side too, so there’s no peeking.
  • Scala 40, 2 to 6, following the official FISCA rules: opening at 40 points, laying off onto anyone’s melds, swapping in for a joker, elimination at 101.
  • Machiavelli, 2 to 5: you can rearrange the whole table freely — break a run, steal a card from a four-of-a-kind to build something else — working on a draft the others only see once you confirm it.
  • Sette e mezzo, 2 to 6: there’s a banker, virtual chips, the wild card (the king of coins) whose value you choose, and the four you’re allowed to burn.
  • Snakes & Ladders, 2 to 6: a 100-square board drawn in SVG, brass ladders going up and copper steam-coil snakes coming down, and you only land on 100 with the exact roll. With the living snakes variant the snakes crawl across the board after every roll: the shortcut you had your eye on may not be there any more.
  • Solitaire, on your own, for when there’s nobody else at the club: the Klondike of old Windows, with hints, unlimited undo, the draw-three variant and an auto-finish that sends the cards cascading up to the foundations.

A four-player briscola table with cards played in the middle Briscola at four, in partnerships: your partner sits across the table, the trump card lies beside the stock, and tricks won are counted under each player.

A scala 40 table with melds laid down Scala 40: the melds on the table, with the joker labelled by the card it stands in for.

A machiavelli table with four melds and the hand below Machiavelli: the counters up top say how many cards you’ve laid down and how many melds still need fixing; dashed borders mark the groups your draft has touched.

A sette e mezzo table with the banker and the row of stakes Sette e mezzo: the banker, everyone’s chips and the row of stakes — your first card is yours alone to see.

The snakes and ladders board with pawns and the die Snakes & Ladders: a hundred squares drawn in SVG, with everyone’s position, the die, and a log of the last rolls.

The snakes and ladders board with the snakes moved off their usual squares Living snakes: after a few rounds the snakes are no longer where the traditional board puts them. They always crawl after the roll, never before, and they never slither over to bite a pawn that’s standing still.

A game of solitaire with the seven columns and the hint on the stock Solitaire: seven columns, four foundations and the stock, here lit up in copper by the hint. Face-down cards never leave the server until they’re turned over.

What it does

You play at home, on the same Wi-Fi. Start the server on one computer and everyone else — phones, tablets, other PCs — opens an address in the browser. Nothing to install, no accounts, no external service in the middle: the table is your home network.

You invite people with a link. The waiting room has the table’s link, to send a friend on WhatsApp or Telegram: whoever opens it sits straight down at that table, without hunting for it in the lobby. When sending a link isn’t handy, there’s the table code to read out loud.

Bots fill the empty seats. You can create a table for six and start the game on your own: the free seats go to bots. If someone drops mid-game their seat doesn’t vanish — a bot steps in and plays for them, and when they come back they rejoin from the lobby with the same name and pick their hand back up.

Three skill levels, different in each game. Novice, Usual and Master are chosen when the table is created, and every game has its own knobs: in briscola it changes how often the bot gets distracted and how many points make a trick worth taking; in scala 40 whether it spots the joker swap; in sette e mezzo how reckless it is about hitting on six. The level never touches the rules: a Novice plays badly, but it plays legally.

Every table has its own chat. Messages also pop up as speech bubbles next to whoever wrote them, angled towards the middle of the table, and italic system lines announce who joins, who leaves and who drops. On a phone the chat is a drawer that opens with 💬, with an unread counter.

The cards are drawn inside the project. Forty Italian cards, the French decks with and without jokers, and the snakes & ladders board: all hand-written SVG, not a single image downloaded from anywhere. There’s a gallery too, which shows each deck card by card.

The server is the only referee. Clients send actions and get back state filtered for their own seat: the opponents’ cards never leave the server, and an invalid move is rejected with a message without disturbing the game.

The rules are machine-tested. A simulation suite makes the bots play each other — twelve hundred games of briscola, hand after hand of scala 40 and machiavelli — and checks that cards are never lost or duplicated, that games always end, and that no bot ever attempts an illegal move. An end-to-end test does the same against the real server, disconnection and rejoin included.

The lobby with table creation and the bot skill levels The lobby: number of players, bot skill with the three levels side by side, and the address to hand to anyone on the same Wi-Fi.

The waiting room with the invite link and free seats that will become bots The waiting room: the invite link to send a friend, the code to read out loud, and whatever seats are still free, which become bots the moment the game starts.

A chat speech bubble next to a player during a game Table chat: every message also appears for a few seconds as a speech bubble next to whoever wrote it.

The gallery of the forty Italian cards The gallery: each deck card by card, all drawn in SVG inside the project.

Tech used

A Node.js server with Express for the static files and Socket.IO for the real-time side: tables, turns, bots and chat all live in the same process. The whole project — server, rules, bots, interface and tests — is TypeScript with the strictest checks the compiler offers (strict, noUncheckedIndexedAccess, exactOptionalPropertyTypes and friends), plus ESLint with typescript-eslint’s type-checked rules: no any, no ! assertions, no casts. Node runs the TypeScript directly, with no compile step; for the browser, esbuild bundles the interface together with the shared rules and the Socket.IO client. No framework: the steampunk theme is hand-written in CSS, phone rules included, and the cards and the board are SVG generated from code.

My favourite detail is that each rules engine is a single file used by both the server and the browser: the client can say straight away why a meld isn’t valid, and there’s no way for the two sides to disagree about the rules. The Socket.IO events are typed once and shared by both sides too; the server, though, treats everything coming off the network as unknown and checks its shape before using it, because a tampered client can send anything at all.

Moving from JavaScript to TypeScript also flushed out a few bugs no test had caught: a null action was enough to crash the server, a table of type __proto__ came out broken, and in briscola a non-numeric index played the first card in your hand.

Claude wrote it, start to finish

I didn’t write a line of this project. The code — rules engines, bot heuristics, interface, SVG cards, tests — was all written by Claude, with Claude Code. What I brought were the ideas: which games to add, how the bots should behave, what the table should look like, what felt wrong after playing an evening with it. The rest was one long conversation, one game at a time.