Since there is only one deck, since you build down in the same suit, and since you can move sequences, this plays rather like Trigon and Storehouse in that the only time the player really needs to make a choice is when there is an empty tableau column to fill. However, in Ali Baba the choices at that point are a bit more complex, making for a more interesting game.
There is some variation in the rules of Ali Baba as described on different web sites.
One Pass | Unlimited Passes | |
---|---|---|
No Aces |
Won 39.7% (396,809)
22.6 cards off (43.5%) |
Won 43.2% (432,614)
26.4 cards off (50.8%) |
Aces Dealt |
Won 45.0% (450,159)
25.3 cards off (44.4%) |
Won 45.3% (453,392)
27.3 cards off (48.5%) |
Note that the count of cards off includes the four aces that are dealt to the foundation in the variations in the bottom row. The percentages shown adjust for this, being n/52 for the top row and (n-4)/48 for the bottom row.
Note that predealing the aces to the foundation has the side effect of reducing the size of the stock from 12 cards to 8 cards. Making a small stock even smaller reduces it's usefulness, so it's no surprise that being able to do an unlimited number of passes through it only slightly increases our win rate.
The histogram below shows the full distribution of the numbers of cards which could be removed for all four games. Note that our counts of removed cards include the four cards that were dealt to the foundation in the "Aces Dealt" cases. I omitted the "52 card" column from the graph, because it is too tall. No unwinnable game ever left less than 24 cards on the tableau, so I omitted those columns from our graph too.
One thing that is obvious to anyone who has played the game a few times is that you often get stuck rather early, but if you don't, if you get far enough to open an empty tableau column, then you can usually find a way to win. Though it is theoretically possible to be stuck with as few as eleven cards still on the tableau, this is extremely unlikely.
For each number of shuffles from one to ten I ran the solver on one million games. The first game in each run used a randomized deck, and after that the procedure above was followed to produce the deck for the next game.
I ran the test two ways. In the first set of tests, I always dealt the cards column by column. In the second set of tests, I always dealt them one row by row.
I did this only for the one pass/no aces variation, because that variation is the best.
The resulting win rates are shown in the graph below:
When dealing by columns, it appears that inadequate shuffling doesn't make a huge difference in this game. Even if you shuffle only once between, your win rate differs only by five percent. But unusually, it always makes your games harder, never easier. This rather makes sense, as your tableau piles tend to end up with lower cards buried under higher cards.
If you deal one row at a time, then things are very different. If you don't shuffle much, you'll win lots and lots of hands, probably because lots of adjacent cards of the same suit start out on the tops of the piles.
So, deal by columns if you want a fair game, deal by rows if you want to win. Or shuffle five or more times between games and make it moot.
It is interesting to compare this to the graph for Storehouse. In both games, residual order in the deck can make the game harder, but for Storehouse the game was easier if we had done just a few shuffles. I think the larger and more flexible stock/waste in Storehouse allows sequences to be reversed more easily, so even backwards sequences are still helpful. Also in Storehouse there are only 12 cards that are initially inaccessible, being buried in the reserve, while in Ali Baba there are 30 inaccessible cards in the initial tableau. This may make backwards sequences more harmful (remember, sequences are reversed during the deal).