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.

We now consider the following question: How can we evaluate a starting position? That is, if you are given an initial game state with 10 exposed cards how do we determine if the chances of winning are good, average or poor? Can we quantify our winning chances as a percentage (e.g. 58%)?

NOTE: evaluating a start position is useful since most
Spider Solitaire implementations allow the player to abandon a game without
counting it as a loss. But if you are serious about improving your game, I
strongly recommend you never abandon games with a poor initial state.

A first thought may be to look for “features” of a game state. For instance suppose we are watching some top quality chess at an unhealthy time of the day. We might notice that

White has an extra pawn

The position is an endgame: both sides want to
activate their king without fear of suddenly being mated.

Black’s rook and king are more active than their
opposite numbers

Both sides have vulnerable pawns

Bear in mind we are only identifying individual features at this early stage. Eventually we may wish to formulate an overall assessment by combining these features somehow, but that comes later.

QUESTION: What are plausible features to use in an opening game state in Spider Solitaire?

Avid readers of this blog (yes you!) would immediately identify “guaranteed turnovers” as a possible feature. In the above diagram you should be able to quickly identify 5 turnovers. Of course every man, dog and millipede on the planet knows that building in-suit is even more desirable. In this case we have Q-J in spades and 2-3 in clubs. Therefore we have 2 guaranteed suited turnovers (and hence 3 off-suit turnovers).

Finally we can look at rank multiplicity. All players know that having too much of one rank can be a problem, especially when the adjacent rank is in short supply. You don’t need a Ph. D. in economics to work out things are less than ideal when the Spider Solitaire gods have supplied five Jacks on the opening deal and there is little demand for them. For simplicity let us define the rank multiplicity as the count of the most frequent rank. For instance the above diagram has a rank multiplicity of 2 since we have two Threes/Deuces and no rank appears more than twice. In summary:

We have 5 guaranteed turnovers

We have 2 guaranteed suited turnovers

The rank multiplicity is 2.

There may be other features to consider, but we’ll keep things simple for now.

Are these values
good, bad, or average? It turns out one can use simulation to answer this
question. For instance if I had nothing better to do, I could play 10 million
games of Spider and compute the number of guaranteed turnovers should be 3.97
on average.

Of course the lazy solution is to write a computer program to do the simulation for me. The program can simply deal 10 cards, do the relevant calculations and then abandon the game. An even lazier solution is to copy the results from Steve Brown’s excellent book Spider Solitaire Winning Strategies. He got the following results:

Looking at these graphs, I would immediately dismiss rank
multiplicity as a useful feature (the entry for 5 is non-zero but is too small
to be visible). After all more than 90% of games will have a value of 2 or 3!
It is true that one can tweak rank multiplicity somehow (e.g. giving more weight
to Aces and Kings which are the bugbears of most players), but I wanted to keep
things simple for the time being. The important point is these quantities are
easily obtained via simulation.

Suited turnovers is nice, but I think it’s more important to
have many turnovers at the start of the game. In other words, quantity is more
important than quality. In the above example, we have 5 guaranteed turnovers
and 2 suited, both of which are above average. Hence if given a choice, I would
take this position over a random position.

If you are a beginner, I would estimate that:

If you start with exactly 4 guaranteed
turnovers, your chances of winning are average

If more (less) than 4 then your chances are
above (below) average.

Of course if you lose every game at the 4-suit level then
this rule only works when you have exactly 4 turnovers! So perhaps this rule is
better suited to the 2 suit level, if you excuse the lousy pun. As you gain
more experience, you would be able to tweak these guidelines. For instance, you
might think that two suited turnovers is worth an extra non-suited turnover,
etc.

That’s it for now. Happy Spider playing, and may all your
builds be in-suit 😊