Monte-Carlo strategy simulator for the card game Flip 7.
Note: this simple model re-shuffles the deck before each hand. The deck only includes number cards. Special cards such as "Draw 3" or "Freeze" are not included.
Draw until bust (i.e. there are 2 identical cards in hand). The maximum number of cards you could have is 13 (0-12). If the simulation reaches 14 cards, a bust is guaranteed.
Sample output:
$ time go run .
Starting...
Scores (number of games that ended with n cards drawn):
1 cards: 0 games
2 cards: 92412 games
3 cards: 166960 games
4 cards: 204367 games
5 cards: 195870 games
6 cards: 153610 games
7 cards: 100011 games
8 cards: 53669 games
9 cards: 22961 games
10 cards: 7777 games
11 cards: 1981 games
12 cards: 342 games
13 cards: 38 games
14 cards: 2 games
15 cards: 0 games
real 0m1.845s
user 0m2.001s
sys 0m0.157s
From the v1 simulation, the highest probability of busting occurs on the 4th card drawn. Therefore, a simple strategy is attempt to draw 3 cards, then stay.
- Explore the probability of busting given a 12 is showing.
- Determine the optimal number of cards to draw. Is drawing 3 cards the best strategy for accumulating points?
- Train a machine learning model to hit or stay depending on the cards visible.