# Math Just Got Weird

TreeCardGames, the rogue Spider Solitaire company that started it all, is resembling the number 3, back in the spotlight and losing its religion. This time the subject is manipulating reviews.

We’ve all seen a number of game companies that were somehow born to suck, could never release a half-decent game, and figured the only way to make a presence is to fudge the reviews and make them look better than they really are.

There are many ways to game the system, terrible pun notwithstanding. You can cherry pick the good reviews and hide the bad ones. You can write a review for your own game by posing as a customer. You can create bots to sing the praises of Hero Wars or whatever your rot13(cvrpr bs fuvg) happens to be called. You could give players chance to give a 5-happy-star review for 10 extra coins after beating every single level. If you were the CEO of Shay Dee Games, then you could demand your employees do one or more of the above. It’s been done before, and googling is left as the proverbial exercise for the reader. The possibilities are endless – you can pretty much do anything, provided it obeys the laws of physics.

Treecardgames has a small number of reviews that can literally be counted on the fingers on a single human hand. We can see the scores are 1,1,1,2,3 and yet the overall score happens to be 2.6.

I’m not sure where the 2.6 comes from. It certainly ain’t the mean or median. I doubt it would be the skew or kurtosis. It might be some fancy formula I’ve never heard of, such as computing the arithmetic and geometric mean, calling them foo and bar, then computing the arithmetic/geometric mean of foo and bar, rinsing and repeating until you converge to the limit. Maybe some of the scores are “doublers”, an idea borrowed from Cracking The Cryptic. Then the math would actually work, if you apply doublers to the right scores.

Maybe TreeCardGames was thinking if there were about 500 reviews with an average score of 1.6 then they could pretend the average score was in fact 2.6 and then the average reader will be too lazy to verify the math were correct/incorrect. But as you can see, this is not a viable dodge.

Unless I hear back from TreeCardGames explaining how to derive an overall score of 2.6 given individual scores of 1,1,1,2,3 this is one more entry to the list of reasons why rot13(GerrPneqTnzrf fhpxf!!!!!). For what it’s worth, I think the overall score should be -11123 out of 5 and deriving the number -11123 is left as an exercise for the reader.

Have you come across similar examples of hilariously bad calculation of overall scores? Bonus points if the correct overall score is LOWER than the given overall score 😊 Let me know in the comments!

# The Things That Really Matter

Now that the year is drawing to a close and holidays are upon us, I now have time to revisit the things that really matter in life, including the Royal Game.

Some time ago I uploaded my Ninja Monkey code to GitHub (my username is hilarioushappystar) and now I wish to discuss this in more detail.

To generate a “result” I need two seeds which I call “Game seed” and “Monkey seed” for lack of better alternative. Let us assume a pair of seeds is written as (g,m), where g and m represent the game and monkey seeds respectively.

The game seed determines the initial position. The monkey seed determines the monkey’s behaviour. For instance, if the seeds are (27, 1) then the monkey would always start with the move “ca”, but if the seeds were (27, 2) then the monkey would prefer the move “cb” in the same starting position.

The screenshot below shows a game seed of 27 and a monkey seed of 1. The monkey loses with 24 face-down cards remaining. I do not claim this to be a paragon of virtue from a software engineering perspective.

Of course, the result is pseudo-random in the sense that with game seed = 27 and monkey seed = 1 the monkey always loses with exactly 24 facedown cards. At least that’s the result I get on my machine. Your machine may yield different results, but if your monkey loses with e.g. 16 face down cards the first time then it should lose with 16 face down cards every time.

Here are my results. Note that the game seeds are not indexed from 1 to 20. By using different seeds for monkey and game, I reduce the chances of confusion when trying to reproduce these results.

Note that these results encode the result of the game: if there is at least one face down card remaining the monkey must have lost. I assume the monkey always wins if it manages to expose every card in the tableau (otherwise I could always put an asterisk next to a zero if the unthinkable happens).

We can make a few observations:

• Out of 20 games, there are 5 hands where Monkey scores one victory. For the other 15 hands the Monkey never wins
• These five wins appear in only two columns. This is a statistical glitch and there is no logical reason why two games with same monkey seed and different game seed should be correlated. I blame the small sample size 😊 (about the only utility of columns is to assist in reproducing the raw results).
• Some hands look really bad. For instance in game 214 the Monkey always has at least 20 face down cards at the end of the game.
• Other hands look promising, for instance in game 484 the Monkey as at most 14 cards remaining

This is an example of an “exploratory analysis” (as opposed to explanatory analysis). I’m trying to get familiar with the data and I don’t have a specific hypothesis that I’m trying to prove. Of course, the more data you collect, the more chances of finding something interesting. For instance, I could have chosen to have 15 monkey seeds instead of 10, or 50 game seeds instead of 20.

Once you have completed your exploratory analysis, you might be able to form a concrete hypothesis about a spider program which you suspect to be dodgy. For instance, suppose that Shay Dee Games releases a new version of the Royal Game and we find that in every hand, either the Monkey consistently gets 10-or-less cards face-down or consistently gets 20-or-more cards face-down at the end of the game. We would suspect something is amiss, even if Shay Dee has the “correct” average win rate computed over all games. Of course, all this assumes we are able to determine the identity of every face-down card.

When testing a concrete hypothesis, things start to get technical. T’was brillig slithy toves gyre gimble wabe blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah Kolmogorov-Smirnov test blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah – or if you want the less technical version, yes we have formally proved that Shay Dee Games is indeed rigged.

Note also I have omitted certain stats. For instance, I could have recorded the maximum number of empty columns obtained at any stage of the game, number of suits removed or the number of levels in Toy Blast I manage to beat before the monkey finishes the game. I have also omitted discussion of specific programs that I suspect to be biased. The important point is the reader has something to go on if he wishes to investigate the veracity of a specific Spider Solitaire program.

Until next time, happy Spider Solitaire playing!

# treecardgameS develoPs exclusive gAmes with your fun in Mind

News update: I just checked my spam folder and found EXACTLY WHAT I NEEDED: an excuse to post something meaningful in my Spider Solitaire blog after it ran dry for more than a month. I should probably check this folder more often from now on.

The word “SPAM” can be obtained by deleting the appropriate letters in the title of this post, but the word “HAM” cannot (rearranging letters is not allowed). Therefore, I have classified the image below as spam.

For what it’s worth, TreeCardGames is the software company that started it all.

Has anyone come across similar spam messages that are related to the Royal Game? If yes, how did you deduce it was spam? Let me know in the comments 😊

# Spider 99 Should Be A Thing

If you’ve read this blog during the last few months then you probably know I like to spice up the Royal Game by mashing it up with other games such as Backgammon or Among Us. I’ve now decided to take it to the next level by combining the Royal Game with Tetris 99.

For those unfamiliar with the concept, Tetris 99 is an insanely cool game from the Battle Royale genre. The aim is to be the last one standing. Your playing arena is at the centre of screen, and you have 49 opponents on your left and another 49 on the right. Doing the math is left as an exercise for the reader. You can clear lines and send them to opponents, and they can return the favour. I thought it would be even cooler to have Spider Solitaire instead of Tetris, if only because both games have exactly 10 columns in the tableau.

If I were tasked with designing Spider 99, I would start with one-suit only, as shown in the diagram. After all the game is supposed to appeal to a large audience (presumably most of whom will be novices). Besides there won’t be much time to strategize for complex move sequences. Clear a suit and you get to damage other players by forcing them to prematurely deal a fresh row of 10 cards. You can get combos by e.g. clearing suits for two or more moves in a row. And don’t forget your opponents will be looking to do the same to you 😊 You can change your “settings” to target random opponents, opponents close to dying, or opponents who are attacking you. If you K.O. somebody then you win badges and your attacks become more powerful. If you top out by having too many cards in a single column then game over. Technically, it should be “bottom out” since unlike Tetris 99 stacks start from the top not the bottom. But you know what I mean.

Once you get down to 50 players remaining we can up the difficulty level by moving from 1-suit to 2-suit. And of course, 10 players remaining means we get the dreaded 4-suit level. And before you ask … rot13(haqb) is not allowed. The original Tetris 99 music is one of many reasons why that game is awesome and I see no reason to change it.

Unfortunately, I don’t have the smarts to program Spider 99 by myself, so this will remain as a thought experiment only. But at least I have a reason to add a new post to my blog. 😉 Of course if you have any other insanely cool ideas for mashing up anything with Spider Solitaire then please let me know. Until next time happy Spider Solitairing.

# The Chess Scandal Everyone Is Talking About

With the Sinquefield Cup finally over, I think now is a good time to give my thoughts on the scandal.

Strictly speaking, this doesn’t really belong in a blog that purports to talk about the Spider Solitaire, the whole Spider Solitaire and nothing but the Spider Solitaire, but I believe that Chess and Spider have (at least) one thing in common: strong players always get the raw end of the deal when it comes to cheating accusations. Besides, I have an IM title or better in both disciplines 😊

The basic problem is strong players just “know” when something is off – but good luck expressing the word “know” in language that a layman and understand and a lawyer cannot argue with. I count myself lucky I was able to actually prove that dodgy Spider Solitaire servers do exist.

Here is my opinion on the whole saga – which I have listed in dot point form. I will not attempt to justify these dot points. No doubt every man, dog and millipede on the planet has formed their own opinion on the matter. Googling various facts and coming to your own conclusions is left as the proverbial exercise for the reader.

• Niemann is an rot13(nffubyr)
• Niemann should never have been invited to play in the first place
• Niemann has form when it comes to being an rot13(nffubyr) and cheating
• Carlsen has good reason to withdraw, even without evidence of cheating. If cheating is proved then that is icing on the cake if you pardon the terrible cliché!
• Carlsen doesn’t owe anyone an apology or explanation. If the tournament organisers wish to defend 2+2=5 (i.e. invite Niemann) that’s not Carlsen’s problem. Maybe Carlsen could have handled things better with hindsight, but his options weren’t great to begin with.

FWIW, I have a proposal for solving the cheating problem in chess, called the Useless Task Protocol. This is an attempt to give more “bargaining power” to the experts. Again, I will not attempt to justify the motivation behind this protocol and leave it as an exercise for the reader. If you can see where I am coming from, then chances are you have the right analytical mindset to excel at Spider Solitaire 😊

I wish to propose a new rule for competitive chess:

That’s all there is to it. Just move your king towards the centre and leave your opponent with the “know-what’s-coming-but-can’t-do-much-about-it problem”. It doesn’t matter if you resign, get mated or your opponent starts playing random moves. You could have a dead drawn (or indeed a winning) position and still elect to call opponent for cheating. You can take a punt, knowing the worst that can happen is your game is counted as a loss. You could end up looking like a goose but there is no possible universe where can you get sued for defamation.

If your king can’t (legally) reach the centre, you can still call your opponent if you’re willing to risk heavy penalties for a false alarm. Conversely there is no compulsion to call opponent for cheating if your King is on e4 but you believe your opponent is legit.

I proposed this rule after the cheating scandal involving Nikhil Kamath and Vishy Anand, but nobody took it seriously. I do not claim it’s a perfect solution, but something worth mulling over. The diagram above shows a plausible position that might have arisen if the Useless Task Protocol was being used (I would recommend White should wait for Black’s next move before stopping the clock).

# Steve’s Game – Summary

This was a well-played game by Steve. There were no major inaccuracies and he overcame a difficult start. He kept himself in the game and only after dealing the final 10 cards he had a good position for the first time. And he duly converted. Of course I would bet my Ph. D. thesis to a brick that Steve cherry-picked that game out of over 300+ games to demonstrate it’s possible to win even with a bad start. It is highly likely a fair percentage of Steve’s victories were walkovers after a good start.

There were a few inaccuracies like not realising he can get another in-suit build at no cost, or missing the fact some column had a 5 missing (easy to do when you have a sequence like 8-7-6-4-3-2-A). But there is no individual play that screams “ThIs GuY cAnNoT pOsSiBlY bE a GM”. If I had to give a single pointer for Steve to improve his game even further, I would choose the concept of “good and bad shape in individual columns”.

Steve has a good feel for the game. He can anticipate the Job 38:11 problem several moves in advance, and either he will find a way around the problem or at least avoid acting surprised when it does hit. He does not explicitly mention “one-hole-no-card” – but that’s merely one of many ways of explaining a concept that Steve is no doubt familiar with.

Steve was unable to get close to removing a suit before the last round – but not for lack of trying. The card gods decreed there would be no reasonable prospect of doing so before the last round – and then Steve showed his skill when it mattered most:  he found a plan that guaranteed the removal of a complete suit. It was relatively straightforward to verify removing the suit was not a trap, and victory was a mere formality.

The process of finding the correct plan at the start of round 5 is not trivial, and admittedly I glossed over that. Steve gives plenty of examples of finding a good plan in complex positions in other chapters of his book. I recommend you get the book (if you haven’t already done so) and study his thought processes for the examples given by him.

As for Steve’s book, my main criticism is that his notation for moves is very unwieldy. Yes, I get that he is trying to explain important concepts like “breaks, doors, locks, delaying, etc” but I am pretty sure there is a way to get his message across without resorting to clumsy notation. Apart from that, the entire book is an extremely useful resource for someone who is serious about improving their game.

## Overall Strength

Overall, I would say Steve is GM strength, or close to it. Unfortunately it’s difficult for me to judge properly unless I had access to the moves in all of the 306 games he played.

# Steve Brown’s Game: Round 5(2)

I will only give the general plans and avoid giving exact move sequences. Verifying this is all legit is left as the proverbial exercise for the reader.

As a general rule, being able to visualise long move sequences is an essential ingredient to playing well at Spider Solitaire. If you struggle with this, I recommend you play with “pseudo-undo” i.e. undo is allowed provided you don’t gain information you’re not entitled to by turning over a card or dealing from the stock (note that removing a suit does not gain information). If you pardon the terrible cliché, practice makes perfect!

Another useful tip is this sort of situation is to start with the following question: “Can I remove a suit if I were willing to trash my board in every way possible?” If the answer is yes, then a more careful analysis will often yield a way to remove a suit without trashing up the board so badly. Of course, there are cases where prematurely removing a suit does cause the loss of a winnable game – but if you’re able to find a move sequence that completes a suit, then you should be good enough to work out if removing a suit is desirable.

• Clear columns 2, 3
• Extract the C4:Kc
• Expose the C0:7h
• Clear columns 7,10
• Order column 8
• Tidy up
• More tidying up

By this stage even my Ninja Monkey friend is claiming the game is won.

The rest of the game is just a formality so the moves are omitted. The identity of the remaining face-down cards are available in the screen-dump below:

And that brings us to the end of the game. Well played Steve!

# Oops – We Digress Again

## Quiet Quitting

Recently I came across the term “quiet quitting” when googling/facebooking on my mobile phone. Wikipedia defines it as doing exactly what the job requires, not more or less. It is also known as “work to rule”. QQ is related to the concept of lying flat or Tang ping, not to be confused with planking.

If you’re unfamiliar with quiet quitting, your first thought could be “rot13(jul gur shpx) is it called quiet quitting?!?!?”. That was my first thought as well. I was even on the verge of asking this question on Facebook, but my gut told me not to bother since several others must have done the same by now.

After searching various sources, I concluded quiet quitting was a term invented by some rot13(ceb-ohfvarff nffubyr) trying to push a narrative that employees are lazier and more entitled than what they really are. Although to be fair, “work to rule” does have a whiff of rot13(junggurshpxrel) as well.

## Quiet Quitting and Spider Solitaire

For our purposes, the important question is “what does quiet quitting look like in Spider Solitaire?” We have already seen the results of quiet quitting when you’re proof-reading your Ph. D. prior to submission, but that was a “one-off digression within a digression” for lack of better phrase.

I would define QQ as playing on auto-pilot. This could manifest itself in various ways:

• If you find a good move (or plan) don’t bother looking for a better one
• Don’t bother looking for a chance to remove a complete suit.
• Consulting a random number generator when faced with a difficult decision

A general theme is QQ tends to affect decision-making skills, rather than knowledge of the fundamentals. For instance, if you have some experience in the Royal Game you probably know that with two empty columns a run of four cards like 8-7-6-5 can be shifted onto a Nine, even if they were all different suits – and this is not something you are likely to forget, even if you were in quiet quitting mode.

I believe the average player is more likely to quiet quit if a game is going extremely well or extremely badly (since small errors are less likely to result in the loss of a game that should be won). Yes, there are other “human factors” such as tiredness, or something else bothering the player that is not Spider Solitaire related. Of course, that raises the question of why a player chose to play the game in the first place. Then again, somebody could be “born to quiet quit” and never reach their full potential despite playing for an extended period of time. I know of one such Scrabble player at work who is very low-rated despite playing the game for umpteen thousand umpteen hundred and umpty ump years. She was probably there for the “social aspect” of the game, rather than the love of  problem-solving or the thrill of finding a power-play with lousy-looking tiles.

## QQ in a nutshell

In a nutshell, if I were pressed to come up with a reasonable definition of QQ in the context of SS, then QQ means playing without thinking. Regardless of your playing strength, this should imply a lesser win rate than expected. How much of a loss would be anybody’s guess, and I don’t see anyone writing their Ph. D. on this topic any time soon.

I do not see myself playing Spider Solitaire unless I put in my absolute best effort. That’s just my nature. I need a compelling reason to not go above and beyond. If I am tired or bothered by something unrelated to the Royal Game, I wouldn’t be playing in the first place.

Okay I agree that QQ is a garbage term and I only used it here in order to “score” a third digression before Steve’s game draws to a close. It really should be something as bland as “playing on autopilot” but then there would be no reason for me to blog about it in the first place 😉

What are your thoughts on quiet quitting (with or without a Spider Solitaire context)?

# Steve Brown’s Game: Round 5(1)

Here is the start of round 5 after Steve deals the last ten cards from the stock.

In some sense, the last round is the “simplest” to calculate. Since the stock is empty, there are no more possible surprises associated with 10 new cards appearing simultaneously rather than sequentially. Most of the time, an empty stock implies the winning chances are either very very good or very very bad. Whereas, in previous rounds we have to make do with general considerations and “fuzzy evaluations” such as “we have good winning chances but not enough to justify sending over a Backgammon doubling cube with the ‘2’ face up”.

Of course, one can argue the last round is “hardest” to calculate since there are so many cards. To play the last round well you will need a LOT of calculation. Steve correctly points out the ability to calculate is a necessary (but not sufficient!) condition to achieving a high win rate at the Royal Game.

Another peculiarity of the last round is that most of the time at least one full suit will be visible (or it has already been moved to the foundations). For instance, every card in Hearts can be found in column 1, 5 or 8. Obviously we wanna work out if we can guarantee removing at least one suit. Most of the time, once you are able to clear any complete suit, everything else will collapse.

In the next post I will discuss how Steve proceeds from here. You may wish to analyse this game state for yourself and come to your own conclusions. If you do so then I recommend you give only a “general plan” rather than specific moves. Also, stop as soon as you turn over any face-down card. Your answer would look something like the following: (this is a template only and does not apply to the current hand).

(1) obtain two empty columns (2) Tidy up so we have a complete Heart suit missing only the King (3) Dump the K of Spades into an empty column (4) Win back another empty column (5) Complete Hearts (6) burn all empty columns to turnover a card in column 8.

# Steve Brown’s Game: Round 4(3)

Continuing our game. Steve’s only possible turnover is in column 2, albeit at the cost of splitting Aces.

In some cases it may be wise to spurn a turnover “for the greater good”, but not today. There is a fair chance of two turnovers, and the alternatives ain’t so attractive anyway.

Steve is able to turn both face-down cards in Column 2. They are the Eight of Clubs and Two of Diamonds. The good news is he has recovered the empty column.

The bad news is – yes you guessed it – this brings the familiar one-hole-no-card. Steve elects to shift the C8:4s into the empty column. Not a great choice, but I’m not seeing anything significantly better. Personally I would be loath to expose another Ace. I would prefer to move “jg”, maintaining the status quo and hoping to make progress after the next round.

This situation (one-hole-no-card) does happen more than we would like to admit. Usually what happens is an empty column gives us at least many different options to choose from and each option will be worth “some fraction of a turnover”. For sake of argument, suppose that we have a free and open source Spider Solitaire engine called StockSpider, and that StockSpider evaluates every turnover is worth an equity of +1.0. Building in-suit is worth +0.2 (on average), exposing an Ace is worth -0.2, having an atomic column is worth +0.1 and so on. Given so many options, sheer numbers dictates that we should be able to get some value from our empty column despite no turnover. Maybe some minor achievements here and there will add up to +0.5 or +0.6. Basically, one-hole-no-card isn’t necessarily the end of the world as we know it.

The observant reader will have noticed Steve failed to build in-suit with ed before wasting the empty column. Presumably Steve wants to get as much junk off column 4, since that is clearly where our most likely source of turnovers is coming from. However, it was actually possible to play “e3=d1” before burning the hole (an exercise for the reader). This allows us to have our anti-smoking song and sing it too: we build in-suit without adding more junk to column 4.

The other point is that at this late stage of the game we should (ideally) be thinking about removing a complete suit rather than our next turnover. Unfortunately, we’re in a bit of a fix and I don’t see anything spectacular here. One bright spot is that with so few cards unseen, there is a decent chance of drawing the cards we need. For instance, we might draw X5X5XX53X3, where X represents any card, take our empty columns and win the game. A little bit of wishful thinking never hurt anybody!