A search agent for Flip 7
2026

An agent for the two-player card game Flip 7, where each turn you either draw another card or bank your points. It combines an expectiminimax search over the current round with a table of game-winning probabilities learned by approximate policy iteration.
The game
The deck has 79 number cards (one 0, and k copies of each value k from 1 to 12) and 3 “Second Chance” cards. On each turn, a player hits (draws a card) or stays (banks the sum of their cards for the round). Drawing a number already in your hand busts you for the round, unless you hold a Second Chance. Seven distinct numbers give a 15-point bonus and end the round, and the first player to 200 points wins.
The difficulty is that a good decision depends on two horizons at once: the risk of busting given the cards left in the deck, and how much risk is worth taking given both players’ scores.
Method
Round level: expectiminimax search. At each decision, the agent searches two plies ahead. Draws are chance nodes weighted by the exact composition of the remaining deck, and the two players are max and min nodes.
Game level: a value table.
W[t0, t1, s] estimates the probability that player 0 wins the game, from the cumulative scores at the start of a round and the player who starts it.
It evaluates the leaves of the search.
W is the fixed point of a Bellman equation over rounds, computed by value iteration from the distribution of round score increments.
That distribution is estimated by Monte Carlo, with scores grouped into three regions to keep it tractable.
Policy iteration.
Training starts from a 37-point threshold policy, computes W, replaces the policy by the search agent using that W, and repeats three times.
It takes about 8 minutes on a laptop CPU.
Results
The table is frozen after training and evaluated against three opponents, over 2,000 games each, with seeds different from training. The agent’s seat and the starting player are balanced.
| Opponent | Win rate | 95% interval | Draws |
|---|---|---|---|
| Stop at 37 points | 77.3% | 75.4% to 79.1% | 6 |
| Greedy: draw while one more card raises the expected score | 55.8% | 53.6% to 58.0% | 7 |
| Same search without the value table | 56.7% | 54.5% to 58.8% | 7 |
The last line isolates the value table: with the same search depth, adding it wins 56.7% of games head to head. A decision takes about 1.1 ms.
Limitations
The search is depth-limited and the score regions are coarse, so there is no optimality guarantee. The intervals cover the test games of one trained table, not the variability between training runs. The other special cards of the commercial game are not modelled.