Monkey Algorithm – In Depth

Let us take a closer look at Ninja Monkey’s algorithm. We know it can get about 6% win rate on random four-suit deals without undoing moves – and that’s nothing to sneeze at when many players have difficulty with the 4-suit version. Not to mention that I am unaware of any research into designing a Spider Solitaire AI that plays without rot13(haqb). The heart of the monkey algorithm is as follows:

This represents “what to do with the current game state”. The basic idea is if any column is headed by a face-down card then we can count it as a turnover – but we don’t know the rank or suit of that card. If we call that card X then nothing can move onto X and X cannot move anywhere (not even an empty column). Let’s look at an example:

Let’s say we executed the moveblock “id,ah,fh” but without turning over any cards. The game state would look like this:

Disclaimer: I only got ‘C’ in Year 10 Art

Without loss of generality, let us assume we score 10 points for turning over a card and 1 point for building in-suit. Our score would be 31 regardless of the identity of newly-turned cards.

Clearly, “id,ah,fh” is not the best possible moveblock for several reasons. For starters, we can play only “id” and examine the new card in column 9. Then we still retain the option of playing “ah,fh” if the new card is useless – or we may find something better than “ah,fh”. This is why the statement “execute best moveblock found” comes with the caveat “first turn over only”.

Now let us consider only the three lowest-numbered cards in columns 1,6,8 in the original position. Clearly we can guarantee two turnovers with ah,fh. But suppose we knew the card under the Two of Spades is the Three of Clubs. Then we can get two turnovers plus an in-suit build with fa,fh. Obviously, that would be cheating since we aren’t entitled to this information. This explains why the statement “guess a move block” comes with the caveat “no turnovers”.

The rest of the algorithm should be fairly self-explanatory.

The observant reader will have noticed it is not necessary to begin with an in-suit build to achieve the worst-case scenario. Going back to our hypothetical moveblock of “id,ah,fh”, we would get the exact same position with, e.g. “ah, id, fh”. If we only had two guesses “id,ah,fh” and “ah,id,fh”  they would have the same evaluation score. We all know we should begin with the in-suit build, but my algorithm would effectively decide by tossing a coin.

Assuming we make enough guesses, we should eventually stumble upon a score of 61 with six turnovers and one in-suit build. One such moveblock would be “ec,hc,ac,fc,id,db”. If that was the final best_moveblock_found then we would execute the move “ec”.

In this case, our algorithm actually found a decent opening move – with three Sixes available, it’s hard to imagine “ec” being a significant blunder even though an in-suit build was available with “id”. Of course the algorithm could equally well have come up with “db,ib,eg,hg,ag,fg” and start with “db”. This would cost a turnover if the next card was a Nine.

Of course, it should be possible to modify this algorithm to avoid the latter scenario given sufficient effort, but I would rather gain some experience with collaborating with other software developers via GitHub. As mentioned previously the current state of my project is a bare-bones AI with plenty of room for improvement and my Spider Solitaire project gives me a perfect excuse to do so.

Post-Mortem Analysis – Round 5

Link to Round 5 is here

Link to PMA Round 4 is here

This is a critical point of the hand. At the risk of sounding like a broken record, a lot can change when 10 cards are dealt simultaneously instead of sequentially. Moreover, once the stock is empty the effects of a bad draw can be catastrophic, or we could come up golden and reach a position where it’s virtually impossible to lose (unless all three blobs were impostors) – or it could be somewhere in between.

In this case, we got an excellent draw. The main point in these situations is not to panic at the sheer number of cards in the tableau. Careful analysis shows we can indeed remove one full deck of cards (including the Diamonds that have already been removed) regardless of the permutation of unseen cards. It’s not necessarily the best course of action, but at least we have a fallback if analysis reveals nothing better.

All three blobs wanted to “delay” this decision by not turning over any cards – and I believe IM Bartacus and IM Bug chose the wrong plan. They ended up in the following situation:

If we ignore the fact the newly turned over card in column 2 is a K of Spades, then we have three suits removed and two guaranteed turnovers. Now let’s look at Blue’s suggestion: “id,ai,ai,hi,hf,ha,ei,ea,gi,gj (h12=i8)” leading to this position:

This is much better. We can play fe,df,jd,jh,ie,fi,cg,cb,ci,(e7=h7),bi,ei,be,(b1=h6) to reach this position with four suits removed and also two guaranteed turnovers

No wait – in the actual game we get three suits removed and THREE turnovers. We weren’t allowed to count the fact the newly turned over card is a King of Spades (giving a home for the Queen in column 7) but we can count the fact we turned over something in column 2. This means Blue’s suggestion was not clearly superior to the actual continuation, and the team had every right to believe Blue was the impostor. Rot13(SHPX SHPX SHPX SHPX SHPX SHPX SHPX SHPX SHPX!!!!!).

Blue thought he was being clever, by using the Queen of Hearts in column 8 instead of column 6 (indeed using the Q in column 6 would be egregiously bad) but this turned out to be a miscalculation. To be more specific, the actual game continuation achieved one more guaranteed turnover at the expense of one more suit – and this is a good trade-off because the biggest danger of losing this game is if the next 2 or 3 cards are bad. There is little danger of losing because we removed too few suits.

In case you didn’t follow all of the above the TLDR version is rot13(Fcvqre TZ shpxrq hc).

In the endgame, Blue insisted on clearing the mess in column 8 early to avoid column 8 becoming a problem later. This is a good general principle:

KNOWLEDGE BOMB: From a position of strength, it is often wise to identify a “difficult task” and get it out of the way before it becomes a problem later (remember the dangers of one-hole-no-card).

The situation Blue wanted to avoid was this one:

This image is from the back cover of Steve N Brown’s excellent book “Spider Solitaire Winning Strategies”. When I saw this image, I immediately recognised it for what it was – most probably thanks to playing far too many games on a Spider Solitaire server that I am convinced is biased. If Steve played on that server, I would bet my Ph. D. thesis he would not have written the words “this game could have been won if only a little more care had been taken”.

Unfortunately for Blue, this knowledge bomb turned out to be unnecessary – the simple plan of turning over everything outside Column 8 was sufficient, even if the impostor were allowed to call the remaining face-down cards in column 8. My calculations say that ten columns in the tableau is just barely enough to get the job done (and I fully trust IM Bartacus and IM Bug are more than capable of reaching the same conclusion) and the actual cards were nowhere near the worst-case scenario. With winning reduced to a mere formality, Blue had no chance to redeem himself. He tried to inject a little humour by rapping in the Iambic pentameter but it was all in vain.

In summary, a great game with both Team Good and the Impostor having legitimate chances to win until the very end. IM Bartacus and IM Bug navigated most of the traps but let a few bad ones through, and the position looked desperate at one stage. But we managed to pull everything through in the end – until Blue had an absolute brain-fart, miscalculating a critical decision at the start of round 5 and giving IM Bartacus a good reason to believe Blue was the impostor. IM Bug tried to salvage the situation by explaining that “1 impostor” was written in red font and therefore the impostor should be Red. But my Random Number Generator app would have none of that and Blue was declared the impostor anyway on the tie-break. In the end, honours were shared with Team Good winning 100VP out of a possible 200.

Post-Mortem Analysis – Rounds 0 and 1

Link to Round 0 is here

Link to Round 1 is here

Round 0

Not much in the way of tricky decision making. Unless we get a really good round with many turnovers it’s virtually impossible to suggest an egregiously bad line of play without arousing a disproportionate amount of suspicion.

That being said, when no more turnovers were available, Red tried to rot13(shpx) things up by increasing the number of in-suit builds at the expense of “junk-piling” a column with a Queen. Even though Queens were cheap because supply exceeded demand, I believe it is a definite error in the long run.

Red tried to rot13(shpx) things up with “he” before dealing

I’ve played enough games to know that the supply-demand relationship can change drastically. This phenomenon occurs because the rules of the game demand 10 cards to be dealt simultaneously instead of sequentially. This problem is exacerbated when you’re forced to deal two rounds in quick succession. Before we know it there are too many Jacks and Kings in play and the once-hated Queens suddenly become our only hope of salvation. All this trouble just for the sake of one measly extra in-suit build!

Needless to say, IM Bartacus and IM Bug weren’t falling for Red’s shenanigans this early in the piece 😊

Round  1

A fairly good result with three columns containing no face-down cards – thus we have fair chances of getting back at least one empty column on the next deal. We have 10 out of 13 cards in the Diamond suit, but the cards are scattered in various columns and it’s odds-against the Jack, Five and Three appearing soon – therefore now is not the time to think about the Diamond suit, unless we somehow manage to satisfy the proverbial “all other things being equal”.

Decision 19 stands out as a particularly interesting moment when all three Kolourful Kibitzers suggested a different line of play.

Red suggested “hb, he, hf, hg, fh, eh, ef” which I didn’t like because burning the 4 of Hearts costs some flexibility if we need to work on column 9 – not to mention column 2 becomes harder to work on. If we did burn the 4 of Hearts we could at least try to get “compensation” by lining up the 7-6-5 of Spades (as per Blue’s suggestion) and turning over Column 1. Admittedly, but the difference is small and hard for even a GM to argue convincingly. All things considered, the three blobs were well behaved that round.

A difficult decision … hard to criticise the impostor here

Building Complete Suits

One of the hallmarks of a winning Spider player is the ability to consistently clear at least one suit, even on difficult hands. Often players get caught up in the minutiae of trying to turn over as many cards as possible or to “tidy” things up by arranging suited builds. This is all well and good near the beginning but when you have several cards in play it’s time to think about building suits. This often requires “whole board thinking” and long term planning.

In easy or medium (1 or 2 suit) level, if a player turns over enough cards and gets and empty column or two then complete suits will take care of themselves. But this is not true at expert level. A good player should be thinking about building suits at virtually every stage of the game.

What happens if you get 1 or 2 empty columns, a few suited connectors scattered here and there but are never able to remove a complete suit onto the foundations? The following diagram should give you a pretty strong hint 😊

To clear a suit, two things must happen:

  • All 13 ranks of that suit must be visible
  • It must be possible to organise them into a single column.

 The first condition is easy to check, since it’s just an exercise in card-counting. The tricky bit is answering the second condition, assuming the first condition actually holds.

Here is a simple example, which you may recognise from my (admittedly lame) short story from a previous post.

We have already cleared the club suit and there are three empty columns. This game should be easily winnable, but we may as well use this example to illustrate the concept of building full suits. Every rank in the Heart suit is visible. We have K-Q-J-0 in column 2. The remaining cards are found in columns 3,4 and 9. With three empty columns it is not hard to verify the Hearts can be collected into a single column.

As a fun exercise, try to do it with less than three empty columns. The following table should give an estimate of your playing strength

If you can clear Hearts with Then
Three empty columns Well done
Two empty columns You are already above beginner level
One empty column You are probably an International Master
Zero empty columns or less Your name is probably Chuck Norris

If you wanna get really good at 4-Suit Spider, you should try to visualise what happens after clearing a suit. After all the aim of the game is to complete eight suits, not just one. But that’s a lesson for later. As usual, it’s best for a beginner player to focus on learning one thing at a time.

In practice, it is often wise to think about complete suits before all 13 ranks of a particular suit become visible. As an example, consider the following two diagrams and answer the questions below:

  • What is the difference between two diagrams?
  • Are they equivalent? That is, given one diagram can you reach the other?
  • Assume your next move is shifting the 10 of Hearts to an empty column. Which diagram would you prefer and why?

These diagrams are the same, except columns 8 and 9 have some cards switched. If we assume that each suited connector is worth 1 brownie point, both diagrams would score the same number of BP.

The difference of course is that in the second diagram we already have a run from K-Q-J-0-9-8 in spades. If, somehow, we get a run from Seven to Ace, then the difference between the two diagrams becomes manifest. It is true that we are a long way from getting 7-6-5-4-3-2-A in Spades, but there is no harm setting up the run from K-Q-J-0-9-8.

Those with an attention to detail might have noticed it took me 15 moves just to swap the Q-J-0-9 in columns 8 and 9 for some nebulous gain. But I recommend that the serious player should get into this habit of striving for perfection even at the cost of playing numerous moves and losing score. Once the player can get a decent win rate (e.g. 30% without 85,78,68,79) he can start to think about optimising score.

Many close games are lost because a player is stuck with a “twelve-suit” instead of a complete suit, and it is quite possible the loss can be blamed on poor planning at an early stage of the game.

I hope you found these lessons useful. If your Spider win rate has dramatically improved in the last three weeks, please leave a comment below 🙂

Short Story Challenge!!!!!!!!

Okay, so after three weeks it seems that most of my readers/followers have some experience in writing short stories but none of them have any experience in playing Spider Solitaire. Nobody has left a single comment so far. So maybe my next project should be to play a game of Spider to the best of my ability, then pretend my move sequence is the plot of a really lame story, told from the viewpoint of one of the cards in the tableau.

THE GREEN SCREEN

So here we are in the Green Screen (for lack of better name). Our task is to somehow escape from this simulated reality and teleport back into the real world as physical objects. Perhaps we have to follow a white rabbit, enter a night club, meet a hot 67,72,73,67,75 named Trinity and take things from there – which would be insanely cool. Or I could be completely wrong.

 Ten of us have been chosen as the “Starting Hand”, whatever that means. I don’t know which ten they are, mainly because I am still asleep. I don’t even know my name because my memory has been erased. All I know is I am rectangle-shaped and my back is blue. I am in the Fourth Column, covered by one other rectangle-shaped thing. There are 54 of us, and we have to somehow escape.

Ever heard of The Maze Runner by James Dashner? Or the movie of the same name directed by Wes Ball? The protagonist, 16 year old Thomas, wakes up in some intricate maze along with several other boys. He has to work out his role in their society (as does everyone else), work out the rules of the maze as they go along, solve a number of puzzles … only to find out once they escape there are more challenges ahead (it’s a trilogy after all so what do you expect?). Okay, that’s probably not the greatest analogy but it’s the best I can come up with right now. At least I am not a Slopper and there are no toilets to clean every day.

Apparently my name is Queen Of Hearts. Goodie – at least I’m a human. Most of my friends are numbers. 83,85,67,75,83 to be them. I’ve moved onto the Diamond King. It’s not the same suit, but at least I have someone to call a friend. I no longer feel alone. It also means I am further away from the dreaded Queen of Spades. She’s always grumbling about too much demand for something and not enough supply. Or the other way round. Whatever. I was never any good with Economics at School. I would later learn it’s not just her – everyone here often grumbles about cards of the same rank for some strange reason. <sarcasm> That’s what friends are for right? </sarcasm>

These guys are weird.

Okay I get it. Cards arrange themselves in descending order. At least that explains why the Kings and Jacks seem to treat me with respect. All the other spot-cards don’t seem to care much about me. I watch as the other cards gracefully dance around the tableau. Apparently they know the rules better than I do.

Just for fun, I try to scamper across to the adjacent column, onto the Ace of Diamonds. No – the laws of physics don’t like that, and I am immediately whizzed back to my original position. Rules are rules.

What the 70,85,67,75 was that?!?!?!? Ten new cards just popped out of nowhere! So that’s worse than I thought: if we don’t escape from this contraption then ten new cards will periodically appear every 5 minutes or so and eventually the whole place will get flooded – it’s probably not something I’d wanna think about … and I’ve just been covered by the King of Spades. I’ve heard plenty of bad stuff about them. They tend to appear at the worst possible moments. They sit on your face and stay there forever – or at least it feels like forever. I don’t mind the kings so much, but I much rather have their 65,82,83,69 next to me instead of on my face. At least there are no monsters in this world, unlike The Maze Runner.

Oh, and I’ve just noticed my twin sister has appeared in column 1. It then occurs to me: there are TWO decks of playing cards. I was expecting something like a single deck plus two jokers, and once the jokers turn up then Good Things Will Happen. Jokers can move onto any card, and any card can play onto a joker. But apparently they don’t exist in this Green Screen. At least empty columns seem to be useful: any card can use them, not just a king. That’s almost as good as a joker.

I scan the tableau. There are two-dozen cards yet to be turned. They don’t know the laws of physics that govern the Green Screen. They don’t even know their own name. The exposed cards are dancing around, apparently making no effort to free them. Ten more cards will magically appear on the tableau every 5 minutes or so. At this rate, they will never see the light of day, if you pardon the cliché. I was one of the luckier ones, having started near the top of a column. I was able to observe most of the proceedings so far. At least I have some idea of what’s going on.

“Stop moving around aimlessly!” I yell.

“We’re not moving around aimlessly!” said the Five, Four, Three, Two and Ace of Diamonds, all in unison.

“We need to come up with an overall grand plan.” I said “We need to consider the state of the whole board, not just a single col-”

“We’ll sort ourselves into suits first” said the Nine, Eight, Seven, Six, Five and Four of Spades also in unison. “Then we can take it from there”.

I watch as they gracefully leap from an empty column onto the Ten of Hearts. It now occurs to me why the cards were “wasting time” organising themselves into suits. In the early rounds, cards were able to move only one at a time; maybe two or three if we were lucky. In mistaking the trees for the forest, I succeeded in missing the details. I feel stupid.

Still, I think that there is some truth about “thinking about the bigger picture”. I start to wonder, what happens if we get a complete run from Ace to King, all in the same suit. I’m a bit rusty at Texas Holdem but I believe that is called a straight flush. The Club suit is looking good.

YOWZA!!!! All the Clubs have escaped! A triumphant C major chord pierces the dreary silence and fills us all with hope. Three suits to go, this should be easy as … no wait a minute. I’m still covered by the Jack of Clubs. My twin sister is still sitting in column 1. I remind myself there are two decks in this game. And we are still covered by a King. The King of Spades can move into an empty column, but for some reason he seems reluctant to do so. I guess we just have to wait then.

Okay, I get it now. Two decks of cards make 104. We started with 54. Every now and again, 10 new cards magically appear out of nowhere. After 50 cards are added, we have the right number to complete two full decks. Without two full decks, there is no way we can complete suits from Ace to King. So those cards appearing out of thin air are a blessings in disguise, if you pardon the cliché. I’ve finally figured this out. Who needs jokers when you’ve got the smarts like me?

Of course if more than 104 cards appear in play then we are REALLY 83,67,62,69,87,69,68.

“Off with the hearts!” I yell.

Everyone looks at me in disbelief. This isn’t the right time for a lousy pun.

“We have a complete suit from Ace to King”, I continue. “King-Queen-Jack-Ten in the second column, Nine-Eight in the right …”

“I’m not sure if that will work” said the Three of Clubs. “Even if it did work, it will cost three empty columns just to reach the 7 of Hearts in column 9”.

“There’s no choice. We’re gonna use up at least two columns to expose a card”, said the ace of spades.

“Even if it doesn’t work”, I say, “we still get to partially tidy up that mess in column 9 which is worth something. Spider is not all about turning over as many cards as possible”.

Yes, I just contradicted myself about earlier feeling sorry for the two-dozen face down cards that don’t know the laws of physics that govern the Green Screen. I get that.

The Nine of Spades leaps from column 2 into an empty column, taking the 8-7-6-5 with him. He is clearly eager for the Nine of Hearts in column 9 to take his spot on top of the K-Q-J-T of the same suit.

“Not so fast” says the Nine of Hearts. “The Spider Grand Master does not look kindly on 85,78,68,79,73,78,71 moves”.

“Who is this Spider GM you speak of?” I ask.

I shudder at the thought that we are being controlled by some “higher being” and we are pawns in a bigger chess game (or cards in a solitaire game if you wanna take things literally). Then again, if there is a higher being who is a GM at Spider Solitaire and he is playing to the best of his ability then that can only increase our chances of winning. So perhaps we shouldn’t be complaining.

The Jacks, Queens and Kings engage in a long discussion. This is a critical point in the hand. Make the wrong decision and we are trapped forever. All the little cards shy away from discussion: they are unable to visualise a long complex sequence of moves. They know full well it is better to remain silent and be thought a fool than – well you know the rest of the cliché!

“Okay, I’ve got this”, I say. “Queen of spades goes to King. Rearrange cards so that we have Nine through Ace in column 9. Clear the hearts, dump the six of diamonds to an empty column. We still have one empty column left. Swap Ace of Spades with Ace of Diamonds, move the 3-2-A onto the 4 of spades, four of hearts onto 5 of diamonds … Oh 67,82,65,80, we don’t have an eight.”

“Yes we do”, says the Eight of Clubs in column 2.

Of course we do. We cleared the hearts. Duh.

We execute the plan. Fortunately we have visualised everything correctly and things go as expected. I no longer feel stupid. I farewell my twin sister as her suit gracefully whizzes to the bottom left of the Green Screen. Only six more triumphant C-major chords to go and we are done. Looks like we got this!

As expected there are no further difficulties and victory is a mere formality. Just for fun I do a little endgame calculation. There are ten cards missing. As long as nothing stupid happens like all even cards on the last deal …

  Clubs = A4 Diamonds = 67TJ, Hearts = 2, Spades = 3JK. Yep, this is a lock.

“So what happens after we win?” asks the Eight of Clubs.

“Well, we go back to the physical world as plastic cards”, I reply.

 “Would we become inanimate objects?”, asks the Nine of Spades. “Would we lose the ability to talk to each other and move around according to certain rules”

“Perhaps,” the Three of clubs says, “we would be fondled by grumpy old computer-illiterate farts in a retirement village who only know how to play Klondike.”

Always the cheery one, I think to myself. Maybe going back to the real world ain’t what it’s cracked up to be after all.

“Or perhaps,” adds the Two of Diamonds, “one of us gets a 68,73,67,75 pic after a bad beat in Texas Holdem.”

The Seven of Hearts gives the Two of Diamonds an oh-so-polite wink. No card higher than a Nine is amused.

I rest my case.

At this very moment, the last ten cards magically appear onto the tableau. We easily clear the remaining suits and win the game.

Some lame music plays and two pills immediately appear on the table. I’m supposed to choose one and swallow it. The Orange pill means we all stay in the Green Screen. The Blue one means we go back to the real world as inanimate objects. Both options 83,85,67,75.

I hold one pill in each hand and recite to myself: “Eenie meanie minie moo, smoking very bad for you, drinking is bad for you too, eenie meanie … ah 70,85,67,75 it”.

In one last act of defiance, I swallow both pills simultaneously. Hah!, bet they didn’t think of that did they? A burning sensation sizzles my tongue, and I feel ill. I feel the system crashing about me, as I teleport to God-knows-where. The colour drains from the Green Screen and I throw up. I believe it’s called a technicolour yawn except it looks more like 50 Shades Of Gray. Okay, I probably shouldn’t have done that.

THE END … or perhaps not?

OKAY THAT PROBABLY DIDN’T WORK

So there you have it. There’s probably a reason or three why I haven’t won any meaningful short story competition yet. But at least I had a go. Do you guys think I have potential as a budding short story writer? Or should I stick to just playing Spider Solitaire to the best of my ability, and leave the writing to the Short Story GM’s? On second thoughts, if I can improve your win rate at Four-Suit Spider by a substantial amount then I don’t care how lousy my short story is bwahhahahahahahahaah 🙂

An example start position

Okay, so I ascii2word([70,85,67,75,69,68]) up. Apparently WordPress automatically converts xx-xx-xx-xx to hyperlinks (e.g. thinking it represents an 8-digit phone number). So instead of writing xx-xx-xx-xx I shall use the notation ascii2word([xx,xx,xx,xx]) instead.

EDIT: This is only relevant for mobile phone devices

By this stage the impatient reader probably wants to see some “action”. Here is a possible starting hand in Spider:

Let us try to find the best move in this position.

I recommend that a beginner player should start by asking the following questions: (i) how many cards are we guaranteed to turn over even if the worst possible cards turned up? Another useful question is (ii) What are the chances that the first new card turned over will be “good”? We will take good to mean “increasing the number of guaranteed turnovers”. Of course there is more to Spider Solitaire than counting guaranteed turnovers but if you’re a beginner then simplicity is the mother of self-improvement … or something like that.

Strictly speaking, it isn’t necessary to ask these questions to arrive at a good first move in the start of the game. If the first two columns are 3-4 of Hearts, then you could move the 3 onto the 4 regardless of the other eight columns: if it’s not the best move then the difference is small. But these questions will be good practice, and it will come in handy as the game progresses.

I hope you answered “Four cards” for the first question. Ignoring suits for now, we have J-0-9 for two turnovers, 7-6 for a third turnover and finally 4-3 for the fourth. Obviously we can’t count multiple turnovers for the three Sixes since we can’t stack them onto the same Seven without violating the laws of physics! Similarly, we only count one turnover for two Nines. Assuming we don’t ascii2word([70,85,67,75]) up the move order, we will turn over at least four cards before being forced to deal another row.

For the second question, there are 13 possibilities for the next exposed card (if we ignore suits). An Ace is clearly useless since we have no deuces, but a deuce I’d like to see since we have a three … okay that’s probably not the best way to start a rap song, but you get the gist.

Continuing in this fashion we get the following good cards: 25780Q. The chances of getting a good card is therefore 6/13. Note that 5 and 8 are especially good since we get two new cards instead of one. But the question defined good as “allowing at least one extra turnover” and it didn’t ask for “how good”. Assuming you have completed Year 3 or better in school, you should know by now that it is always wise to make sure you are answering the correct question! The observant reader may have noticed an error (okay, maybe one-and-a-half errors) in the above calculus. Before proceeding further I invite the reader to figure it out. To protect against accidentally reading spoilers I have inserted an image consisting of happy stars and blank spaces. Each happy star represents a point I obtained for a short story competition I entered some time last year, with a maximum score of 100. Unfortunately I didn’t win anything, not even a Honorable Mention. Perhaps the judges secretly docked 5 happy stars for the protagonist’s terrible Dad joke but we’ll never know. ascii2word([70,85,67,75])!!!!!

The first error is I have assumed each of the 13 cards from Ace to King occur with equal probability. This is not correct since we already know e.g. there are three Sixes and no Fives visible. Hence Fives are much more likely than Sixes. The probability of 6/13 is therefore only an approximation of the true probability of getting a good card. As a general rule, failing to take into account cards already exposed will almost always underestimate the true probability at the start of the game. With only 10 cards exposed, this error will probably not contribute much to All The Problems In The World As We Know It.

The other half-error is we must choose our move before seeing the next card and this may affect our chances for the worse. For instance, suppose we move the Ten in column 8 onto the Jack in column 5. Any Queen is no longer a good card unless the 10 and Jack are the same suit. Fortunately we are in luck here since they are both diamonds. This is why I only counted 1 and a half errors instead of 2. Clearly, moving the Ten onto the Jack is good because we “don’t lose any outs”.

Note that if we moved the Three onto the Four we don’t lose any good cards despite it being off-suit, since if we draw a Five it can still be played onto a Six. But obviously we want a Five to be “very good” (two new cards) instead of “just good” (only one card). This might sound overly technical, but this kind of deduction must become second nature if you aspire to kick ascii2word([65,82,83,69]) at Spider.

Okay, this example fails the Duh Test since one can arrive at the best move by observing it’s the only move that builds in-suit. But my point was to illustrate the concepts of counting guaranteed turnovers and calculating outs.

FUN FACT: Assuming perfect shuffling, a player should have on average 3.96 guaranteed turnovers at the start of every game.