Continuing my experimentation with Microsoft Spider Solitaire, I decided to try five hands on Expert difficulty level.

Recall that Expert is the easiest possible setting when you play with 4 suits. We therefore expect Expert hands will be easier than random hands.

Indeed when I tried playing Five hands at Expert level I crushed it. I won the first four hands and probably should have won the fifth, but for a lapse in concentration.

Getting trips (or even quads) when dealing a row of 10 cards occurred very rarely, and I had a healthy number of turnovers in round 0. Once I removed two complete suits the game was pretty much in the bag.

However, I should emphasize that removing two suits most definitely does not guarantee victory for Grandmaster level. And don’t get me started on Rogue Solitaire.

Recall that in a previous post, I ran the Gauranteed Minimum Evaluation Score on hands of various difficulty. Ninja Monkey said that he could win 4 Experts hands out of 50, but zilch on Master and Nada on Grandmaster.

I haven’t experimented with what various difficulty levels look like with fewer than 4 suits. Perhaps that’s some material for a future post 😊

Personally I like the idea of giving players the option of choosing a difficulty level as well as number of suits, and Spider Solitaire lends itself to this type of choose-your-difficulty. In contrast, the same cannot be said of games like Klondike or Freecell (one-suit is perhaps too easy even for a newbie)

The classic Microsoft Spider Solitaire software gives a Four-suit expert player a choose between Expert, Master, Grandmaster or Random hand.

With the pandemic not going away any time soon, I thought now is a good time to play three more hands of Spider Solitaire on my PC, choosing difficulty levels of Expert, Master and Grandmaster (while also honing my writing skills!). I easily won an Expert hand, but bombed the Master hand. I briefly entertained some miracle hopes on the Grandmaster hand, but quickly came crashing down to earth if you excuse the terrible cliché.

Ninja Monkey’s Guaranteed Minimum Evaluation Score algorithm yields a win rate of 4/50 on the Expert but 0/50 on the Master and Grandmaster hands.

Here is the Grandmaster board:

Round 0 looks promising with 4 turnovers (the average should be a tad under 4). Moreover, two of these turnovers are suited – but problems appear later.

After a promising initial deal it’s trips galore in almost every round. This reeks of a cold deck – if you’ve ever played late-night poker with some dodgy folk in the neighbourhood then you’ll know what I’m talking about. Then again, I did ask for Grandmaster difficulty.

In contrast three of a kind never occurred in any round of the Expert hand.

It is not clear if arranging three of a kind on nearly every round is an effective way to make the game harder (maybe the permutation of face-down cards in the tableau is also relevant) but it does suggest Microsoft is trying. In defence of Microsoft, they explicitly made it clear that the player will face a difficult challenge to win without boop. In fact I have no problem with the game being “rigged” if the player knows in advance the cards are not properly shuffled(in math terms we say a properly shuffled deck has 104! possible permutations of starting hands, ignoring equivalence of identical cards, and each permutation is equally likely). A player who chooses Grandmaster difficulty can’t say he wasn’t warned!

I will not discuss the strategy in detail. Rather I wanna discuss how easy it is for Microsoft to construct “easy” or “difficult” hands.

There are several ways one might go about constructing a difficult hand:

“Crowdsourcing”: give each hand a unique identifier (like a hash). If only e.g. 10% of players can win even with the help of boop, then chances are the game is difficult. If a good percentage of Microsoft employees like to slack off in their spare time this shouldn’t be too hard 😊

Design an evaluation function e.g. number of guaranteed turnovers for Round 0, or number of guaranteed turnovers if we pretend we start with the 10 cards in Round 3 instead of Round 0. The main difficulty is finding a good evaluation function.

Design an AI to play the game with or without boop. The main difficulty is designing a good AI is not trivial.

It is not clear which method Microsoft uses (my best guess is crowdsourding), but I agree they succeeded in arranging matters so that Grandmaster is harder than Expert (Master is perhaps equally hard as Grandmaster but I only have a sample size of three games, so I won’t jump to conclusions any time soon!)

Continuing from last week, our task was to evaluate the probability of winning the following starting layout.

I find the best indicator of probability of winning is “playing the hand out”, either manually or getting one of my animal friends to do it, such as Ninja Monkey.

For instance, I might attempt to win the game without boop but during the course of play I have a chronic shortage of Nines and lose badly. I would then examine the starting layout and say to myself “okay, now I understand why I got a shortage of Nines.” The point I am making is that it’s much easier to identify potential problems after playing the hand out. Conversely, I might be able to clear two suits before dealing the second row of cards and guess the game is extremely easy.

In our example above, we can check there are three guaranteed turnovers at the start. The middle row from the stock has four kings, but I still managed to win without boop. However, during the mid-game I estimated a loss was almost certain. For this reason, I would estimate the game to be “maximum difficulty” or close to it. Unfortunately, this assessment is hard to convert into a number.

Fortunately, Ninja Monkey can help me out here. He can simply simulate his improved strategy. Essentially his strategy involves optimising the guaranteed minimum evaluation score given the information provided by face-up cards – and it is good enough to win random deals some of the time (i.e. not ridiculously close to zero). Ninja Monkey’s assessment may not be accurate (his strategy still has serious flaws) but at least we get a “quantitative” estimate (probability of winning) rather than some qualitative 83,72,73,84.

It turns out Ninja Monkey could win 2 trials out of 50. To be honest, I was expecting zero wins from 50 attempts (of course the win rate should be non-zero given enough attempts since I did manage to win).

We now consider the following question: Given a Spider Solitaire hand, how can we determine the probability of a human expert winning without 85,78,68,79?

Clearly, we have to determine the identity of every face-down card (barring pathological cases where the hand is so bad you can mathematically prove certain defeat without knowing all the cards). The good news is this should almost always be possible given enough patience (and skill).

The bad news is estimating the difficulty of a hand is far from trivial.

I know that the first 10 cards dealt is a poor indicator of winning chances. Yes, most players will get a warm fuzzy feeling if the opening hand gives six guaranteed minimum turnovers and three in-suit builds – but Spider Solitaire is a marathon not a sprint (terrible cliché I know) and there is plenty of opportunity for a good start to sour, or conversely, to recover from a poor start. Other features like “four Queens in the third deal” or (heaven forbid) “all odd cards in the fourth deal” are likewise unreliable indicators – we usually have to consider the whole board. The only exception is if there are no two adjacent cards on the final row of 10 cards (e.g. A44A7499KJ) – in which case the game is automatically lost unless you get a lucky in-suit build (e.g. the Jack falls onto a Queen of the same suit).

Here is the starting hand of the game I played many months ago and finished last week (a minus sign indicates a face-down card and rows from the stock are dealt starting from the left). Can you think of any “features” that would indicate whether the game should be easier or harder than normal? Let me know in the comments below!

Continuing from the previous post, the recommended action is

Clear the Spade suit

Exchange the 6-5-4-3-2-A of Hearts in Column 5 with the 6-5-4-3 of Clubs in Column 6.

Dump the 9-8 of Clubs in Column 3 into the empty column

Clear the Heart suit, winning back the empty column

Shift the Qh-Jd onto the Kh in Column 1, turning over a face-down card in Column 6 (and keeping an empty column)

Note that I went to the extra effort to clear a card in Column 6 rather than Column 5. This is because clearing cards in Column 6 is harder than Column 5 (especially since the Q-J are offsuit). As a general principle it is often wise to save an easy task for later and get the “difficult task” over and done with whenever possible – this helps avoid the embarrassing situation of “One Hole No Card” as alluded to in a previous post.

The resulting position is shown below, with the newly-exposed card redacted.

This is a lock

The astute reader may have noticed I violated the principle of procrastination by removing the Spade suit unnecessarily. This is because the game is in fact mathematically won.

To see this, let us consider all possible face-down cards (which we identified from last week):

Queen of Clubs: this can go “underneath” the Jack of Clubs (Jack onto Queen, winning an empty column, Q-J to Column 8, losing an empty column)

Queen of Diamonds: this goes onto the King of Clubs

Ten of Clubs: this goes onto the Jack of Clubs

Ten of Diamonds: this goes onto the Jack of diamonds

Ten of Hearts: this goes onto the Jack of Hearts

Nine of Diamonds: this goes underneath the 8-7 of Diamonds

Seven of Clubs: this goes onto the Eight of Clubs

Six of Hearts: we will count this as a “bad card” since the 7 of Diamonds is offsuit (and will counterfeit the Nine of Diamonds). This goes into the empty column

Five of Hearts: This is a bad card and goes into the empty column.

Note that the first seven cards are good, and we don’t even require an empty column to achieve the corresponding action. The only possible snag is there are two bad cards and only one empty column. But wait! If we draw both the Five and Six of Hearts then we can immediately place the Five on top of the Six. The net effect is to condense two bad cards into one – hence there is no snag after all.

Finally we also check that there is no issue with one-hole-no-card. Assuming we turnover all cards in Column Six first we will eventually get an empty column in Column Six and then we can choose randomly between shifting the Jh in Column 2 or the 9-8-7 of Hearts in Column 5 into the new empty column. Essentially we are “pretending” that all nine face-down cards are in Column 6.

It turns out the redacted card is the Seven of Clubs. The rest of the face-down cards in Column 6 are: Ten of Diamonds, Queen of Clubs, Queen of Diamonds.

The starting layout is shown below

Summary

This was a difficult game. The first ten cards were average, a minimum of three guaranteed turnovers, but two in-suit builds and no Aces or Kings. I only turned Four cards in round 0, but had an excellent Round 1 with several turnovers thanks to an empty column, but then got a catastrophic middle game with four Kings appearing on the same deal. Just when a loss seemed certain, I managed to find chances by clearing a complete set of Spades. I procrastinated by waiting until both Spade Kings were exposed so then I could decide which was the better King to remove. On the last round, I had three guaranteed turn-overs and realised all hope was not lost. I survived kadoban in the endgame and managed to win. I worked out victory was mathematically certain with only nine face-down cards remaining.

I hope you enjoyed playing through this game as much as I did.

I cleared the Spade suit in order to tidy the suits up (e.g. K-Q of hearts and K-Q of Spades).

I then turned over the last card in Column 1, and it is the Ten of spades.

Good Luck at Last

At last we get a good card. We can start turning over cards in columns 4 5, or 6. We also have a most unusual situation: all cards of the second Spade suit are visible, but we are still waiting on the first set of Clubs and Diamonds. So a useful question to ask is “can we clear Hearts or Spades by force?” and if so, is that even desirable?

Assuming we claim the empty column in Column 1 (the move is reversible) we see columns 4 and 6 require us to burn only 1 empty column, but Column 5 requires both empty columns. Our choice is therefore between Column 4 or Column 6. The 6 of Hearts in column 4 seems useful since it will help with Column 5. The two aces in Column 6 are not so great (but would be useful in Texas Holdem). Column 4 it is.

Our luck is in. We are able to clear all face-down cards in Column 4. The face-down cards are (in order): 10 of diamonds, 7 of Clubs, 9 of Diamonds, Jack of Hearts. Not surprisingly we are able to remove two more complete suits.

Now is a good time to take stock. We have the following position:

We can continue with 9-8 of Clubs into the empty column, then remove the Heart suit, turning over a new card in Column 5 and winning back the empty column. This means we are guaranteed to turn over at least two cards (phew, no Kadoban). Careful consideration reveals another possibility. We can use the Nine of Hearts in Column 6 instead of Column 5, then shift the Qh-Jd onto the Kh in Column 1. Oh yes, the second spade suit is also up for grabs.

Do we have a lock?

At this stage, we should be calculating if the game is mathematically won regardless of the distribution of the face down cards. A good start would be to identify the face down cards:

Clubs: 7,0,Q

Diamonds: 9,0,Q

Hearts: 5,6,0

Spades: None

Question: do you think the game is mathematically won with best play?

At a glance we can tell that it is impossible to complete a suit of Diamonds or Clubs because there is no exposed Seven of Clubs, Nine of Diamonds or Ten of Diamonds. We can remove one Spade suit, but both Spade suits is clearly impossible. Hearts are impossible with both the only exposed Jack and Six underneath a King, and we only have one empty column. Clearly we need to turn over new cards and hope for the best.

The Danger of One-Hole-No-Card

Although most of the cards are good we have a new problem. There are only three “easy turnovers” in Columns 1 and 8 – and that is assuming we do get good cards. Once these easy turnovers run out, we may well be in serious trouble.

This phenomenon is not unusual. At the beginning of a game, our primary focus is getting an empty column so we usually have to put up with “junk piles” like columns 4,5,6. But during the endgame, we wish we didn’t have many face-down cards buried underneath these junk piles. So there is a trade-off between hunting for empty columns and avoiding awkward junk piles in the endgame. It is beyond the scope of this blog to discuss how to manage this trade-off in detail. I could spout horrible clichés like “you get better with experience” but I would rather lay down the following general principle:

If you ever find yourself unable to expose a face-down card despite having one or more empty columns, then chances are you are not taking maximum advantage from a position of strength.

In our case, we desperately need very good cards, not just average cards. Fortunately any one of five unseen Tens would fit the bill. Any Ten can play onto the Jack in Column 3, and then we can start to work on Column 6. Alternatively if we expose a Seven of Clubs, then we have legitimate hopes of removing a complete suit of Clubs.

My first action is 5 of Clubs onto 6 of Clubs in Column 2, exposing the 3 of Spades.

Next action is 3 of Spades onto the 4 of Spades, exposing the 7 of Diamonds. This may be a problem since it is harder to expose cards in Column 6 (but there wasn’t much choice).

To simplify matters, I will tidy up the suits by making reversible moves only (even though it’s not an action reversible moves are always safe if we are not aiming to win in the fewest moves).

Note that it is not possible to swap the Kh-Qs in Column 3 with the Ks-Qh in Column 10, unless we remove the Spade suit first.

Despite having one suit removed and two empty columns (assuming we remove the Spades), our position is now very bad. We did not get any of the missing Tens or a Club Seven, and exposing the last Three counterfeited the Three in Column 6. This means it is impossible to turn over any cards in Columns 4 5 or 6, even if we were willing to give up both empty columns. This means we must expose a card in Column 1 or Column 2 (but not both) and hope for the best.

Our position is in fact Kadoban – one more bad card equals game over. There are two basic choices:

Turn over a card in Column 1

Turn over a card in Column 2

Note that both cards in Column 1 and 2 are not possible, even if we clear Spades since we need three empty columns.

Taking the dangers of One-Hole-No-Card into consideration it is quite possible that the latter option is better, despite losing both empty columns. What would you play here?

As usual it is good technique to procrastinate. The basic idea is to avoid as many non-reversible moves as much as possible, unless we really we can’t help it. This means, we must shift the 9-8-7 in column 9 to obtain the empty column and we must shift the Q-J in column 3 to expose the only visible 10 of spades etc. The resulting position is shown below:

Note that I still haven’t removed the Spade suit, but I have arranged matters that the Spade suit can be removed in two easy moves, even without an empty column. Again this is an example of procrastination. Note that only one 3 of Spades is visible – hence removing the Spade suit entails exposing an Ace of clubs, which is always undesirable. If we can expose the other 3 of Spades before removing the Spade suit, then we can avoid exposing the A of clubs.

We have reached a critical moment of the game. We have no more cards in the stock and still have to expose 17 more cards. Luckily most of the unseen cards are good (as we saw from last week).

At this stage, we should be thinking in terms of “actions” instead of individual moves. Let us say that an action is a sequence of 1 or more moves such that only the last move exposes one or more cards (either by dealing from the stock or exposing a card). Note that if this requirement is not met then we are reducing our options for no gain.

For instance, suppose we complete the Spade suit by merging the KQJ09 + 87654 + 32A in three separate columns and then ask ourselves what is our next step? This would reduce our options for no reason. Yes, it is almost always good to remove a suit and clear an empty column, and yes it does make the resulting position easier to visualise but a serious player should develop the habit of thinking in terms of actions, not individual moves.

Another example: if we moved the 5 of Clubs in column 8 onto the Six of Clubs in column 2, then shift the 32A of Spades in column 6 to Column 4 without examining the newly turned card in column 8 then we are again reducing our options for no reason.

A useful corollary is that if we win, then there will be exactly 17 actions left. We need 16 actions to expose 16 facedown cards and then one final action to win the game. Similarly, winning from any starting position always requires exactly 50 actions. This is assuming no pathological scenarios arise, such as exposing two cards in one move when a complete suit is removed from the tableau (but we can always pretend that complete suits are not removed automatically and the player must spend a move to remove it).

If we lose this game, then there will be less than 17 actions (unless we get a most unlikely “cheevo” of exposing all cards and still managing to lose). Of course, the last action will be “resigning” almost always because the stock is empty and no sequence of legal moves exposes a new card.

Here are some more examples of actions and non-actions:

Move the 5 of Clubs onto column 2, exposing a new card. This is the simplest example of an action, consisting of only one move.

Move the 8 of Diamonds in column 1 onto the 9 of Spades in column 9. This is also an action (but we lose the option of removing the Spade suit).

Do both of the above moves. This is not an action because only the last move should expose a card.

Move the 432 of Clubs in Column 5 to Column 8. This move is safe since it is reversible. But it is not an action since it fails to expose a new card.

Remove the Spade suit (columns 4,6,9) then move the 5 of Clubs in column 8 into column 2. This is an action, but violates the procrastination principle.

Swap the 5-4 of Spades in Column 4 with the 5 of Hearts in Column 7 (this is legal despite the lack of an empty column), then remove the Spade suit, using columns 6,7,9. This is an action, but I would rather expose the K of Hearts than the A of diamonds.

Remove the Spade suit, then shift the 8 of Diamonds in Column 1 to the empty column in Column 9. This is a somewhat unusual action (why burn the empty column prematurely?) but I won’t say it’s a terrible play.

This list is probably too long already, but this does illustrate the principle of looking beyond the obvious. There are many possibilities to consider, and the most obvious is not necessarily the best.

Continuing the game from last week, I have turned over cards in column 1 and 8 without obtaining an empty column (column 9) or removing the Spade suit, seeing that:

I can obtain the empty column whenever I choose

I am still able to remove a suit of Spades, if I choose.

The King of Spades is a good card because we now have a choice of removing either King of Spades when clearing the suit. We can either turn-over a new card in column 8 or expose a useless King of Clubs in column 10. No prizes for guessing which is the better option.

Note that if I had prematurely removed the Spade suit before turning over a card in column 8 then I would be stuck with an exposed King of Clubs in column 10. That would considerably hurt our winning chances. This is a good illustration of why we try to procrastinate whenever possible.

Unfortunately removing the Spade suit will cost the option of turning over the last face-down card in Column 1 (this situation occurs because neither Eight of Spades is on top of a Nine of any suit). In other words we have an “either-or” situation: turn over a card in column 1 or clear the Spades, but not both.

We should also keep an eye out for suits other than Spades. All cards in the Heart suit are visible, but we cannot obtain a complete suit. However, if we expose a good card in Column 1 and get a second column then our chances will improve considerably.

There are only 17 cards unseen. Perhaps determining their ranks can shed some more insight on what the best move is:

35567779900000JQQ

Almost all of these are good cards. If we turn over the last face-down card in Column 1 then we are heavy odds-on to get two empty columns. The only bad cards are Nines and Jacks. A nine is tolerable since it solves the either-or problem described above. But a Jack would totally 83,85,67,75.

At this stage we have two basic options:

Expose the last unseen card in Column 1

Remove the Spade suit. This would cost a lot of flexibility since we make a lot of non-reversible moves, but removing Spades and turning over a new card in Column 8 is hard to turn down.

We have reached the following position after drawing the last row of cards.

The following histogram paints a grim picture: we have a severe shortage of Tens. However there are some bright spots:

We are guaranteed an empty column and at least three turnovers (columns 1,8,9) which is quite surprising given the deplorable state of the game.

When we turn over more cards, the histogram is likely to improve. For instance, we are much more likely to expose a Ten rather than a Nine or Jack.

Apart from the shortage of Tens, there is no other problem (okay maybe a minor shortage of Sevens).

At this point we should be paying attention to removing complete suits. Even when the game state seems deplorable you never know … perhaps all cards of a suit are scattered all over the place, yet one can guarantee a complete suit with the right sequence of moves involving only face-up cards.

Indeed it turns out a suit of Spades can be completed. Clubs and Diamonds are immediately discounted because the 7 of Clubs and 10 of Diamonds are not visible. All Hearts are visible, but extracting the sole Six and Jack in columns 2 and 4 is gonna be a problem.

We therefore conclude the game is far from lost. There are many options to consider. It is beyond the scope of this post to go through them all, but the main points are these:

We should think in terms of move-sequences instead of individual moves. In theory, it doesn’t make sense to play a move (or sequence of moves) unless only the last move of the sequence exposes one or more cards. Otherwise we are reducing our options for no reason. In practice there may be valid exceptions (a common example is performing “reversible moves” when you are only concerned with winning, regardless of number of moves). But this is a good guiding principle for improving players

We want to turn over a card in column 1 or 8.

We want to obtain an empty column (column 9) or at least keep the option of doing so

We want to clear the Spade suit, or at least keep the option of doing so

We want to maintain as much flexibility as possible (recall the virtues of procrastination!). This may imply e.g. we don’t actually clear the Spade suit.

We can also go through the usual motions of calculating good and bad cards. For instance a Ten is good because we have easy access to the J of diamonds in Column 2. But for this post I wanna emphasize the importance of long-term planning.