Spider GM wins Connect Four!

Spider GM is off to a good start in Connect Four. He has won the first four games for a flawless victory (to borrow from the Street Fighter vernacular). His friend Ninja Monkey says three out of four games were ridiculously easy with a estimated equity 0.96 or better, but game 2 was a strange exception. The last ten cards from the stock were K2248K9264 which might explain a lot 🙂

Spider GM will continue to record results for the remainder of this month in order to settle a bet with a friend concerning the biasedness (or lack thereof) of i-Phone Spider Solitaire. For further details, please see earlier posts and references therein.

From previous experimentation SpiderGM expects the equity to be between 50% and 100% for each game, since each game is supposed to be winnable (each daily-challenge deal has the option of “show me how to win”, so users would be 80,73,83,83,69,68 off if a game turned out to be unwinnable). The average would be much lower if the games were random. Spider GM will also expect to accumulate plenty of red in the latter half of the month. Fortunately the game of Connect Four is considered won as soon as one side achieves 4 in a row, even if the opponent “goes perfect” during the remainder of the month

september_game_win

Bring it on

One of my friends has challenged me to repeat my Ninja Monkey experiment for September 2019. Those who follow my Facebook page will know the good goss, but here it is in a nutshell:

  • I have Spider Solitaire on my i-phone.
  • This software comes with “daily challenges” where a fresh deal is provided for every day, akin to a random number generator – thus if you enter the same “seed” of e.g. 15 August 2019 fifty times you will play the same hand fifty times etc. NB: Players are restricted to any day between 1st of previous month and today.
  • However, I believe the RNG is not uniform and if we choose any month then games corresponding to later days are harder than games corresponding to earlier days
  • This can be done via statistics: choose 2 days of the same month at random and let Ninja Monkey compute the “equity” of games corresponding to both days. The probability that the later game is harder than the earlier game should be 50%,
  • but my actual probability was significantly higher (p-value < 05) when I tested the games in July 2019.

I am now going to repeat the same experiment for September, and I am laying my friend 4:1 odds in his favour that I will not get the same result as my July data.  My friend told me that twenty 66,85,76,76,83,72,73,84 tests should give one significant result (as if I didn’t already know!). But I was definitely not cherry picking. Even if I am wrong, I will have no regrets. To put it in Poker terms, my experimental results force me to call all the way to the river and if I am beat … then I am beat. We are using happy stars as currency, so it’s not as though my credit card details are at stake.

sept_calendar

Bring. It. On.

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.

The day we’ve all been waiting for

Today, every man dog and millipede on the planet celebrates National Solitaire Day. Solitaire is a card game that’s been around for over 200 years. But it was 1990 when Solitaire truly became a thing thanks to Microsoft. According to legend, Microsoft Solitaire was designed to teach computer users how to use … hey W,H,A,T,T,H,E,70,85,67,75 ?!?!?!?

In this day and age, it’s hard to imagine anyone credibly claiming to have invented a game with the intention of teaching people to use a mouse properly. But given that playing Klondike is beneath my dignity, all this is moot anyway. Of course I am going to celebrate today by playing a different game on my i-Phone instead. May the Four-Suit Spider Solitaire be w- okay that joke is lame, so I won’t bother completing it ☹

Okay, I confess to not knowing about National Solitaire Day until a few days ago, and I must thank Susan Sleggs for mentioning this on her own excellent blog. And she could probably give me some tips on writing short stories.

But for now I’m about to move one of the Heart Fours onto the 5 of clubs. Any 2,3,5,7,9,J or K will guarantee me at least one extra turnover. Let’s hope it’s a good one!

National (Spider) Solitaire Day

Seven of Hearts, hooray!!!!!!!! Life is good 😊

To be continued