Game On (13 June 2021, Alternative Version)

“I think I have discovered the secret of playing well at Four Suit Spider Solitaire,” says the Cat. “I can win about 99% of the time.”

“How is that possible?” asks the Wise Snail. “Our best player is the Eagle, but she can only win about half the time”

“Well, there are many secrets to winning about 99% of the time,” replies the Cat. “The first secret I will like to talk about is minimum guaranteed turnovers. Expert opinion says on average you should have just under 4 guaranteed turnovers if the cards are dealt randomly. But I think it should be significantly higher.”

“How do you make it higher?” asks the Elephant.

“Let me show you,” replies the Cat. The Cat quickly deals another hand. The initial state is shown below:

“Yes. This is a good example,” says the Cat. “Observe that we start with two Jacks and one Queen. Ignoring the other cards for now, most experts will say this is worth one turnover – either the Jack of Hearts or Jack of Spades can move to the Queen in column Three. Most players will choose the Jack of Hearts for obvious reasons.”

“So far so good,” says the Lion.

“Now I want everyone to close their eyes,” says the Cat. “The Wise Snail will count to fifty and then everyone can open their eyes again.”

“Now I have two turnovers: I have superimposed both the Jack of Hearts and the Jack of Spades onto column 3 revealing two cards in columns 7 and 9.”

“This is revolutionary!” says the Dumb Bunny. “I wonder why nobody has ever thought of this before. I like it!”

All the students nod in agreement with their eyes wide shut. The Cat continues to move some cards around. Meanwhile the song I’m A Believer by Neil Diamond can be heard in the distance. Yes, The Singing Monkeys don’t have the best voices but my students are used to that by now.

At last, the Wise Snail reaches fifty and everyone can open their eyes.

“Cat is sus,” says Purple. “As far as I can tell, there are only eleven cards exposed. The Cat has made a solitary move: Jack of Hearts from column 7 to column 3, revealing the other Queen of Hearts.”

“Yes, it appears I have only made a single move,” replies the Cat. “But I also know that column 9 contains King of Diamonds beneath the Jack of Spades. Column 7 starts with Jack of Hearts, Queen of Hearts, Two of Diamonds, Seven of Clubs. Moreover, it is possible to get an empty column – ”

“But how would you know all this?” asks Orange. “You must have cheated!”

“And remember,” yells the rot13(fzneg nff), “the first rule of Spider Solitaire Club is you do not play with undo. The second rule of Spider Solitaire Club is you DONOT … play with undo!”

Purple immediately calls a meeting. A plurality vote is held and all twelve colours from Among Us decide that Cat is indeed sus.

“Sorry I’m late – hey rot13(jung gur shpx?)” I say. It takes me less than three nano-seconds to observe the Elephant has grabbed the Cat with his trunk and is about to hurl the poor thing in the direction of The Singing Monkeys. It doesn’t take long for my students to explain what happened.

“I know I normally don’t play with undo,” I state matter-of-factly. “But I wish to remind you that playing with undo was absolutely necessary for me to publish my paper on Spider Solitaire. And without this paper, I wouldn’t be maintaining this blog – which you are all part of.”

It’s a process, but I am able to eventually convince the Elephant to release the poor Cat. Also, in future when I am late nobody is allowed to give impromptu lessons during my absence.

Nobody ever hears from the Cat again. On the very next day, an unpleasant rumour starts spreading: the cat has somehow been poisoned. Unable to confirm any details, I can only assert that she is simultaneously dead and alive.

The End

Game on (25 April 2021, Alternative version)

Once upon a time, there lived a dude named Abraham Maslow. He kept to himself and had few friends. He brushed his teeth three times a day and only drank orange juice and water. His grades weren’t brilliant – then again he wasn’t terrible either. But like most folk at University, he found the lectures were boring. He was okay with Statistics, but would frequently ask himself why he signed up for Commerce and Law subjects. And the less said about Psychology the better. He would much rather spend time playing good ol’ Spider Solitaire.

During his early years he fantasised about obtaining long suited runs of cards and clearing entire suits before the third round of the stock was even dealt. But over time Maslow realised such wild dreams were only for mediocre players who never progressed beyond the Two-Suited version of the game.

There were no really good books on how to achieve awesomeness at Spider Solitaire so Maslow had to work everything out by himself. After much self-study he developed a “Hierarchy of Wants” for the aspiring Spider Solitaire player. At long last, Maslow found he could beat Four-Suit Spider Solitaire about 40% of the time without rot13(haqb).

Maslow’s Hierarchy of Wants

Maslow’s theory suggested players often made two types of errors. Type I errors involved a player only focussing on stuff at the bottom of the pyramid. This often resulted in a player having no idea how to convert an empty column plus a handful of in-suit builds into victory. Maybe the game state rot13(fhpxrq) so badly in other respects so as to render the initial gains worthless. A Type II error occurred when a player laid too much emphasis on grand plans and triumphant C-major chords whenever a complete suit was removed (at least in the Microsoft Windows version). In other words, a winning player should be building on a solid foundation (hence the pyramid) before he starts thinking about the grand plans and triumphant C-major chords.

Typical flow charts for players committing Type I (top) and Type II (bottom) errors

Finally, Maslow realised that once the player obtained a decent win rate at the Four-Suit level sans rot13(haqb) he or she could attain further self-fulfillment with the attainment of cheevos, as described in a previous post.

Maslow gave the following example of Hierarchy-of-Wants in action. Maslow noted that the game-state allowed only one guaranteed turnover, and there is a desperate want for empty columns. There are few in-suit builds and only one run of three suited cards (in column 3). Therefore, the player should ignore the fact that the entire Heart Suit is visible except for the Four.

Maslow gives an example in his famous 1943 paper

After the usual cycle of constant revisions and rejections, Maslow was finally able to publish what was to become his famous paper “The Psychology of Achieving Awesomeness at Spider Solitaire”. And everybody lived happily ever after.

Awesomeness has been achieved!

I have finally achieved awesomeness! My Spider Solitaire Sudoku puzzle has been featured on Cracking the Cryptic.

For those who are interested in the puzzle only, here is the grid: if you’ve played any Spider Solitaire the rules should be guessable – and if you get a unique solution then you know you’ve guessed correctly 😊 But if you’re interested in the back-story then please read on.

If you follow this blog regularly, you are probably aware of a paper I published some time in 2019. I showed that a particular Spider Solitaire server was biased: if you win too many games then future games will have the cards stacked against you – and one could “prove” this using Statistics.

I use quote marks because the nature of Statistical testing always implies some degree of uncertainty. For instance if you are 95% confident of a hypothesis, then there is a 5% chance you made an error. But it is commonly accepted practice. If your experiment is sound and you get a sufficiently small p-value then go ahead and publish it anyway. You may be wrong, but – to put it in Poker terms – your results pretty much force you to call all the way to the river. If you are beat then you are beat.

Of course, getting the results you want is only the first step. We all know the academic publishing model is broken. The peer review model is hopelessly flawed. At best, peer review is based on good intentions and met the demands of research scientists 30 years ago – but certainly not today. It already takes long enough to get accepted into a mediocre journal, or even the dreaded arXiv. If you’re that desperate you might be willing to spell arXiv backwards. And don’t get me started on predatory journals. I won’t describe the ills of academic publishing in all its gory detail. Someone else can probably explain it much better than I can. In my case I ended up publishing into a high school journal. Parabola from UNSW to be exact.

But at the end of the day, publishing is essentially “a way to prove or showcase your research skills”. Once you complete your thesis (or minor thesis, 3-month vacation employment, etc) and may or may not be a major component of your career depending on your employment. (It is true that my Spider Solitaire paper is not relevant to my job, but that has nothing to do with the Fundamental Theorem of Calculus.)

Still, the Parabola publication still wasn’t entirely satisfactory. My paper wasn’t truly a publication. It was a story. I wanted to tell a story about how a certain Spider Solitaire was broken. There is nothing intrinsically wrong with Parabola (with the possible exception of some really lame comics and puns), but try telling that to the average Joe Bloggs with an average job, has little aptitude for mathematical puzzles and swears by Nova FM. In fact, telling this story was the original motivation for me starting this blog in the first place.

Scientists don’t have a way of getting their work recognised. They have no way of “controlling the narrative” if you will. I can publish a paper in some journal. Or I can post something on a blog and have all the scientific evidence to back it up. But how many people are going to read it, let alone believe it?

Enter Cracking the Cryptic.

You may have already guessed I am a fan of CtC (not necessarily because of this blog!). I was vaguely aware of it last year. It seemed to be massive in the UK.  I tried one of the harder puzzles. Solving it was beneath my dignity – after all I scored a silver medal in the 1995 International Mathematical Olympiad. Okay I get it. There’s a pandemic going on. People are struggling in the UK. Some viewers have even commented on YouTube how watching episodes of two people solving Sudoku puzzles helped their mental health issues. I’m living in Australia not the UK. Australia really is the lucky country, so who am I to judge?

I then stumbled on this puzzle by Lucy Audrin.

This is a “Sandwich Sudoku with a twist”. Before solving the puzzle Mark briefly mentions Lucy’s website and eventually finishes the puzzle in just over 15 minutes.

You read that right. Lucy wanted to draw attention to her website. All she had to do is submit a half-decent puzzle to CtC and Mark will take care of the rest. To be fair her puzzle is more than half-decent and a good illustration of how one can keep the puzzles fresh by tweaking various rulesets (such as thermometer, anti-Knight, XV, arrows etc). If Simon and Mark only did classic Sudoku every day of the week, CtC would have finished long ago. I should also mention that Lucy can write much better stories than I can!

Great – if Lucy can draw attention to her website then perhaps I can do the exact same thing with Spider Solitaire.

This was much harder than anticipated.

It would surprise nobody if I claimed I could construct a correct Sudoku puzzle with a unique solution and Spider Solitaire theme. There was one obvious hurdle: if I submit my puzzle and it gets rejected – then good luck trying to resubmit the same puzzle a second time. I decided to play it safe by first submitting “test puzzles”.

It was a long process. Essentially I needed to “play the networking game” and gradually build up reputation. I spent a significant amount of time testing puzzles by other setters, joining the Discord server and chatting, signing up for Patreon, creating my own puzzles, etc. I submitted the above Spider Solitaire paper to the Discord a few months ago, but eventually realised that was not the same as submitting directly to CtC (submitting to Discord only means CtC have permission to do it, if it gets nominated). Yes, networking really did make things a lot easier in the long run. If you play nice and do all the right things then eventually people will help you when you need them to. If Sudoku is your thing then I heartily recommend you join the discord server. Great people, great puzzles, great jokes and cultural references. Occasionally somebody may attempt to pull off a rick-roll. What’s not to like? 😊

I emailed CtC my puzzle earlier this week and finally my luck was in.

So there you have it. If you follow my blog regularly, then I hope you enjoyed the journey as much as I did. Until next time, happy Spider Solitairing 😊

Time to spill the beans I guess

I guess it’s time to spill the beans (though avid readers of this blog may have gathered already):

spillbeanspic

Earlier this year, my Spider Solitaire paper was published in the excellent journal Parabola, a mathematics journal aimed primarily at high school students. In this paper I showed that a particular Spider Solitaire server is biased: If a player wins too often the cards will be stacked, making it harder to win (assuming I did not “hit” the 1 in 20 chance of incorrectly rejecting the null hypothesis). I do not know why or how the server does this, but perhaps that will be the subject of a future post 😊 What I do know is the Spider Solitaire server in question is very badly designed. The company in question does a number of card games involving the well-known Klondike, Freecell and the like. if you look past the beautiful graphics, sound and animations, the server has a number of “fundamental errors” such as not knowing almost every game in Freecell is winnable or that every tile in MahJong Solitaire should appear exactly 4 times. Once upon a time I played 24 games of Spider Solitaire after resetting my stats. I won 50%, had a longest winning streak of 8 and a longest losing streak of 1. Go figure.

I kid you not.

The key observation I made was that making random moves is sufficient to beat 1-suit solitaire without undo more than half the time. Ergo, we can estimate the difficulty or a particular hand by repeated simulation. If the game is played at 4-suit, we can still estimate the difficulty of a hand by pretending it is 1-suit. All this requires that we are able to determine the identity of every unseen card in the initial game state.

In my experiment, I bought a new computer (to remove the possibility that the computer already knows I am an experienced player). I played 40 games, because that provides a reasonable amount of data without being too onerous (I definitely want my experiment to be replicable for less experienced players). I deliberately used undo to ensure that every game was won (and also to record the identity of every unseen card). To test whether games get harder, I computed the probability that of two randomly chosen games the latter would be more difficult than the former. I found the result to be statistically significant at the alpha = 0.05 level.

I highly recommend Parabola for the serious mathematicians among you. The feature articles are very well written. The problems are somewhat beneath my dignity (but what do you expect given I competed in the 1995 International Mathematics Olympiad and composed my own problem for 2016?) but I can see how they are intended to make high school students enjoy mathematics. High school teachers will definitely want in on this. Yes, I thought that Square Root of Negative Pun and 2Z or Not 2Z are a bit weak (at least with Bad Chess Puns you get to sharpen your tactics), but overall I think Parabola has much to recommend it.

badchesspuns-image

For me, the most pleasing aspect of this paper was how I was able to combine various “elements” such as statistics, random walks, basic Spider Solitaire strategy etc and combine them into a harmonious whole, resulting in something more awesome than my Flappy Bird cover of the Wintergatan Marble Machine. In closing, I will leave the final word to Thomas Britz, editor of Parabola: “In each their way, these items remind me of some of the many reasons for why I love mathematics: maths is elegantly useful and usefully elegant; it is beautifully surprising and surprisingly beautiful; and it provides insights into connections and connections between insights. It challenges; it entertains and it provokes much humour.”

Artificial Stupidity in Chess

You may remember some time ago I discussed an algorithm for Spider Solitaire that is not very good: it simply outputs random moves. It turns out somebody did a much better job in the game of chess. Some dude designed no less than 30 Artificial Stupidities and organised a Tournament of Fools, and published a number of papers in SIGBOVIK. Ideas for weird algorithms include color preference (e.g. White prefers to play pieces onto light squares), random moves, blindfold algorithms (simulating a novice trying to play blindfold), algorithms based on mathematical constants like π and e, single player (pretending opponent will pass) and linear interpolation between Stockfish and some other lousy algorithm (e.g. choose Stockfish’s best move with probability p, lousy move with probability 1-p. But my favourite algorithm was the Mechanical 68,79,82,75 that proved a forced win for Black after 1 d2-d4?? a7xd4!! checkmate 🙂

You can watch all the fun in the video below:

I’m not sure if these ideas will be applicable to Spider Solitaire. Color Preference is easy since we can prefer to move red cards or black cards, and single-player is even easier given the nature of the game, but I am not aware of any equivalent of Stockfish. Mathematical constants should be easy but probably not very interesting. It may be possible to simulate a blindfold (human) player who struggles to remember every card, but I’m, not sure how to do that yet. And I don’t know of a (sensible) variant of Spider Solitaire where all the red cards are replaced with chess pieces. Since Western chess has Black vs White, it may be more appropriate to use Xiangqi, which has Red vs Black pieces. Perhaps something to think about for next time.

Thanks to my good friend Tristrom Cooke for the heads up.