Game on (26 Feb)

Time to continue our sample game.

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.

What would you do here?

Playing with 85,78,68,79

Time for another lesson. I deal a new hand.

 “What is the best opening move?” I ask my students.

“Move the Nine, column 6 to column 7” says the Lion.

Uh oh, Bad Idea Bear #1 is misbehaving again. Apparently he wants Ninja Monkey to teach him how to make 70,65,82,84 noises with his armpits. I walk towards BIB #1 and Ninja Monkey, leaving my other students to study the game state in my absence. I give them a stern warning, but some sixth sense tells me everything will somehow turn out okay – as it always did in the past.

“Column 8 instead of column 6 would be better,” says the Elephant.

Stunned looks from the rest of the class.

“How … could that possibly be better?” I ask.

“Just … h- had a hunch,” stammers the Elephant

“Wait a minute,” I reply. “Columns 6 and 8 are the Nine of Clubs and Spades, respectively. Column 7 contains a Ten of Diamonds. There is no logical reason to favour clubs or spades – may as well toss a coin.”

I know the Elephant ain’t the sharpest tool in the shed if you excuse the cliché. Bad Idea Bear #2 is trembling nervously.

“Hang on,” I say to BIB #2. “Did you not tell the Elephant to commit the cardinal sin of Spider Solitaire? Do you remember the first two rules of Spider Solitaire Club?”

“I forgot the rules,” says the Dumb Bunny. “What were they again?”

Sigh.

“The First Rule of Spider Solitaire Club,” I say tersely, “is you do not 85,78,68,79 any moves. The Second Rule of Spider Solitaire Club is you DO NOT 85,78,68,79 any moves.”

“But didn’t you use 85,78,68,79 yourself?” asks the Smart 65,83,83.

I am completely baffled – until the Smart 65,83,83 shows me a paper titled “Random Walks: an application for detecting bias in Spider Solitaire programs.” With my name on it.

Oops.

“Okay. 85,78,68,79 is allowed. But I want you to record the identity of every card – so Ninja Monkey can evaluate its difficulty. Don’t forget Monkey knows how to (occasionally) win at the four-suit level”.

The Elephant, Ninja Monkey and Bad Idea Bears breathe a collective sigh of relief, and the Smart 65,83,83 is the hero for today – and so we maintain our perfect record of no student ever being expelled from my classes. Oh well, just another average day in my teaching career.

THE END

Game on (19 Feb)

Okay, now we can be justified in complaining about our bad 76,85,67,75. We got 4 kings in round 3 and round 4 yields only one turn-over in column 3 or column 8 (exercise for the reader!). At this stage, the game is almost certainly lost, and although it is possible to search for the best chance (no matter how slight), I would rather discuss the possibility of winning if 85,78,68,79 was allowed – but only because

  • somebody commented on my earlier post, asking if 85,78,68,79 was cheating
  • She is the only person to comment on any of my posts, if we ignore the Evil Villain who writes in Russian and is obviously trying to entice me into watching 80,79,82,78,79,71,82,65,80,72,73,67 videos (I’ve had plenty of likes for my silly stories however).

I prefer to play without 85,78,68,79 because the game can almost always be won (just like Freecell). However, I will allow exceptions if the player is very very smart at math and wants to write a paper on Spider. For instance, if we believe the game is rigged then we need to determine the identity of all face-down cards so we can test Random Move algorithms on a particular hand. At the time of writing, Ninja Monkey can only play well at the one-suit level but this time he has learnt a trick or two at the highest difficulty level.

So assuming this game is lost without 85,78,68,79, our new question is: how easy is it to establish the identity of all face down cards with 85,78,68,79?

If you have any experience and use 85,78,68,79 a lot, you would know the power of empty columns. For instance in the start position if you had a “free cell” you are guaranteed 10 turn-overs with 85,78,68,79 even if the starting hand was five Kings and five Aces! That’s a lot better than 1 turn-over without 85,78,68,79.

As a simple exercise for the reader, go back to (i) an earlier post when I had an empty column (ii) my original start position. How many guaranteed turnovers do I get if 85,78,68,79 is allowed?

Rank Imbalances (alternative version)

“Well technically we got our empty column back,” said Haw.

<sarcasm> A fat lot of good that did </sarcasm>,” replied Hem, “seeing we had to lose it immediately.”

I enter the card room and survey the current game state.

“Allow me to introduce ourselves,” says Haw. “We’re the Little People – Hem and Haw from the short story Who Moved My Empty Column?

“I’m Spider GM,” I reply. “I think I know you already – after all I’m the writer of this blog.”

My other students introduce themselves to the Little People. I’ve watched Hem and Haw play before, and it seems they are decent enough players but prone to going on tilt when things don’t go their way.

“We’ve just dealt a fresh row of cards,” I say. “Before making a move I want you to evaluate the position. Do you think we are going well, badly or somewhere in between?”

“Could be worse,” says Hem. “At least we can get back our empty column.”

“But what do we play after getting back the empty column?” asks the Lion.

“Well we can also expose a card in column Three” says the Eagle.

“Uh oh,” says Sand Griper. “I think the laws of probability are rigged.”

The Sandgroper is not one of my better students. He got that nickname because he always likes to spend a lot of time complaining about his bad luck – time that could be much better spent on learning statistics 101.

“Why are the laws of probability rigged?” I ask.

“There are 49 cards exposed. I see six Jacks but only one Ten. This is remarkable – surely that shouldn’t happen very often assuming perfect shuffling.”

The Sand Griper clicks his tongue and Ninja Monkey immediately grabs two decks of cards and deals 49 cards face upwards. He rinses and repeats for 10,000 trials. It takes a mere six seconds to tally the number of remarkable deals according to the Sand Griper’s definition.

“I think the Sand Griper may have a point,” says Ninja Monkey. In only 61 trials did I get 49 cards with at most one Ten and at least six Jacks.”

“Not so fast,” I reply. “How many games did you play?”

“About ten”, replies Sand Griper.

“Also why did you choose Jacks and Tens? You obviously chose them because of the current game state. But you might have chosen Threes vs Fours or Queens vs Kings. For your reasoning to be valid you have to nominate Jacks vs Tens before dealing a hand.”

The Sand Griper starts squirming – and with good reason.

“Alternatively, you can say that a set of 49 cards are rigged if there is ANY pair of consecutive ranks X and Y (such as Threes vs Fours) such that we have AT MOST ONE of X and AT LEAST SIX of Y. Also, remember that X can be Y – 1 or Y + 1.”

I click my fingers. After six seconds of dealing and shuffling Ninja Monkey tells me out of 10,000 trials there are 1251 satisfying the above conditions.

“Therefore, if you play 10000 games you should get a remarkable deal 1251 times.” Since you played 10 games you should get a remarkable deal 1.251 times. Now you told me you played about ten games and you only complained about getting a remarkable deal once. So perhaps there is nothing remarkable about this after all.”

The Sand Griper continues to squirm.

“Now, going back to the lesson …” I continue.

THE END

Rank Imbalances

In this lesson we will examine the issues of rank imbalances. The current diagram shows the state of play after we dealt a second row of cards from the stock.

One thing you may have noticed is we seem to have a lot of Jacks but not many Tens. To be more precise we have only one Ten but six Jacks. That’s a delta of 5. If we try to construct the entire “histogram” for all card ranks we will also find several other discrepancies between other pairs of adjacent ranks such as seven Fours but not as many Threes or Fives.

Of course all players would know that such imbalances are less than convenient, but how best to deal with such imbalances?

One thing to note is that we can’t affect the probability of turning over specific cards. For instance, there are two Jacks remaining and 104-49=55 cards unseen. The probability that the next exposed card is a Jack is always 2/55 no matter how well or badly we play (if we deal from the stock we can always pretend 10 cards appear sequentially instead of simultaneously). But we can mitigate the effects to some extent. For example if two Jacks are buried under a King then the effects of too many Jacks will be attenuated, but if the only Ten was buried under two Kings then that is obviously much worse.

It is beyond the scope of this post to discuss in detail how to deal with rank imbalances, but a general principle is that the more flexibility you have, the better your chances will be – and the best way to retain flexibility is to procrastinate whenever possible.

Consider the following questions:

  • Can we get back our empty column? (a good question to ask whenever at least one column has no face-down cards!)
  • Can we increase the number of in-suit builds?
  • How many guaranteed turnovers do we have? (Note that an empty column usually equates to one more turnover, but not always).
  • What would be your next play?

As an aside, here’s a question for the math geeks among you. Do you think we would be justified in complaining about our bad luck seeing that out of 49 exposed cards there are six Jacks but only one Ten?

One might try to compute the probability that out of 49 cards we will get at least six Jacks and at most one Ten. Computer simulation says the chances are 0.61 per cent.

Not so fast. Note that I specified “Jacks versus Tens” after seeing the current game state, which is clearly unfair. Either we have to guess a pair of adjacent ranks (e.g. Fours vs Threes) or alternatively include all ranks. In the latter case we might ask “what is the probability that out of 49 cards we will get at least six repeats of X and at most one Y for some pair of adjacent ranks X and Y?” Remember that X can either be Y+1 or Y-1. In this case the probability is about 12.5%.

If you’re really nit-picky you might also ask “why 6X versus 1Y? Why not 7X vs 2Y etc”, but you get the gist.

There is also the issue of selective memory. We might have played eight games and we only remember the one game with way too many Jacks and only a solitary Ten. And by some strange coincidence, 12.5% happens to equal the fraction 1/8.

This is probably too much detailed mathematic specificity for the average Joe Bloggs, but the point I wish to make is don’t complain that the game is rigged unless you really know your statistics better than your alphabet.

 Now, going back to the lesson

Who Moved My Empty Column?

Hem and Haw surveyed their progress. They had procured an empty column and only one row of cards had been dealt from the stock. Things were going well.

Every morning they would jog to the card room, analyse the current game state and find the best possible move (or a sequence of moves until they turned over a card). They had played for around 20 days and had every expectation of winning.

“The empty column is ours to keep,” said Hem.

“I agree,” replied Haw. “We earned it”

“With Empty Column E, the game becomes so much easier,” said Hem. “There are many more chances to expose more cards or build in-suit if you see e.g. a Six and Seven of Hearts in different columns. And the good news is we always get to keep our empty column”

Haw spots that Column 1 has a run from Eight to Ace, except the Five is missing.

“We can insert the Five of Clubs in column 9 into Column 1,”

Hem briefly searches for other possibilities but comes to the same conclusion: Haw’s suggestion is the best play.

<< a few days later >>

“Oh For 70,85,67,75,83 Sake!” shouts Hem.

“What’s wrong?” asks Haw.

“Our empty column is gone!”

“It’s not gone. I only count nine piles of car-“

It doesn’t take long for Haw to see the problem. It was no longer possible to expose a new card without using up Empty Column E.

The Little People survey the game state, searching for some hidden recourse – but in vain. Resigned to the inevitable, they stare blankly at the cards and stew.

Haw notices a giant mouse holding a red crayon and giving an oh-so-polite wink.

Year of the rat, 77,89, 65,82,83,69.

And then he sees it.

“Okay,” says Haw. “We need to give up the empty column for one more card, but what is our best option? We can shift a card in Column 1, 2 or 3, but it’s not great. At least we can expose a new card.”

“I noticed your supply of good moves was dwindling,” says the mouse. “I wasn’t surprised that you eventually had to give up Empty Column E.”

“True,” replies Haw. “But I wasn’t asking you. Besides, you didn’t exactly answer my question.”

Yes, the next few moves will probably be uncomfortable without Empty Column E, but if they play the cards well, they might find a new Empty Column N, maybe on the left half of the tableau. And a little luck wouldn’t hurt either. Unfortunately, the mouse isn’t of much help. Mice aren’t exactly known for their analytical skills and prefer to scurry from column to column and sniff out good moves by instinct.

After some thought Haw finds a different possibility.

“What if we shift the Two of Spades onto the Three of Clubs?” says Haw. “Then shift the Four of Hearts into the empty column and we build in-suit with 5-4 of diamonds. That way if we expose a Six then we get our empty column back. What’s your opinion? Hem? … Hem? …”

Alas, Hem had already tuned out long ago, oblivious to everything – his friend Haw, the mouse, the red crayon and the words “GET OVER IT” scrawled on the nearest wall.

To be continued …

Game on (3/Feb)

We have come to a situation familiar to every player: we have an empty column but must use it to turn over a new card or to “tidy up suits”. What would be your play here?

Clearly, we can turn over a new card by moving the Kh, Jc or 8d to an empty column. It’s lame but at least we get the turnover (there are cases where we must accept zero turnovers with an empty column but that’s a lesson for later). It would be nice if we can move the 9c-8c in column 5 to the empty column and then shift the 9s-8c in-suit to column 5. Unfortunately, that’s illegal.

Searching for other possibilities, we find it is possible to shift the 2s onto the 3c, then 4h-3h-2h-Ah in column 9 to the empty column and build in-suit with 5d-4d. This way we get a turnover plus an in-suit build. This is in fact a not uncommon scenario if you excuse the double negative. True, we lose a turnover if the next card is a Two of any suit, but we gain if the next card is a Six since we can shift the 5d-4d. Note that as an added bonus, we get to build in-suit with 4d-3d also. So it’s decided then: we will turn over a card in column 7. With reasonable luck we will get our hole back, since columns 2,7,9,10 have two face-down cards or fewer.

Although it is not relevant to this position, it is sometimes possible to get a two-fer i.e. two guaranteed turnovers for an empty column. For instance if the first three columns had 9, 8-K, 7 (suits irrelevant), then shifting the King onto the empty column allows us to shift the 8 and 7. These situations are rare but worth looking out for.

Let’s see what the fickle Spider Solitaire gods give us …