Under the hood
Curious how a euchre game works on the inside? Here's how this one is put together: where your game lives, how the rules are enforced, and how the toughest bots decide what to play.
It all runs on your device
There's no game server. When you open the site, your browser downloads the pages once, and from then on the deck, the rules, the three computer players and your saved game all live in your browser. Nothing about your game is sent anywhere, which is why there's no account to make and why the game picks up where you left off on the same device.
One rule book for everyone
Every move in the game, yours or a bot's, goes through the same small piece of code. It's given the state of the table and a move, checks that the move is allowed, and returns the new state of the table. It never edits the old one. The buttons and cards you can tap are exactly the moves it says are legal, and the bots choose from the same list, so nobody can cheat, revoke or play out of turn.
Because of that, a whole hand can be written down as just the shuffled deck plus the list of moves. Replaying
that list through the rule book rebuilds the hand card for card. That's how shared spot links (the Share button
under the table) work: the link packs the deal and the moves into about forty characters
after a #. Browsers never send the part after a # to the website, so a shared hand
goes only to whoever you send the link to.
The left bower problem
The trickiest rule to get right in code is the left bower. With hearts as trump, the jack of diamonds stops being a diamond: it becomes the second-highest heart. So the game never asks what suit is printed on a card. It asks what suit the card counts as right now, both when checking whether you followed suit and when working out who won the trick. Get that wrong and a player holding only the jack of diamonds could be forced to "follow" a diamond lead with their trump.
How the Extreme bots think
The Easy, Medium and Hard bots follow written rules of thumb, described in How the bots play. Extreme works differently. It still can't see your cards, so every time it has to decide, it imagines them:
- Deal the hidden cards. It hands out the cards it can't see to the other players, dozens of different ways.
- Keep only believable deals. No deal can give a player a suit they've already shown they're out of, and the dealer keeps the card they picked up. Deals that match the bidding count for more: someone who passed probably wasn't strong in that suit, and someone who called trump probably was.
- Solve each deal. With every card face up, there are few enough ways for five tricks to go that it can check every one, and find the best result both teams can force.
- Pick what works most often. It plays the card, or makes the bid, that does best across all those imagined deals. It judges each result by its chance of winning the game from the new score, not just by points, so the same cards can be played differently at 9 to 9 than at 0 to 0.
Card players call this kind of approach sampling, and it's how strong computer players work in bridge and other trick-taking games. It takes thousands of times more work than a rule of thumb, so Extreme does its thinking in the background while the table waits its usual moment, which keeps the game smooth even on a phone.
How we know the bots got better
Every change to the bots is tested the same way: the new version plays the old one for thousands of games, with both sides getting the same deals so luck evens out. A change stays only if it clearly wins more than half.
That has thrown out plenty of good-sounding advice. A defensive leading order recommended in euchre strategy guides, and avoiding leads into a suit an opponent has run out of, both made our bots lose slightly more often, so neither made it in. Leading trump back to a partner who called it, and holding back from trumping a weak lead when your partner plays last, both helped and stayed.
| Opponents | A team playing like Hard wins |
|---|---|
| Easy | 84% |
| Medium | 66% |
| Hard | 51% |
| Extreme | about 36% |
From thousands of simulated games between the bots. Pick your level under Rules.
Play against the bots