openklondike is Klondike solitaire. Build the four foundations from Ace to King, drawing one or three cards at a time.

openklondike is free, open source, and has no tracking.

How to play

Rules

  • One 52-card deck. Seven tableau columns are dealt with the top card of each face up. The rest of the deck is the stock.
  • Build the four foundations up by suit, Ace to King. The game is won when all 52 cards are on the foundations.
  • On the tableau, build down in alternating colours. A face-up run moves as a unit. Only a King or a run starting with a King goes into an empty column.
  • Deal from the stock to the waste, one card or three at a time. When the stock is empty, the waste turns back over to become the stock. There is no limit on passes.
  • The number of cards dealt at a time is set under Options in the menu (Draw: One or Draw: Three).

Scoring

Standard scoring, as in Windows 95 Solitaire. The score never goes below zero. A clock and a move count are shown with the score.

EventPoints
Card to a foundation+10
Waste to tableau+5
Turn over a tableau card+5
Foundation back to tableau−15
Recycle the waste, Draw One only−100
Every 10 seconds of play−2

Controls

Mouse, on computers and in desktop browsers:

InputAction
Click the stockDeal, or recycle the waste when the stock is empty
DragMove a card or a run
Double clickSend a card to its foundation
Right clickSend a card to its foundation
EscapeBack to the menu. The game can be resumed
Alt+EnterToggle fullscreen
Up / Down, Enter / SpaceMenu navigation. Left / Right change a value in Options

Touch, on phones, tablets, and mobile browsers. There are no on-screen buttons:

GestureAction
Tap the stockDeal, or recycle the waste when the stock is empty
Tap a cardSend it to a foundation if it fits there, otherwise to the best tableau column
DragMove a card or a run. The pile it can land on is highlighted
Two-finger tapBack to the menu. The game can be resumed
Tap a menu rowChoose it. In Options, a tap cycles the value

Where to play

Download openklondike on the App Store

Technical details

Source code: github.com/dannyheskett/openklondike, MIT license.

Code

  • Written in C.
  • The game logic is one platform-independent file, src/game.c. Every platform uses it unchanged. Unit tests cover it and need no window.
  • Drawing, input, and audio use raylib 6.0 on Windows, macOS, Linux, Android, and the web. iOS uses its own Metal and UIKit backend with no raylib.
  • Cards and suit symbols are drawn from shapes and curves. Sound effects are synthesized at startup. The Nunito typeface is embedded in the binary. There are no asset files.
  • The clock runs on a fixed 60 Hz step, not on the frame count, so it keeps the same time on a 120 Hz phone and in a throttled browser tab.
  • The browser version is the same C compiled to WebAssembly with Emscripten.

Layouts

There are two board layouts. Each build uses one.

  • Fixed, on desktop: cards are 80×112 pixels and do not scale. The board is centred, so a larger window only adds margin. In a window smaller than 704×704 the board shrinks to fit.
  • Scaled, on phones and tablets: the board is fitted to the screen, and gaps, fans, and text sizes follow the card size. Both orientations work, and the board re-fits on rotation. Held sideways, the tableau gets less height so the cards can be larger.

Both put the stock, the waste, and the four foundations across the top of the seven tableau columns. A column too deep for the board compresses its fan so no card is off-screen.

The web build includes both. It picks the scaled board on a touch screen (pointer: coarse) and the fixed board otherwise.

Recording

Desktop builds record the session to an H.264 MP4 file, one video frame per rendered frame, with no external tools. Turn on Record in the menu, or start with --record or --record <file>.mp4. The board is rendered at a fixed size and supersampled for the recording. Mobile and web builds do not include the recorder.

Builds and releases

Every push to main builds and publishes a release: Linux x86-64, macOS universal, Windows x64 and x86, an Android APK, an iOS .ipa, and the WebAssembly bundle. The .ipa is the App Store build and cannot be sideloaded. Build instructions are in the README.