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.
Interesting times ahead, watch this space 😊