Strato: the card game I shelved for three years, and what brought it back

Posted on 12/5/2026

Strato on three phones: the home screen, a game in progress, and a daily deal result.

There’s a card game I love playing with friends and family: simple to learn, but surprisingly hard to put down. I wanted to play it with people who weren’t sitting at my table, so in 2022 I started building it. Then I stopped. Three and a half years later I picked it back up, and within days it turned into something I’m genuinely proud of: Strato, a free web game you can play against bots, pass around one phone, or play online with friends, with no account and no server.

This is the story of how it got here, including the part where the thing I was proudest of in 2022 turned out to be exactly what I had to replace.

The game in sixty seconds

If you’ve never played, here’s all you need for the rest of this post:

The Strato table on a phone: Parker and two bots as avatars at the top, the deck and a 10 on the discard pile in the middle, a 2 in hand, and the choice between Keep + swap or Discard + flip above Parker's grid

That doubling rule bites. In this round Parker went out first with 21, but the Master bot, Nova, finished on 2, so 21 became 42:

Round results: Nova wins the round with 2. A note reads "Parker went out but wasn't lowest: 21 → 42", and the standings show Nova 2, Kai 28, Parker 42

Chapter 1 (2022): the game engine, and a shuffle algorithm that felt human

In 2022 I was mostly building frontend and backend web services, and I wanted a side project that broke from the norm. A card game in Rust felt like the perfect fit: lots of rules, lots of state, and a type system that could make illegal moves hard to even express.

The first version had three parts:

The 2022 version: a 3×4 grid of hexagon-patterned cards in Rust and Dioxus, colored by value from purple −2 to red 12, with two face-down cards marked S

Shuffling like a person

The part of this initial game engine I’m fondest of is the shuffle. Most code shuffles a deck with one line that calls a library. I wanted mine to feel like a real person shuffling a real deck, because a real shuffle isn’t perfect, and I liked the idea that the game would have that same texture.

So I wrote down what my hands actually do:

  1. Cut the deck roughly in half. Not exactly in half: somewhere within 10% of the middle.
  2. Riffle the halves together. Your thumbs don’t alternate perfectly; one to three cards drop from each side at a time.
  3. Do that a few times. Somewhere between four and seven.
  4. Then a few random card swaps, until it “feels” right.

Here’s the 2022 code, lightly condensed, with a few comments added for this post. The doc comment and its emoji are original:

/// Mimic human shuffle by splitting (sort of) in half and then zipping together (imperfectly), repeated
/// a loose number of times. Then do some swaps until it feels right. 😄
pub fn shuffle(&mut self) {
    let mut rng = rand::thread_rng();

    let times_to_shuffle = rng.gen_range(4..=7);
    let middle = self.size() / 2;
    let max_variance_from_middle = self.size() / 10;

    let mut left_hand = self.0.clone();

    for _ in 0..times_to_shuffle {
        // Cut near, but not exactly at, the middle.
        let variance_from_middle = rng.gen_range(0..max_variance_from_middle);
        let guess_at_middle = if rng.gen_bool(1.0 / 2.0) {
            middle.checked_add(variance_from_middle).unwrap_or(middle)
        } else {
            middle.checked_sub(variance_from_middle).unwrap_or(middle)
        };
        let mut right_hand = left_hand.split_off(guess_at_middle);

        // Let one to three cards fall from each thumb until both hands are empty.
        let mut shuffled: Vec<Card> = Vec::new();
        while !(left_hand.is_empty() && right_hand.is_empty()) {
            for _ in 0..rng.gen_range(1..4) {
                if let Some(card) = left_hand.pop() { shuffled.push(card); }
            }
            for _ in 0..rng.gen_range(1..4) {
                if let Some(card) = right_hand.pop() { shuffled.push(card); }
            }
        }
        left_hand = shuffled;
    }

    // A few random swaps to finish.
    for _ in 0..rng.gen_range(4..12) {
        let first = rng.gen_range(0..self.size());
        let second = rng.gen_range(0..self.size());
        left_hand.swap(first, second);
    }

    self.0 = left_hand;
}

To see what that does, I ran it on a deck sorted from lowest to highest. Each strip below is all 150 cards, left to right, colored by value:

Six strips of 150 colored bars. A sorted deck shows solid blocks of color; after riffle 1 there are still long runs of the same color; by riffle 5 and the final swaps the colors are well mixed. A last strip shows a Fisher–Yates shuffle for comparison

After one riffle you can still see big runs of the same color, exactly like a real deck after one pass. A few more and it looks thoroughly mixed. (Mathematicians have studied this for real cards: about seven riffles is the magic number for a 52-card deck.)

I loved this code. It’s the kind of thing you can explain to anyone with a deck of cards in their hands.

Then life happened

In spring of 2023 I came back for a burst of work on the rules: turns, scoring, figuring out who goes first, clearing columns. The engine told the outside world what happened through “subscribers”, little callbacks that fired on every event, which the server would forward to the other players.

I knew the engine was still missing some big pieces before anyone could actually play a game on it. My last test from that era was a full scripted game between two players, and it was commented out, with a note halfway through: // TODO: figure out who goes first. Finishing those pieces was the next job, but instead the project got put to the side, and it stayed there for three and a half years.

Chapter 2 (2026): a table for friends and bots

When I came back to Strato, I came back with a fresh perspective, and I knew which feature I wanted most: a full game table, whoever’s around. Friends on their own phones, one phone passed around the couch, or bots to mix it up.

That one goal shaped the rebuild. Bots and people had to be interchangeable seats, the rules had to run the same way on every phone, and I didn’t want a game server in the middle.

Rust for the rules, Svelte for the table

The 2022 plan had the whole app in Rust. This time I split it along a different line: the rules are Rust, everything you see and touch is SvelteKit.

Three boxes: the Rust rules engine (no I/O, whole game is one value, apply works on a copy), the WebAssembly bridge (JSON in and out: new, apply, view, legal_actions, bot_action, save, load), and the SvelteKit game table (turns taps into actions and events into animation, never re-implements a rule, installable PWA). Below: no server, saves for free, same game everywhere

The engine is a pure state machine. It has no idea it’s in a browser. It doesn’t read the clock, touch the network, or draw anything. You give it a move; it gives you back what happened.

// Validate on a copy, and only commit if the move was legal.
pub fn apply(&mut self, player: PlayerId, action: Action) -> Result<Vec<Event>, RuleError>

A few design choices that paid off over and over:

WebAssembly is the bridge. wasm-pack compiles the engine into a 460 KB WebAssembly file (about 120 KB compressed). The wrapper is intentionally boring: every call takes JSON and returns JSON. On the TypeScript side there’s a thin typed layer, and one firm rule for the codebase: the web app never re-implements a game rule. If the UI wants to know something, it asks the engine.

The app is a static site. SvelteKit builds it to plain files that GitHub Pages serves. It’s also an installable app (a PWA): a service worker caches everything, including the engine, so once you’ve opened Strato it works offline (so you can play it on your next flight!). On phones that support haptics, like Android, you’ll feel a little buzz when you flip, clear a column, or win.

The other rule I held myself to: no scrolling, on any screen. A card table should fit the device you’re holding, from a small 360×640 phone through foldables to a laptop. On phones the other players shrink to avatars you can tap to peek at; on wider screens everyone’s grid is laid out across the top.

The same game on a laptop: every player's grid across the top, the piles in the middle, and your own grid at the bottom

Bot players

Strato has three bot difficulties to choose from: Novice, Intermediate, and Master. The bots were the first thing I built on top of the new engine. To the engine, a bot is just another seat. It gets the same view() a person gets, chooses from the same legal_actions(), and its move goes through the same apply(). So a bot can sit anywhere: fill out a table when you’re playing alone, play alongside friends sharing one phone, or take over an online seat when someone drops out.

The levels differ in how carefully they play. Novice makes plenty of mistakes on purpose, Intermediate makes a few, and Master makes none: it plays the best move it can find, every time. I’ll get into how they actually decide on a move, and how I made them tougher, later on.

Chapter 3: the feature that required sacrificing my favorite code 😓

With people and bots sharing a table, the next feature I wanted was a daily deal like Wordle, but for cards. Everyone in the world gets the exact same cards each day, plays one round against the same two bots, and compares scores.

There’s no server in this picture: Strato is a static website. So every phone or computer has to get the same shuffled cards and starting grid on its own, with no external communication.

My lovely human shuffle couldn’t do that.

The problem is the first line of that 2022 code: rand::thread_rng(). That asks the device for fresh randomness every time. My phone and your phone would shuffle differently, every single time. That’s what you want from a shuffle, until you want two phones to agree.

Seeds, explained without the math

The fix is a seeded random number generator. A seed is a number you start from, and from that number a generator produces a long sequence that looks random but is completely determined by the seed. If you provide the same seed, then you get the same sequence, every time, on every device.

Think of it like a recipe. “Shuffle randomly” is a cook improvising. “Shuffle with seed 1682863344” is a recipe card: anyone who follows it ends up with exactly the same dish.

So the daily deal works like this:

  1. Take today’s date, like 2026-12-04.
  2. Turn it into a number with a hash function (FNV-1a, a tiny one that’s easy to write in a few lines).
  3. Use that number to seed the shuffle.
export function dailySeed(date: string): number {
	let h = 0x811c9dc5;
	for (const ch of `strato-daily-${date}`) {
		h ^= ch.charCodeAt(0);
		h = Math.imul(h, 0x01000193);
	}
	return h >>> 0;
}

Two lanes. 2022: nothing to share, a human-style riffle, and three phones each dealt different cards. 2026: today's date is hashed into the number 1682863344, a seeded ChaCha8 and Fisher–Yates shuffle, and three phones all dealt the identical grid

Why I didn’t just seed the human shuffle

I could have kept the riffle and fed it a seeded generator. But the shuffle was now load-bearing in a way it never was before:

So the engine now uses the textbook approach: a Fisher–Yates shuffle over all 150 cards, driven by a seeded ChaCha8 generator. Fisher–Yates gives every possible order of the deck exactly the same chance. To check the deal, there’s a test that deals 20,000 four-player games and checks that every seat averages the expected grid total (60.8) and the expected number of cards at zero or below (2.4).

The best part: the human shuffle didn’t really die. It became an animation. When a round starts, you see the deck cut in two and riffle back together before the cards fly out. The math is Fisher–Yates; the feeling is still my 2022 shuffle.

Six frames from the start of a round: the deck, cut in two, thumbs let go, cards interleave, square up, deal

One decision, many features

Making the whole game reproducible turned out to be the most important decision in the project. The engine’s entire state, including the random generator itself, is one value that can be saved and loaded. A seed plus a list of moves rebuilds a game exactly.

That one property ended up powering:

FeatureWhy determinism makes it easy
Daily dealSame date → same seed → same cards for everyone
SavingThe game saves itself after every move; close the tab and come back
Online playPhones only send moves, not the game, and stay in sync
ReplaysRe-run the moves to rebuild any moment of any game
Bot testingThousands of seeded matches that replay identically when a test fails

Chapter 4: online play with no game server

I didn’t want to run a server. Servers cost money, need accounts, and eventually get turned off. I wanted Strato to keep working long after I stop paying attention to it. So online play is peer-to-peer: the phones talk directly to each other.

Phones in an online game. Public Nostr relays only help the phones find each other. The host phone runs the real game; two guest phones each keep a copy. Guests send moves to the host; the host sends a tiny numbered update with a checksum to everyone

Finding each other

Two phones on the internet can’t just find each other. They need an introduction. Strato uses Trystero, which borrows public Nostr relays as a meeting point. Your phone posts a sealed note that says, roughly, “I’m in room KMTZ”. Another phone looking for KMTZ finds it, and the two set up a direct, encrypted WebRTC connection. After that, the relays are out of the picture.

From the player’s side, it’s a four-letter code (no look-alike letters like O and 0), a QR code, or an invite link.

The same online room on two phones. The host sees the room code JBAP, a QR code, Invite and copy-link buttons, and the seats: Parker (host), Jess (joined online), and Nova (a Master bot). Jess's phone shows Parker's room and waits for Parker to start

Who’s in charge

One phone is the host. It runs the real game. Guests send their moves to the host, the host checks them with the engine, and then tells everyone what happened.

Here’s the bit I like most. Because the engine is deterministic, the host doesn’t need to send the whole game after every move. Every guest keeps its own copy of the engine and replays each move itself. The host only sends a tiny message, about 100 bytes: a running number, the move, and a checksum of what the game should look like afterwards.

(A quick sidenote: a checksum is a short number worked out from a bigger piece of data, a bit like a fingerprint. Change even one card and the number comes out different, so two phones can compare checksums instead of comparing the whole game.)

If a guest notices a gap in the numbers, or its checksum doesn’t match, it simply asks for the whole game again. Messages stay tiny no matter how long the game runs, and every phone always has a complete copy.

When people leave

Sometimes people’s phones lock, apps get closed, or your Wi-Fi signal is lost. An online game such as this has to survive that.

Using cryptography to prove who’s who

No accounts means no passwords, so how does the host know a move really came from Jess?

Each device makes its own key pair the first time it opens Strato. The private key never leaves the phone. When a guest joins, the host sends it a one-time challenge; the guest signs it, and that signature proves which seat it owns. The host decides whose move it is from that proof, never from what the message claims.

You’ve probably used this exact idea without realizing it. Passkeys, the “sign in with Face ID or your fingerprint” option a lot of apps and websites now offer, work the same way: your phone makes a key pair for that site, keeps the private key to itself, and proves it’s you by signing a challenge. No password ever gets sent. Strato does the same thing, just without a sign-in screen.

Some trade-offs

Chapter 5: the features that came after initial launch

Once Strato was in friends’ hands, the to-do list stopped coming from me.

”The bots are too easy”

Players told me the bots weren’t hard enough: the Master bot just wasn’t a master.

To explain how I made them harder, I need to confess how they work: the bots aren’t actually smart. There’s no machine learning and no searching ahead through future turns. Every bot follows the same handful of rules of thumb. For each card it could swap or flip, it adds up what its grid is expected to be worth afterward, counting every face-down card as an average card from the deck, and picks the move that lowers that number the most. Only Master tracks which cards have already been played (more on that below), and only Intermediate and Master chase matching columns.

What separates the levels is mostly a dice roll. Before every decision, the bot rolls to see whether it’ll ignore its strategy and pick a random legal move instead:

// Simplified from strato/src/bot.rs
let options = legal_moves(view, me);
if rng.gen_bool(difficulty.blunder_rate()) { // 0.25, 0.07, or 0.0
    return options.choose(rng); // any legal move, good or bad
}
Brain::new(view, me, difficulty).choose(&options)

A random move might be a sensible one, or it might be swapping out a lovely −2 for the 12 it just drew. Novice blunders on a quarter of its decisions, Intermediate on 7%, and Master never does. A turn is usually two decisions (draw or take, then where to put the card), so close to half of Novice’s turns have a blunder in them. That’s what makes it feel like a beginner rather than a machine: mostly reasonable play, with the occasional move that leaves you wondering what it was thinking.

Before changing anything, I wanted a way to measure “harder”. So I froze a copy of the original bots and used it as a yardstick: put a bot at a three-seat table against two copies of the old Master, play 3,000 matches, and count points per round. Lower is better.

Then I made the bots smarter:

Points per round against two of the original Masters, lower is better. Novice went from 37.0 to 33.6, Intermediate from 28.9 to 24.2, Master from 20.1 to 15.8. Match wins rose from 0.6% to 1.4%, 7.1% to 13.2%, and 33.9% to 55.5%

The new Master scores 22% fewer points per round and wins 56% of matches at a table where a fair share is 33%. That yardstick lives in the test suite now, so if a future change ever makes a bot weaker, the build fails.

Table talk (AKA chat)

After one online game with family members where we weren’t also on a phone call, it was obvious what was missing. The best part of playing cards in person is the groaning when someone flips a 12, and the game was silent.

So I added table talk: a chat plus emoji reactions (😂 😭 😁 😢 😱) that float up from the sender’s avatar on everyone’s screen. Chat pops up for a moment as a speech bubble pointing at whoever said it.

An online game on a laptop with the Table talk feed docked on the right: moves like "Nova drew a 7, swapped out a 10" with Jess's chat ("flip it flip it", "nooo my 12 😭") and reactions slotted in between

On a phone: a 😂 reaction rising from Parker's avatar, and the Table talk sheet with chat, reactions, and moves in one feed

These chat messages travel the same way that moves do: through the host, which knows who’s speaking from their signed seat, applies a rate limit, and cleans up the text. The feed slots each message between the moves it came after, so you can scroll back and see that someone said “nooo” right after they got doubled.

Replays

Then there were the moments worth keeping. Something wild would happen mid-game and I’d want a screenshot of it, or just to remember how it went, but there was never time to stop playing and grab one. By the end of the game, the details were gone.

So now every finished game can be watched back like a video, with a seek bar split into rounds, play and pause, step forward and back, and 1×, 2×, and 4× speed. Drag the bar and the table jumps to that moment, with a label showing the round and whose move it was:

Scrubbing a replay on a phone: dragging the seek bar forward through two rounds and back again, as the table, the scores, and the line describing each move change with it

The results screen shows how everyone’s totals moved round by round, right above the Watch replay button.

Two phones. Left: the results of a three-round match, Parker and the Master bot Mira tied on 39, with a "How it unfolded" chart of everyone's totals per round above Watch replay. Right: the replay on the real table, partway through round 2, with a seek bar split into rounds and play, step, and speed controls

The same kind of replay on a laptop, with every player's grid across the top and the controls along the bottom

Under the hood, the engine keeps a compact log of every accepted move. Each move is a few characters: 2s13 means seat 2 swapped into row 1, column 3. To jump to any moment, the replay starts from the nearest checkpoint (one every 32 moves) and re-runs the moves from there, so seeking stays instant. The last ten games are kept on your device.

My favorite detail: the replay is drawn by the same table component as the live game, from your own seat, so it looks exactly like you remember. And table talk replays too: the chat bubbles and reactions pop up at the moment they happened.

Making it feel whole

It would be easy to read this post as a feature list. That’s not how it felt to build. Most of the work was in the small stuff that makes a game feel like one cohesive experience rather than a pile of features:

A daily deal result: Nova, the Master bot, wins with 12, Parker is second with 26, and Kai third with 38, with Watch replay, Share, and Play again

None of these show up in a list of features. All of them together are hopefully a reason to keep playing.

What I’d tell 2022 me

Play it

Strato is free at strato.parker-codes.dev. Try today’s daily deal and see if you can beat the Master bot. Or grab a few friends, tap Create game, and share the code.

The code is public on GitHub at parker-codes/strato, if you’d like to see how any of it works.

If you love it or have ideas, tag me in a tweet at @parker_codes.

✦

© 2026 Parker McMullin

𝕏 GitHub