SkillAgentSearch skills...

Gosol

Polymorphic Solitaire Game in Go + Ebiten

Install / Use

/learn @oddstream/Gosol
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Minimal Polymorphic Solitaire in Go

Towards a polymorphic solitaire engine in Go+Ebiten, with help from fogleman/gg (both of which are highly recommended), with game variants run by (user supplied) scripts.

Screenshot

It's tested on Linux, Windows and in a web browser. If you have go installed, you should be able to run it on Linux or Windows by cloning this repo and then go run . in the cloned directory. Or, install it using go install github.com/oddstream/gosol@latest.

There is a live playable WASM version here (sorry about the large initial download).

It's created because I have to write software, and for my own personal enjoyment. It's skewed toward puzzle-type games, because they're the ones I mostly play. It's definitely not for profit and will never contain ads.

Variants

It currently knows how to play:

  • Agnes Bernauer
  • Australian
  • Baker's Dozen
  • Canfield (also Storehouse, American Toad, Duchess)
  • Easy (an easy to win game, for debugging)
  • Forty Thieves (also Sixty Thieves, Busy Aces, Forty and Eight, Josephine, Maria, Limited, Lucas, Red and Black, Rank and File, Number Ten)
  • Freecell (also Freecell Easy, Blind Freecell, Eight Off, Seahaven Towers)
  • Klondike (also Gargantua, Klondike Draw Three, Triple Klondike, Thoughtful)
  • Penguin
  • Scorpion (also Wasp)
  • Simple Simon
  • Spider (also Spider One Suit, Spider Two Suits)
  • Usk
  • Whitehead
  • Westcliff (Classic, American and Easthaven)
  • Yukon (also Yukon Cells)

Variants are added when the whim takes me, or when some aspect of the engine needs testing/extending, or when someone asks.

Some variants have been tried and discarded as being a bit silly, or just too hard:

  • Agnes Sorel
  • Giant
  • King Albert
  • Raglan

Some will never make it here because they are just poor games:

  • Accordian
  • Golf
  • Pyramid (or any card matching variant)

Screenshot

Other features

  • Permissive card moves. If you want to move a card from here to there, go ahead and do it. If that move is not allowed by the current rules, the game will put the cards back and explain why that move is not allowed.
  • Unlimited undo, without penalty. Also, you can restart a deal without penalty.
  • Bookmarking positions (really good for puzzle-style games like Freecell or Simple Simon).
  • Scalable cards. Change the size and shape of the window to make the cards fit.
  • One-tap interface. Tapping on a card or cards tries to move them to a foundation, or to a suitable tableau pile.
  • Cards in traditional red and black (best for games like Klondike or Yukon where cards are sorted into alternating colors), or in four colors (for games where cards are sorted by suit, like Australian or Spider).
  • Every game has a link to it's Wikipedia page.
  • Statistics (including percent complete and streaks; percent is good for games that are not often won, and streaks are good for games that are).
  • Cards spin and flutter when you complete a game, so you feel rewarded and happy.
  • Slightly randomized sounds.
  • Automatic saving of game in progress.
  • A dragable baize; if cards spill out of view to the bottom or right of the screen, just drag the baize to move them into view.
  • A 'discard' pile type so that Spideresque games can be implemented as they are described in the textbooks (other software reuses Foundation piles).

Deliberate minimalism

A lot a features have been tried and discarded, in order to keep the game (and player) focused. Weniger aber besser, as Dieter Rams taught us. Design is all about saying "no", as Steve Jobs preached. Just because a feature can be implemented, does not mean it should be.

Configurability is the root of all evil, someone said. Every configuration option in a program is a place where the program is too stupid to figure out for itself what the user really wants, and should be considered a failure of both the program and the programmer who implemented it. So, there's one card face, one color palette, one card animation speed, and so on.

Screenshot

FAQ

What makes this different from the other solitaire implementations?

This solitaire is all about Flow.

Anything that distracts from your interaction with the flow of the game has been either been tried and removed or not included.

Crucially, the games can be played by single-clicking the card you wish to move, and the software figures out where you want the card to go (mostly to the foundation if possible, and if not, the biggest tableau, or an empty cell). If you don't like where the card goes, just try clicking it again or dragging it.

Also, I'm trying to make games authentic, by taking the rules from reputable sources and implementing them exactly.

Why are the graphics so basic?

Anything that distracts from your interaction with the flow of the game, or the ability to scan a deck of cards, has either been tried and removed, or not included. This includes: fancy card designs (front and back), changing the screen/baize background, keeping an arbitrary score, distracting graphics on the screen.

The user interface tries to stick to the Material Design guidelines, and so is minimal and tactile. I looked at a lot of the other solitaire websites and apps out there, and think how distracting some of them are. Features seem to have been added because the developers thought they were cool; they never seem to have stopped to consider that just because they could implement a feature, that they should.

Sometimes the cards are really huge or really tiny

Either resize your browser/desktop window (if using scalable cards) or change the settings to fixed size cards.

The rules for a variation are wrong

There's no ISO or ANSI or FIDE-like governing body for solitaire; so there's no standard set of rules. Other implementations vary in how they interpret each variant. For example, some variants of American Toad build the tableau down by suit, some by alternate color. So, rather than just making this stuff up, I've tried to find a well researched set of rules for each variant and stick to them, leaning heavily on Jan Wolter (RIP, and thanks for all the fish), David Parlett and Thomas Warfield. Where possible, I've implemented the games from the book "The Complete Book of Solitaire and Patience Games" by Albert Morehead and Geoffrey Mott-Smith.

Keyboard shortcuts?

  • C - collect cards to the foundations
  • B - bookmark current position; Ctrl+B - return position to last bookmark
  • H - hint/help - show movable cards
  • N - new deal (resign current game, if started)
  • R - restart deal
  • U - undo

What about scores?

Nope, the software doesn't keep an arbitary score. Too confusing. Just the number of wins, the average 'completeness percentage' and your winning streak (streaks are great). A game isn't counted until you move a card. Thereafter, if you ask for a new deal or switch to a different variant, that counts as a loss.

You can cheat the score system by restarting a deal and then asking for a new deal.

'Completeness percentage' is calculated from the number of unsorted pairs of cards in all the piles.

But you can cheat

You can when playing with actual cards, too. Cheat if you like; I'm not your mother.

What about a timer?

Nope, there isn't one of those. Too stressful. Solitaire is also called patience; it's hard to feel patient when you're pressured by a clock.

You can't move cards off a foundation pile

Nope. Reading the "original" rules for a lot of the games seem to explicitly forbid this, so there's a complete ban on moving cards off a foundation pile.

You can always use undo if you get stuck or change you mind about a move.

What's with the settings?

Fixed cards

With this checked, the size of the cards is fixed, preventing them from scaling.

Otherwise, the size of the cards is changed dynamically so the cards fill the width of the screen. In some variants, this can cause the cards to disappear off the bottom, in which case you can drag the baize, or change the size of the window (if not running on a mobile device).

Power moves

Some variants (eg Freecell or Forty Thieves) only allow you to move one card at a time. Moving several cards between piles requires you to move them, one at a time, via an empty pile or cell. Enabling power moves automates this, allowing multi-card moves between piles. The number of cards you can move is calculated from the number of empty piles and cells (if any).

Colorful cards

Depending on the variant, enabling this draws the cards in four colors, rather than the usual black and red.

Mirror baize

Mirrors the card piles on the baize from right to left, because not everyone is right handed, or likes the stock to be on the left of the screen when they are right handed.

Mute sounds

So you can, for example, listen to an audio book while playing.

Auto collect

Enabling this will cause cards to be moved to the Foundation piles after every move you make.

Safe collect

In games like Klondike that build tableau cards in alternating colors, you can sometimes get into trouble by moving cards to the foundations too soon. With this option turned on, the titlebar collect button will only move cards to the foundation piles when it is safe to do so.

Is the game rigged?

No. The cards are shuffled randomly using a Fisher-Yates shuffle driven by a Park-Miller pseudo random number generator, which is in itself seeded by a random

Related Skills

View on GitHub
GitHub Stars53
CategoryDevelopment
Updated26d ago
Forks7

Languages

Go

Security Score

85/100

Audited on Mar 11, 2026

No findings