FAQ Frequently Asked Questions

The core problem. In this game, almost everything is visible at any given moment — the only hidden information is the order of the still-undrawn stock cards. A truly “perfect” AI would have to reason under this uncertainty, which is algorithmically much harder than a game played with all cards face up. Perfect Information Monte Carlo (PIMC) sidesteps the problem with a trick: instead of modeling the uncertainty directly, the AI briefly pretends it knows exactly how the stock is ordered — and repeats this with many different, randomly guessed orderings. In the end, it averages over all these “imagined” playthroughs.

Step 1 — Determinize. For every move it is currently considering, the AI takes a copy of the game state and reshuffles only the hidden part of the stock at random. This is called “determinizing”: a concrete, fully visible guess about what is actually hidden. Importantly, this is pure fiction used only for evaluation — the real, actually-dealt order of the stock is never touched and stays exactly as it was for the real game.

Step 2 — Roll out to the end. In this imagined world, the AI plays the game out to the end (or up to 300 moves) — not with an expensive search, but with a very cheap, fast policy: simply a random, legal move at each step. This produces a concrete score at the end (0 = perfectly solved, higher is worse).

Step 3 — Average and choose. This whole process runs 160 times for every move under consideration, each time with a freshly reshuffled stock. The average of these 160 final scores becomes the move's evaluation. The AI compares all currently legal moves this way and picks the one with the lowest average. The entire procedure repeats after every single move, using the updated, real game state — so the AI isn't planning one big tree in advance; at every move it asks itself anew: “Which of my currently available options looks best on average, across 160 plausible futures?”

A small refinement. There is one targeted extra rule, based on a player observation: if a move completes a foundation with a Jack, Queen, or King that was sitting alone on a tableau pile (so the move doesn't uncover anything new — it “doesn't hurt, but doesn't help either”), and a twin of that card (this is a double-deck game) is still in play elsewhere, that option gets a tiny penalty. The reasoning: that second copy might still be useful later as a “cap” to cover another pile. This is a pure tie-breaking refinement, not a fundamental part of the mechanism.

Fairness towards you. The AI gets exactly one real attempt at the same deal as you — no more, no less. It doesn't “cheat” when it comes to actually making its moves; it only guesses internally to decide what to do next. As a sanity check, the recorded move list is independently replayed at the end on a fresh copy of the real deal, verifying that it produces exactly the same score — a kind of automatic self-test against bugs.

Limits of the approach. PIMC is deliberately pragmatic, not optimal. Because the rollout uses a very simple random policy instead of a real search, the 160 samples are only a rough estimate — especially early in the game, when enormous numbers of continuations are still possible, this can under- or overestimate how good an option really is. PIMC also has a known theoretical weakness (called “strategy fusion” in the literature): it evaluates each guessed world on its own and then averages, but it can't truly hedge across several possible worlds at once or deliberately gather information — a perfectly rational agent under uncertainty could sometimes still play a bit smarter. Still, this is far from a naive approach: the very same underlying principle is used in strong computer bridge and skat programs, where hidden information is likewise the core problem.

In short: the AI isn't a tree-search algorithm — it's “try out 160 plausible futures and pick the move that leaves the fewest cards behind on average,” recomputed freshly after every single move, with a small experience-based tie-breaker on top.

I changed my mind: you can now switch off the automove option. Personally, I don't like to search a long time for movable cards - something that the computer can better. I like to concentrate on making the correct moves.
I'm working on a R script to get a deeper insight in the results (after I send the results by the exporting function to my computer). In the future I'd like to offer an online tool.
Don't hesitate and send me a mail!
The photo is by Walter Mittelholzer from 1923. It shows the Adula (aka Rheinwaldhorn) on the border of the Cantons Grisons and Ticino in Switzerland. Thanks to the Archive of the ETH-Bibliothek where you find around 2 million images.