My Perilous Journey Into The GitHub Underworld

POP QUIZ: What could be more fun than me, two friends reading my blog and three blobs from the hit game Among Us participating in a multi-player game of Spider Solitaire?

Answer: Embarking on a perilous journey into the GitHub underworld.

Some time ago, I discovered that an “intelligent random move algorithm” can get a lousy win rate playing the Royal Game without rot13(haqb). By lousy, I mean around the vicinity of 6% – but lousy also means better than 0%. The basic gist of my algorithm is to repeatedly apply the following heuristics when choosing a sequence of moves:

  • basic tree search (i.e. examine N random different options, choose the best one)
  • static evaluation function (rewards in-suit builds, turnovers, moving suits to foundations etc)
  • multiple-move look-ahead, stopping as soon as at least one new card is turned over.
  • super-moves (a term borrowed from Freecell) to traverse the search space more efficiently

Apparently, this is enough to get around a 6% win ratio on random deals. I haven’t thoroughly tested this on a large number of data points, so this should be taken with a pinch of NaCl. But why not enlist the help of other Spider Solitaire or programming enthusiasts to boost the win rate even further?

So, I’ve decided to take the plunge and sign up for a GitHub account. Today, I have just created an account and uploaded my first project. My mad coding skillz aren’t nearly half as good as my mad Sudoku or Spider Solitaire skillz so hopefully I can keep my faux pas count to a minimum 😊 At least my actual job has provided me with some experience working with code repositories so I’m not totally out on a limb.

The current state of my project is a bare-bones AI, with plenty of room for improvement – a deliberate choice on my part. For instance, I explicitly stated in the readme.md file that one possible “to-do” is constructing a test suite to sanity-check that the AI scores a high/low/zero win rate for an easy/hard/impossible hand. I could have put in the effort to make the best possible AI before releasing it into the wild, but that’s not exactly in the spirit of collaboration with external programmers.

I already know at least one work colleague with a GitHub account and a number of “fun colleagues” from the Cracking the Cryptic discord server. With Christmas holidays around the corner (not to mention some flex leave arrangements) I should be in a good position to devote some serious time to this project.

I believe a good way to get some traction happening on my Spider Solitaire project is to return the favour for other people on GitHub. If I can spend some time “building reputation” (if you will), then I might find out that rot13(Xnezn nva’g n ovgpu) after all.

I have managed to make my first pull request for someone else’s code – a minor bug fix for a Spider Solitaire server written in JavaScript. There really should be a cheevo for submitting a meaningful pull request for someone else within 24 hours of creating a GitHub account – even if it doesn’t get accepted. But I’m sure there are worse injustices in the world I could wax lyrical about.

Interesting times ahead, watch this space 😊

Bart Wright and Schistocerca Americana awarded IM Titles

It’s official: after achieving victory on the Four-Suit version of Spider Solitaire sans rot13(haqb), with one impostor trying to rot13(shpx) things up at every opportunity I have decided to award both Bart Wright and Schistocerca Americana the title of International Master. It’s a bit of a misnomer in that we don’t get to travel all over the world to play in tournaments and prove we can mix it with the best – but I will stick with the IM title because it is considered the next level below GM and both players certainly displayed an extremely high level of skill. The other reason for the IM title is because it allows Spider GM to showcase himself at his brilliant worst. If you would like to guess the punchline before reading on, I have inserted the usual spoiler blocker.

In Chess, all titles are obtained by playing in enough tournaments and getting a sufficiently high score against decent opposition. Players can achieve “norms” in individual tournaments and you need enough norms to prove you didn’t get lucky in a single tournament. Your rating also needs to be sufficiently high. The good news is you don’t lose your title after a dip in your rating (or a string of bad tournaments), so you keep your title for life – save for something incredibly stupid, such as an arbiter finding compromising images of Stockfish recommending the best move on your mobile phone. This is fair enough: if there was no guarantee of keeping your title there would be much less incentive to achieve it in the first place. A GM title implies that your ability/talent is enough to mix it with the world’s best, provided you are willing to put in the time and effort and life doesn’t get in the way. An IM title is pretty much the same thing except “the next level down”. Then you get Federation Master titles and of course you can also add a W-hook (using the Scrabble vernacular) for female players. Hence WGM, WIM and so on.

Unfortunately, IM Schistocerca Americana is a bit of a mouthful even for somebody who recently composed a work-related rap song to the tune of Million Voices by Otto Knows. Therefore, he gets the indignity of being renamed IM Bug. And Bart Wright suffers an even worse fate:

Game On (27 June 2021)

Continuing from last week:

This is our cheat sheet so far:

One possible game state that can be reached from the start is the following:

Thanks to Bart Wright and S.A. for their input this week. Unfortunately, I’ve been busy with other stuff. To be more specific, I have discovered a truly remarkable idea for solving the problem of cheating in online chess tournaments. Unfortunately, this blog is not large enough to contain it. Besides, the tagline of the whole blog is “Spider Solitaire, the whole Spider Solitaire and nothing but the Spider Solitaire”, so I would also need to find some obscure connection to justify including this idea. On top of that, some of the comments failed the TL;DR test but the main gist seems to be “we can turn over new cards in Columns 1 and 6”.

S.A. gets bonus points for mentioning that we soon get to find out if Microsoft Solitaire allows scores to go into negative numbers, or whether the score remains at zero for the remainder of the game (and undo becomes free). I guess there is also the third option that the game terminates after 500 moves and we never get to find out if this game is winnable. Let’s hope it doesn’t come to that. But at least we have a “cliffhanger” which means Bart, S.A. and Sebastian are morally obliged to read the next few posts. Win-win for everybody 😊

Since we know the next deal is J6254A388K, it is relatively straightforward to determine the next unknown card in columns 1 and 6 starting from the above game state (NB: the next unknown card is determined by the cheat sheet, not the screenshot of the current game state).

Our luck is in: it is relatively straightforward to obtain a void in either Column 1 or Column 6 after dealing a row of ten cards. And yes, we have our first Nine 😊

It is not hard to see we have three guaranteed empty columns – so we should be able to determine the identity of almost every face down card. If you have played many games with undo, you are probably familiar with this pleasant situation.

QUESTION: What is the minimum guaranteed turnovers, starting from the above game state (score=109), playing with undo but not dealing any more rows from the stock?

BTW, in other news, Big Shiny Red Question Mark has been fully reinstated with all rights and privileges therein (thanks to Schistocerca Americana for the heads-up). But I’ve been told by a reliable source that BSRQM is still recovering from the mental scars of being Rick-Rolled. I guess there are things that 100,000,000,000 rupees can’t buy.

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 😊

Spider has made it on CTC!

Spider has finally appeared on Cracking The Cryptic! Unfortunately it’s not the right type of spider we know and love. We all know how many words a picture is worth so I’ll just do a screen dump and let you judge for yourself.

I believe every man dog and millipede on the planet must have heard of CTC by now. If you’re not familiar with CTC there’s always Google Search. If you’re not familiar with Google Search you can apply recursion and do a google search on Google Search. Bad jokes aside, this is easily one of the best Sudoku puzzles I have ever come across –

Yes, it’s a Sudoku. With no given digits. Not one. Just a bunch of lines that look like a spider. Plus a black dot between row 9 column 4 and row 9 column 5.

Lucy Audrin has set a number of puzzles for CTC and she also has many interests outside of Sudoku. She is definitely one of the Awesome People, and the world could do with a few more of those!

Oh yes, I should probably mention the rules: Normal Sudoku rules apply. Digits on a “thermometer” must strictly increase starting from the bulb (for example 13678). Some thermos share a common bulb. The black dot indicates two numbers in a ratio of 1:2 but you don’t know which cell is twice the other. It turns out this is enough to enforce a unique solution.

HINT: for those unfamiliar with Thermometer Sudoku, one of the thermometers is length 9, allowing you to enter nine digits immediately.

If you know your Kropki Sudoku, this puzzle has no “negative constraint” i.e. some cells can have consecutive digits or digits in 1:2 ratio despite the absence of a black or white dot.

Let me know if you enjoyed this Sudoku 😊

Thank-you email from a friend

Apologies for the long break, but it’s been rather busy both onside and outside the workplace.

Today I got an email from a fan, and (no surprise) this means a lot to me particularly in what’s been a difficult year for all of us. This fan is clearly keen to improve his game, and I already like his engaging writing style.

A thank you email from a friend

He mentions “Version 1607” of Windows 10 Spider Solitaire. I am not aware of this version. I always thought Windows 10 SS meant the game that is part of the Microsoft Solitaire Collection and unfortunately, I am not computer-literate enough to work out what version number this is. All I can do is post a screen-dump and ask if someone else can verify if this is indeed Version 1607 (and if not, then where do I get it?)

What I do know is I have another reason to revive this blog, so readers can expect to see regular updates – and there might be an odd video or two on Youtube as well 😊

If you are keen to improve your game, don’t be afraid to drop a comment in one of my posts.

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 …

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 🙂

WordPress new editor

On June 1, the good folk at WordPress retired their old editor and transitioned to the new one. Not sure how many writers voted for this but if that’s the sixth level of Jumanji in 2020 then I’m not complaining.

Bad jokes aside, we have over 100 content blocks for publishing virtually any post, wider collection of block patterns, built in templates, blah blah blah blah … okay can’t say I’ve read the new specs in detail. So I’ll try to figure things out without reading the instructions … so we can align an image to the centre as usual. If you align an image to the left or right then you have surrounding text alongside it, and there are also options of wide width and full width. Give me a minute to work out what all of them do. And I think I will cheat by allowing myself to click 85,78,68,79 or Ctrl-Z whenever I do something and don’t like the results! Or alternatively I might throw my hands in the air and shout 65,72,72 70,85,67,75 73,84 it’s too hard.

Somebody mentioned changes like:

  • Like buttons appearing at the bottom of each comment
  • Videos within tweets don’t work.
  • The sidebar with the subscription function, search function, and other stuff is still there; it’s just at the bottom of the page or of the post.

Unfortunately I can’t add any meaningful comments. For one thing like buttons appearing at the bottom of each comment are irrelevant, since I very rarely get comments even for silly short stories. There seem to be other features such as “stick to the top of the blog” or “pending review” and I’m trying to figure out what’s the point of all this 83,72,73,84?

I do agree with the sentiment that WordPress likes to change the rules at the last minute, especially when the number of days between today and 1st of January 1970 is a power of a prime number and the moon is three quarters full. Perhaps someone who is more clever than I can work out the exact detailed programmatic specificity (to borrow a phrase from Kevin Rudd). One thing I noticed is that when I wanna stick a picture inside a post I often (but not always) need to save the picture as a temporary image, but the new editor seems to have solved this problem(*). Of course my sample size is very small, so I don’t wanna jinx it too much 😊

(*) but if you wanna cut and paste text and images then it won’t work. You have to do them separately.

What are your thoughts about the new editor?