Another Spider Solitaire Video

Last week I added my third video – this time about Empty Columns. And I have a <sarcasm> whopping </sarcasm> 13 views at last count.

Of course the real motivation for this vid is revenge on one of my Facebook friends for a really lame prank. This kind of thing should have been stamped out many years ago, but I can’t give too much away. You just have to watch the video here and judge for yourself.

Unfortunately there’s a lot going on at the moment so I won’t have time to update the blog as much as I used to. Recently I solved an extremely difficult Sudoku puzzle on Puzzling Stack Exchange and I’m also into inventing my own Sudoku puzzles. And I still have a full time job that has nothing to do with mathematical games or puzzles …

Game on (8 July 2020)

Continuing from last week

Recall that we can remove a full set of Diamonds. There is a hidden catch I didn’t mention from last week. Removing Diamonds would imply we uncover no less than three Aces. There are exposed Aces in columns d,g,j. Any experienced player knows that too many exposed Aces can kill a game (perhaps even quicker than Kings) because nothing can play onto an Ace. Too many Aces exposed means a restricted set of legal moves at every stage of the game and the only way to fix this is removing a complete suit or dealing a new row of cards. One of these is usually not desirable and the other is difficult to achieve. I’ll let you guess which is which 😊 In any case we know that there will always be a full set of Diamonds exposed no matter what turns up on the next deal of cards. I decided to gamble by turning over a card column c even though I am no longer certain to remove Diamonds. I exposed a Two of Spades.

Next is the Five of Diamonds. We shift that onto a Six and reveal the Eight of Hearts. We are forced to deal another row of cards:

Well that was awkward. We have three Fours and no Fives. Perhaps I should have removed Diamonds while I had the chance, but on the other hand chances are I would not have liked those ten cards no matter what I did.

This raises an interesting point: if you were paying attention you might have noticed I am playing “Spider Master” instead of “Spider Random”. Since Master is the “intermediate level” of all Four-Suit games (the levels are Expert/Master/GrandMaster) we do not expect an easy ride. We started with some good luck in the beginning and therefore we were due for some bad luck. Under normal circumstances, this reeks of “Gambler’s Fallacy”. But given that I did not choose “Spider Expert” or “Spider Random” I will stand by this judgment. Needless to say, Whinging About The Injustice Of It All is not a recognised strategy by the experts, so how would you continue?

Game on (2 July 2020)

Continuing from last week

This is a reasonable set of 10 cards. We can obtain no less than three empty columns – if we so choose. But what do we do for an encore? Recall that an action ends when we expose at least one more card, so getting an empty column doesn’t cut it for an advanced player. Column ‘b’ sounds like the best source of new turnovers since any other column requires us to spend at least two empty columns. So we have three guaranteed turnovers since there are three empty columns and at least three face-down cards in column ‘b’.

We should also start thinking about removing suits. There is no suit with all 13 cards visible, but we can “threaten” to remove a suit or two. The Six of Spades is a nice card since it enables us to complete a run from King to Three. We can also guarantee a run from King to Five in Diamonds. With the 3-2-A in sight we have a “twelve-suit” with only the Four missing. With 30 cards in the stock and 15 in the tableau it is heavy odds on the Four of Diamonds will be found in the stock (recall there are two decks so the odds are better than 2:1). Unfortunately, building these partial runs will imply a reduction in our minimum guaranteed turnovers. I guess one could compromise, e.g. turn over one card and still retain options of building partial runs. So there is plenty to think about and it is difficult for even an expert to find a “definitive best play”.

Another consideration is that we have had a relatively easy run so far, so we might expect some “bad luck” given the hand is not random (we chose Master level). The initial row had 5 turnovers, and both rounds 1 and 2 have at least 4 turnovers (pretending they are the start of a new hand). So I won’t be surprised if something unpleasant happens on the next round of 10 cards. I guess if the next round is e.g. all odd cards then we probably can’t do much about it anyway. So we will cross that bridge when we come to it, if you pardon the terrible cliché.

At this stage of the game I will not give a sequence of moves but simply give the resulting diagram and leave it as an exercise for the reader to verify this diagram can indeed be obtained from the initial position.

The Jack of Hearts is a good card giving us an easy move that even my Dad can’t 70,85,67,75 up.

<bc> 8c

That’s a nice card. Shifting the 5s onto the 6s gives us a suited build, an empty column (Q of Hearts onto K of Diamonds) and a turnover (8c onto 9s). Nice!

<bi> 4d

Note the use of procrastination. We can always get our empty column back.

<bg> 9h

Aha! We drew a Nine so we retrieve our empty column without having to commit to <ed>. We might choose to empty column ‘j’ – this allows us to connect the 32A in Diamonds and recall that we have a twelve-suit in Diamonds with only the Four missing – no wait up, we just turned a Four of Diamonds two moves ago. Things are looking good!

Exercise for the reader:

  • Can we complete a full suit of Diamonds?
  • If yes can we procrastinate? i.e. can we turnover a new card (not necessarily column ‘b’) and still retain the option of removing the Diamonds?

Spider Solitaire videos on YouTube

I have now started a new project: Spider Solitaire videos on YouTube with the aim of teaching other players how to play well at Four-Suit Spider Solitaire sans boop. So far I have two vids, an introduction to the rules and a lesson on guaranteed minimum turnovers.

This is also an opportunity for me to “upskill” e.g. how to use OBS Studio or how to prepare material for lessons etc. I’ve learnt quite a bit after two videos – for instance listening to my own voice just downright 83,85,67,75,83 etc. With the pandemic not going away any time soon, I thought it was just as well to learn something new – who knows, my mad skillz might come in handy one day.

Unfortunately this means the silly stories you all know and love will be put on hold temporarily, but hopefully I can compensate with even cornier jokes. I can’t claim to be raking in the views just yet, so my modest goal is to achieve at least the square root of the number of videos for Aad Van Der Wetering’s Pi Sudoku – apparently you can write the first 20 decimals of pi in an approximate circle inside a 9×9 grid, add in a King constraint (no two equal digits diagonally adjacent) and voila – there is a unique solution! This video is sitting pretty at 301,405 views so I need 549.0036429751628 views (at the time of writing) and I’m only up to 45 views for both videos combined. So if you have plenty of spare time on your hands, haven’t seen my vids yet and are desperately keen to improve your Spider Solitaire game then you know what to do 🙂

Game on (24 June 2020)

Continuing from last week, we had the following position

We have only one guaranteed turnover. Let’s hope its a good one.

< gc, ab, jb, ef, if, hf, dj> As

Note that I deliberately broke the 7-6 of Clubs in column ‘i’. This is because if we expose an Eight then we get an empty column. The down-side is of course if we don’t draw an Eight then we are stuck with one less in-suit build then we “deserve”. This type of trade-off is typical in the middlegame. It would be nice if we could ensure (1) any Eight wins back an empty column and (2) we don’t lose any in-suit builds. Unfortunately I can’t see any way to achieve this.

Another reason for breaking the 7-6 of Clubs is I can arrange ten out of thirteen cards in Spades in a single column. From experience I find this increases the chances of completing Spades when the missing cards finally do come out. This type of “advanced” consideration can easily outweigh “basic statistics” such as the number of in-suit builds.

Finally we have to decide which of the four left-most columns to turn-over. I chose column ‘d’. I turn over an Ace of Spades and must deal a new row.

As usual, whenever a new row is dealt it is wise to study the game state in some detail before making any moves.

  • Do you think this is a good set of 10 cards under the circumstances?
  • How many guaranteed turnovers do we have?
  • Can we complete any full suits? Yes, No or Not Even Close?
  • How would you continue?

Tower of Hanoi (alternative version)

“I can’t do it,” sighs the Ninja Monkey.

“Now what?” I ask

“It’s the legend of the Flowers of Hanoi,” replies Monkey. “Something I learnt from the Bad Idea Bears.”

“I know you often mention the Flowers of Hanoi during Spider Solitaire lessons,” says Bad Idea Bear #1. “We asked our friends about it, and eventually figured out the rules.”

This cannot be good. Yes, the Bad Idea Bears have inquisitive minds, an essential quality for anyone who does a Ph. D., but it’s a pity their math fundamentals are 83,72,73,84.

In front of the Monkey are a pile of five flowers, surrounded by a large square. Each flower lies atop another flower of slightly smaller size. There are two more squares of the same size, but do not contain any flowers.”

The Bad Idea Bears say I should be able to shift all the flowers to one of the other squares in 30 moves, but the best I can do is 31.”

“Shouldn’t be too hard,” I say. “After all, thanks to an extremely fast metabolism you are able to complete 200 games of Spider Solitaire in three minutes if you pretend it’s played at the one-suit level. But this puzzle only involves five flowers instead of 104. How hard can it be?”

“But there’s a catch. You can only move one flower at a time – and no flower can be on top of a smaller flower.”

“Of course if this were Spider Solitaire then you can do it in one move, since all flowers are the same colour.”

“Yes that is true,” chuckles Ninja Monkey. “The game does have similarities with Flowers of Hanoi. I find I often need to make many moves just to expose one more card. But perhaps my Random Move algorithms aren’t all they’re cracked up to be.”

“Don’t be too hard on yourself. You’ve already achieved a lot with Four Suit Spider Solitaire. Everybody treats you with respect, and we won $3000 dollars from the Eagle last …”

“For 70,85,67,75,78 sake,” says the Eagle. “You don’t need to bring that up every third day of the month.”

“Why do the Bad Idea Bears think it’s possible in 30 moves?” I ask.

“I was wondering about that as well,” says the Bad Idea Bear #1. “But we finally figured out the pattern. We started by considering what happens with fewer than 5 flowers.”

BIB #1 draws a large circle in the dirt. He chooses two random points A and B on the circle and draws a line connecting the points. The two resulting regions in the circle are labelled 0 and 1.

“With only one flower, it takes one move to shift all flowers from one square to another,” says BIB #2

I nod in agreement. So far no ground-breaking discoveries yet.

BIB #2 draws a new circle in the dirt but with three vertices A,B,C and lines connecting all pairs of points. Now there are four regions numbered 0,1,2,3.

“With two flowers, we need three moves to shift all flowers to a different square.”

Again I nod in agreement.

The Bad Idea Bears draw three more similar diagrams but with four, five, and six vertices and lines connecting all pairs of vertices.

“Continuing in this manner,” says BIB #1, “we find seven moves are required to shift three flowers, fifteen moves for four flowers and thirty moves for five flowers. In every case Ninja Monkey has found a solution with the correct number of moves – except the last one.”

I examine the BIB’s artwork carefully. They have indeed correctly counted 30 regions in the last diagram. And they can draw diagrams faster than the Wise Snail, I’ll give them that.

“At first we thought it should be 29 regions in the last diagram,” says BIB #2 “but we eventually figured out that no three lines should intersect at a single point. Unfortunately Ninja Monkey has never been able to do it in 30 moves. He can do 7 moves with three flowers and 15 moves with four flowers but the best he can do is 31 moves with five flowers.”

I look in the Monkey’s direction – unfortunately he seems to have knocked himself out, and it doesn’t take long to work out why.

Oh well. At least I was brought up right by Mom and Dad. For one thing, I never scratch my 66,85,77 and/or pick my nose in public.


Tower of Hanoi

The Tower of Hanoi is a simple mathematical problem or puzzle. You are given three rods and a number of discs of different sizes. The puzzle starts with all discs on a single rod. Your aim is to move all of them to a different rod according to various rules:

  • Only one disc can be moved at a time
  • No disc can sit atop a smaller disc.

It is not hard to show that with N discs, we can achieve the goal in 2N – 1 moves. The simplest proof is to observe that with N discs we need to perform the following three steps: (i) shift the top N-1 discs to an empty rod (ii) shift the bottom disc to the other empty rod, (iii) shift the top N-1 discs onto the bottom disc. By mathematical induction one easily establishes the formula 2N – 1. Note that we are essentially reducing the problem with N discs to a problem with N-1 discs.

With similar reasoning one can show that any random position of discs can be obtained (as long as no disc covers a smaller disc). The proof is left as an exercise for the reader.

The Tower of Hanoi is an example of shifting a large pile of items with limited resources. If you are not familiar with this puzzle, you will probably be surprised by the fact that only three rods are required no matter how many discs you start with. Avid readers of this blog may have come across terms like “Tower-Of-Hanoi manoeuvres” from previous posts, so if you were unsure what the fuss was all about, then now you know 😊.

In Spider Solitaire we are often confronted with the problem of shifting large sequences of cards with limited resources. A simple example is shown below: A complete suit of Spades is visible but can we actually clear the suit with only one empty column?

The answer is yes. We can shift the Eight of Diamonds onto the Nine of Diamonds in column six, build the J-0-9 of Spades onto the K-Q in column 2, move the 8-7-6-5 of Spades from column five onto the 9 of Spades, swap the 4H and 4S on top of both the Spade Fives and finally add the Ace of Spades from Column three to complete the suit.

Going back to the Hanoi puzzle, with a small number of rods a monkey could probably luck his way into a solution by making random moves, but once you get a decent size pile of discs the random move strategy doesn’t work so well! Also, with random moves it is difficult to prove that e.g. 30 moves or less is impossible given five discs. Similar considerations apply to Spider Solitaire. Since the above example is relatively simple, a monkey could probably complete a suit of Spades by repeated trial and error, assuming he only makes moves that are “reversible”. But with a more complex problem, the monkey won’t do so well.

If you want more practice with “Tower-of-Hanoi manoeuvres” I recommend the following exercise: set up the diagram above, ignoring any face-down cards or cards not in sequence (for instance in column two you keep only the K-Q of spades).  Then try to minimise the number of in-suit builds using only reversible moves (you should be able to get pretty close to zero). From this new position pretend you’ve just realised your mistake and try to clear the Spades using only reversible moves. This exercise should give you an idea of why empty columns are so valuable.

Note that all this carries the assumption of no 1-point penalty per move (commonly used in many implementations of Spider Solitaire). If there was such a penalty then we would have to think twice about performing an extra 50 moves just for the sake of one more in-suit build. But for now we’ll keep things simple.

Game on! (17 June 2020)

Continuing from last week

I hope you understand the notation by now; if not please refer to previous posts.

<ch,ic,hc,bf, cb> Ks

<jc> Jc

<ba, bi, gb> 9c

<be,gb > 6h

<ai,ga> Qs

<jg> Ad

<fa, cf> Qc

Now is a good time to take stock and assess the position. Clearly we are doing very well with only 16 cards face-down in the tableau and four rounds left in the stock. We have one “implied” empty column since the Ace of Diamonds can play onto the Two of Hearts on the left. This is worth one turnover in any of the four left-most columns. We also note that:

  • There are only four columns containing at least one face-down card. This is good news when playing for empty columns, but there is a new danger: the possibility of one-hole-no-card. It’s not an immediate problem since the cards in columns b-c-d are “clean”, but it’s still something to bear in mind.
  • We are not close to completing a full suit. This can be “blamed” on having so many unseen cards in the stock, but it sure beats having so many unseen cards in the tableau! Spades and Clubs do look promising with only three cards missing.

So it seems our strategy should be to keep trying to tidy in-suit builds and expose as many face down cards as possible. I generally find once all cards in the tableau are exposed, the complete suits will take care of themselves (barring a series of major accidents). But if you can’t expose all face-down cards then you have to “earn” your suits. How would you continue?

How Can I Win This Game? (Alternative version)

It was a pleasant Sunday afternoon. The sun was shining and he had plenty of spare time on his hands. True, there was the small matter of a chemistry assignment due tomorrow, but that could always be done after dinner. A perfect time to play some more Spider Solitaire.

The play had started well, but things started to sour when four Kings appeared in the third deal. The fourth deal brought no luck either with no face-down cards unable to be exposed. Resigned to his fate, Joe Bloggs reluctantly dealt the last row of ten cards and surveyed his prospects.

How can I win this game? Joe asked himself.

There was some good news: an empty column (or “hole” as he liked to say) was available in the ninth column. And he could turn over a card in Column h. But at this stage of the game Joe realised he would need a good miracle or three to win.

“What is the best card I can hope for in Column h?” Joe asked himself.

This brings him to the bad news: there would be plenty of calculation to look forward to, and given the stock was empty any mistake, no matter how small, could be fatal.

Suddenly Joe Bloggs spots a bird staring at him through the window.

She’s been wallowing in the mud for way too long. Don’t ask me why.

Joe Bloggs briefly considers giving the poor thing a nice warm bath.

“Oink oink,” says the bird.

“87,72,65,84 84,72,69 70,85,67,75?” replies Joe Bloggs.

Through his peripheral vision, Joe Bloggs notices a flock of shiny pigs floating in the air. Thirteen of them shift into the foreground and form the shape of a happy face. After winking at Joe Bloggs, they chase each other in circles for a good half-a-minute. Then they gradually accelerate until whoosh – they shoot up towards the sky!

“Oink oink,” repeats the Bird.

Joe Bloggs stares at the bird again. Perhaps she is trying to tell him something, but he can’t work out exactly what. His chemistry assignment? That wouldn’t make much sense.

Joe studies the cards again. He soon notices that every card in the Spade suit is visible in the tableau. An Ace in column 5 or 6, Deuce and Three in column 6, Four-Five in column 8 and so on. Perhaps it is possible to remove a complete suit of Spades with the correct sequence of moves, regardless of the permutation of face-down cards. Not likely, given they were scattered all over the place, but perhaps his best shot anyhow.

“Aha,” says Joe Bloggs, after some thought. “The correct move sequence is <bg, id, ih, ia, jf, dj, cd, ch, jd, cj, d2=j1, hc, hc, fg, fd, fh, fa, d1=f1, f2=h2, hc, cj>”

Joe Bloggs executes the move sequence <bg, id, ih, ia, jf, dj, cd, ch, jd, cj, d2=j1, hc, hc, fg, fd, fh, fa, d1=f1, f2=h2, hc, cj> and whoosh – he triumphantly slaps the Spade Suit onto the foundations!

True, his position was still very bad after removing the suit of Spades but no matter. He had already won the war: thanks to this hand his skill had improved considerably and the actual result of this game was rendered moot.

How Can I Win This Game?

In the opening phases of the game we are always concerned with turning over new cards and building in-suit. But in the middle-game or end-game things are different.

By this stage a decent player will be able to evaluate the position. After performing some multi-dimensional calculus on the back of an envelope, he she or it will be able to estimate winning chances and decide on a plan of action.

Unfortunately, an in-depth discussion of multidimensional calculus is beyond the scope of this post but a useful general principle is the following:

  • If things are going okay, we should continue to play our normal game. Turn over new cards, build in-suit whenever possible, and start thinking about removing complete suits.
  • If the game is going badly, start looking for miracles. You need them to win, and miracles never occur if you don’t look for them.

Conversely if the game is going extremely well, you might consider playing safe, but that’s another lesson for another time.

In the diagram position you don’t need a Grandmaster Title from the International Federation of Spider Solitaire to work out the prospects are bleak. The stock is exhausted, several cards are yet to be exposed etc, etc. But all hope is not lost if you excuse the terrible cliché. We can quickly obtain an empty column and turn over cards in columns a or h. Since we probably need good cards to win, we might ask ourselves “if we could call the next card what is the best case scenario when turning over column a or h?”

A closer look reveals all cards in the Spade suit are already exposed. Assuming we focus all our effort into removing a full suit of Spades how much luck do we need? Perhaps a good card or two in column a, or perhaps we can tidy things up a little and hope for luck on the next deal – no scratch that, the stock’s already empty.

It turns out we don’t need any luck – it is possible to remove the Spades without exposing any new cards. Of course, we need to expose cards to win the game eventually, but the point is we are guaranteed to remove Spades regardless of the permutation of unseen cards. One sequence would be: is <bg, id, ih, ia, jf, dj, cd, ch, jd, cj, d2=j1, hc, hc, fg, fd, fh, fa, d1=f1, f2=h2, hc, cj>. Whoosh – the Spade suit goes onto the foundations!

If you found this sequence of moves well done. Of course, it might be possible to do better than that – remembering that removing one suit is not synonymous with winning the game. But at least it’s a fallback position: we can choose this option if we find nothing better.

Avid readers might have recognised the exact same position from an earlier post, and would keenly deduce the game is winnable since I managed to beat it without undo. If you spotted this then again well done 😊