Coding into the Void

Coding into the Void

A blog that I’ll probably forget about after making thirty-five posts.

Making a New Solitaire

In late May and early June, I worked on a version of FreeCell. It’d come up in conversation, and I realized that I wanted to play it. None of the versions available were very good,1 so, as any self-respecting game dev would do, I made my own version.

It’s here:

Now, one of the pieces of advice you’ll get as a programmer is to avoid making things generic from the beginning. It’s a waste of time if you aren’t planning on doing more than one thing, and without knowing the things you’re doing, you’ll probably spend your time in the wrong places.

I had no desire to make any version of Solitaire other than FreeCell. I made it generic anyway.2

I released my version of FreeCell, and I was quite happy with it. It feels good to play, and it has assist features that really tighten up the game. FreeCell is legitimately great, and I have fun going back to it regularly.

However, it took me one month to make, and it came off of another game that took me a full month to make.3 I usually don’t make games that take that long,4 and I was hankering for a quick game development win.

So, there I was, thinking, hey, maybe I should make a Solitaire variant. After all, I did make it generic. I’m not a big fan of Klondike,5 so Spider was where my thoughts first went to, since those are the big three. But did I just want to make versions of Solitaire I don’t have that much passion for? No, not really.

Then it hit me.

Back in my college days, I used linux quite a bit.6 Some of my classes required it, so I’d dual boot into Linux and Windows. As you do when you’re a college student hungry for some games, I checked out the free offerings. There were the standards like that Tron game, OpenGLAD,7 and AisleRiot, a Solitaire collection. AisleRiot boasts over 80 Solitaire variants. Of course, the sad truth about Solitaire variants is that most aren’t very good.

In my exploration of the different game variants they offered, I came across one called Diamond Mine. Notable for its vast number of tableau piles (13!) and its unique mechanic of diamonds being unmovable, except to the foundations. Four cards are dealt to each of the tableau piles, with the bottom of each stack revealed. Sadly, the concept was better than the implementation, as it was rarely winnable, and required a good deal of trial and error.

Still, it stuck with me.

My thoughts drifted to Diamond Mine. It’d be trivial to implement it—it’s not doing anything strange in terms of the implementation, and it’d be fun to try it with hints and undos and all that. I’ll just see how it feels, I thought.

So, I implemented Diamond Mine. It took an hour, maybe two.8 Sadly, though, even with all the functionality my generic Solitaire engine provides by default, it didn’t feel very good to play.

When you’re playing a game that you’re not particularly enjoying, it’s generally fairly straightforward to see the aspects of the gameplay you’d tweak. You might not always be right, but it gives you avenues to explore. A strength of Solitaire is that it is very easy to explore. In fact, you don’t even need a computer!

After some playing, I came across what I thought were its core problems. They, as I saw them, were:

Hidden cards are bad.

When it comes to preferring games of skill or games of luck, I lean down heavily toward the skill side. One of the reasons I like FreeCell so much is that the vast majority deals are winnable.9

Of course, hiding cards doesn’t change the theoretical win rate.

If you were to hide all cards in FreeCell except the top ones of each stack, it’d still be winnable the exact same amount of times, but it would simply take a great deal of trial and error to find the cards needed to progress. This would make FreeCell incredibly tedious.

It occurred to me that I had no clue why anyone would hide the cards in Solitaire, so I attempted to think of all the reasons for it.10 Here are the motivations I brainstormed:

  1. It prevents visual overload when processing large numbers of cards.
  2. There’s excitement when revealing cards. It provides moments of interest throughout the game.
  3. It lengthens the game. Good if you want a longer game?
  4. It makes cheating less tempting. It’s more effort to swap cards if you have to find the one you want to swap with.
  5. It prevents the user from immediately redealing when posed with a non-ideal card distribution (aces at the bottom, for instance).
  6. While it doesn’t affect the actual win rate, it does make the odds of winning the game lower. This pulls responsibility for a loss away from the player and to the game, which can be good for certain types of players.
  7. It rewards safer and more robust play. Since you don’t have all the information up front, you have to play in a way that adapts to the situation instead of planning all your moves ahead.

There may be other motivations, and some of these feel like a stretch, but there’s a surprising dearth of information about Solitaire game design online.

Of these points, 2–3 and 5–7 are not compelling to me, especially in this form of Solitaire, in which you’re punished so heavily by starting with the wrong diamond. Point 4 is irrelevant in a digital version of the game. Point 1—visual overload—is the only point that I see worth tackling.

It’s often trivially impossible.

This works hand-in-hand with the hidden information to make play frustrating. Since diamonds cannot be moved except to the foundation, there are instances where, when the cards are all visible, it’s clear that the game is unwinnable.

For instance, imagine a stack that has, from bottom to top, 4♦, 3♦, 5♦. If you start by moving the 4♦ to the foundation, you cannot move the 3♦ since you’d need to play the 5♦ first. That takes the 4♦ off the table as the starting diamond. However, you also can’t play any other diamond first, since all of those options would require the 3♦ to be played before the 4♦.11

This is not a rare occurrence. In the first fifty thousand deals, the diamond positioning alone makes it unbeatable 62.4% of the time. It’s possible for the non-diamonds to prevent a victory, but that’s harder to tell at a glance.

This interacts very poorly with the hidden cards. You’re usually fighting an unwinnable battle and you have no way of knowing. The way the rules for Diamond Mine are phrased, it implies that the goal is to get a high score, not to win. I’m not a fan of that approach.

Plus, I like the idea of it being possible to have a 100% win rate, even in a version of Solitaire with some impossible deals. If all cards are visible at the start of the game, you can determine if you can win without making a single move, which doesn’t trigger a loss in most Solitaire implementations.12

Diamonds aren’t clear at a glance.

This one is more trivial than others. Diamonds are red. Hearts are red. Having two suits with the same color but dramatically different purposes makes it harder to tell, at a glance, what your goals are.

Winning is tedious.

This one is inexplicable to me. One you get all the diamonds to the foundation, you have to line up each suit in K-A order. I don’t know how many setups where you can send all the diamonds to the foundation and still lose, but I’m certain it’s quite rare.

If you’re wondering if it’s possible at all, it is. Look at this sample deal, which immediately gets all the diamonds but allows no further movement:

6♣ 4♣ 4♣ 4♣ 3♣ 3♣ 3♣ 2♣ 2♣ 2♣ A♣ A♣ A♣
5♣ 5♣ Q♣ Q♣ Q♣ T♣ T♣ T♣ 8♣ 8♣ 8♣ 6♣ 6♣
K♣ K♣ K♣ J♣ J♣ J♣ 9♣ 9♣ 9♣ 7♣ 7♣ 7♣ 5♣
A♦ 2♦ 3♦ 4♦ 5♦ 6♦ 7♦ 8♦ 9♦ T♦ J♦ Q♦ K♦

If there’s no enjoyable challenge remaining, don’t make me keep playing. It takes the wind out of my sails and makes winning the game feel anticlimactic. Contrast this with FreeCell, which often ends with a series of cards automatically moving to the foundation.

Delving into the Mine

So I’ve established a list of grievances and the ability to easily tweak some parameters. I should note that I have no game design background, so keep that in mind while you’re reading my thoughts.13

Fixing the Win Rate

Card Visibility

My first change was to address all the unbeatable games that snuck up on you. At first I tried a light touch, making the diamonds always visible, while keeping the other buried cards hidden.

This does cut down on the amount of trial and error to see if a game was unwinnable. However, it was still frustrating when I needed a specific card and didn’t know if it was permanently locked off from me or I just needed to shuffle cards around more.14

In the end, I settled on the FreeCell approach—just show all the cards.

Fixing Clarity

To cut down on the visual noise, I enable card dimming by default, which dims the diamonds slightly, making them stand out, and further dims the cards not in runs. It makes the tableau easier to read.

In addition, I limited the deck to two suits: one set of diamonds, and three sets of clubs.15 The color difference helps emphasize the difference in roles.

Making it Easier

Of course, as I discussed above, making cards visible doesn’t actually change the win rate of the game. While you could now play the game in your head (and eliminate ~60% of games trivially based on diamond placements) to avoid the loss, that isn’t actually all that much fun.

My first instinct was to alter the deck to guarantee that the diamond configuration was winnable. This is completely doable, but it feels conceptually wrong to play a version of Solitaire that cannot be played by simply shuffling the deck and dealing. Sure, you could follow the algorithm to rearrange the cards, but it adds a level of tedium and error into the setup process.

Furthermore, while this does fix the diamond issue, there’s more than a few games where you just can’t find a foothold due to the rock (club) placement. Ideally, you’d be able to make some progress in all but the most inhospitable deals.

In the end, I decided to take another page out of FreeCell’s book. I added in a cell, themed as a mine cart. This lets you shift around a diamond, or store a rock if you’re facing a wall of them.

This quickly changed to “at least one cart, but as many as the diamonds alone require”, which then was raised up to two. With this change, I didn’t run into any deals that felt impossible from the get-go.

Making it Harder

With the changes to add mine carts, you can practically dig your way to the bottom of any tableau pile without any effort. Sure, you’ll fill up your carts, but it can often feel too powerful.

An easy way to make it harder, of course, is to reduce the number of tableau stacks. However, there’s a balance there. A key part of the game is being able to dig to the bottom to move a King there, and if there’s too many diamonds in the way, it becomes impossible. Even worse, it stops being fun.

After trying out several card stack amounts between 8 and 13, I ended up settling on 11. More challenging than 13 but without practically guaranteeing a diamond blocking each stack. No special science or analysis there—just feeling it out.

No More Toil

No more ordering the suits once you’ve moved all the diamonds to the foundation. It’s not fun, and it fits the theme to just leave a huge mess behind for future generations.

The Final Version

With all that exploration, I finally landed on a version that I liked. A nice range of difficulty while generally feeling beatable. It certainly tends towards the easy side, and games are often sub-minute, but there’s nothing fundamentally wrong with that.

To differentiate it from its influence and fit with my naming scheme, I simply called my version Mine.16

Now, was this different enough that it counts as making my own version of Solitaire instead of just being a variant of Diamond Mine? Eh, who cares.

Here’s the final list of differences:

  • All cards are face up: you can now analyze the cards to see which one you should start with, making it the game require far less trial and error.
  • There’s two carts:17 cards can be stored, dramatically increasing the number of winnable games.
  • You don’t need to put the other suits in order: this felt like toil for no reason.
  • Fewer columns (13 → 11): with the changes above, 13 columns make the game trivial. 11 columns makes it slightly more difficult, while usually still giving you a column or two to place your Kings.

I don’t know that Diamond Mine is available anywhere online, but it is available as part of AisleRiot, or PySol if you’re not on Linux. My version, lowercase mine, is available here:

Final Thoughts

It’s a quick, breezy game of Solitaire that’s usually winnable, and often requires some creative problem solving to get to a winnable state. I hadn’t consciously paid too much attention to game design in previous games, so this was a fun way to try something new.

Is it as good as FreeCell? I don’t think so, but it’s hard to beat perfection.18


  1. The Microsoft version is filled with ads and microtransactions, and the web and mobile ones tend to be missing basic features, like automove or hints. The all-in-one Solitaires tend to focus on quantity over quality of implementations, and each individual game in those doesn’t seem to get much love. ↩︎

  2. No one has ever accused me of making good decisions. ↩︎

  3. Working approximately an hour or two a day, outside of work. ↩︎

  4. Especially not Solitaire. It’s simple! It should be easy! ↩︎

  5. Also just known as Solitaire to unsophisticated Solitaire players. ↩︎

  6. I still do, but just for work. No games there. ↩︎

  7. The original of which I played the demo for quite a bit when I was a kid. ↩︎

  8. It turns out sometimes you can make the right abstractions, although of course I did have to add some functionality. ↩︎

  9. All of them if you play my version. ↩︎

  10. Unfortunately, I wasn’t able to find any discussion of the design of Solitaire games. I’m sure there’s been plenty written about it, but Google was filled with algorithmic content generation, tutorials, and unrelated content. ↩︎

  11. Because you can go around the corner (Ace on top of King), having a lower diamond blocked by a higher diamond isn’t necessarily a problem, as you can just go around the corner and pick it up near the end. It still often occurs that multiple two-diamond stacks can block each other, but is more obvious with a three-diamond stack. ↩︎

  12. Like mine! ↩︎

  13. Perhaps I should’ve mentioned it up top, but it’s too late now. Can’t change the written word. ↩︎

  14. I also find this frustrating in vanilla Solitaire, although that has few enough choices that it’s less commonly a problem. ↩︎

  15. Which I call rocks because I love running a metaphor into the ground. ↩︎

  16. That also enables the fun exchange:
    You: What version of Solitaire are you playing?
    Me: Mine. ↩︎

  17. With additional mine carts granted based on diamond placement. ↩︎

  18. Is it better than Klondike? Absolutely. ↩︎