Klondike solitaire. Seven tableau columns, four foundations, draw one or draw three, standard scoring with a clock and a move count. Build the foundations Ace to King to win. No ads, no tracking, no accounts, no in-app purchases.

openklondike gameplay

A few thousand lines of C, and no asset files. The cards and suit pips are drawn from shapes and parametric curves, the sound effects are synthesized at startup, and the typeface is embedded in the binary.

How it is built

The game logic is one platform-independent C file, shared unchanged everywhere and covered by unit tests that need no window. Drawing, input, and audio go through raylib 6.0 on every platform except iOS, which has a Metal and UIKit backend with no raylib.

The play clock is a fixed 60 Hz accumulator rather than a frame count, so it runs at the same speed on a 120 Hz phone and in a throttled browser tab.

Desktop builds record the session to an H.264 MP4, one video frame per rendered frame, with no external tools. Toggle Record in the menu or pass --record. The board is re-rendered at a fixed size and supersampled for capture. Mobile and web compile it out.

Layouts

Two boards. The build picks one.

  • Fixed, on desktop: cards are 80x112 and never scale. The board is centred, so resizing moves the margins and nothing else. The window has a minimum size.
  • Scaled, on phones and tablets: the board is fitted to the live screen, and gaps, fans, and font sizes follow the card size at the desktop ratios.

Both use the same arrangement: stock, waste, a gap, then the four foundations across the top of the seven-column grid the tableau uses. Both orientations work, and the board re-fits on rotation. Held sideways it reserves less tableau depth so the cards can be larger, and compresses the fan on deep columns.

The web build compiles both and picks at load from the primary pointer type. Coarse pointer gets the scaled board and touch; anything else gets the fixed board and a mouse.

Controls

Mouse, on desktop and desktop browsers:

InputAction
Click the stockDeal, or recycle the waste when it is empty
DragMove a card, or a descending alternating-colour run
Double clickSend a card to its foundation
Right clickThe same, in one click
EscapeBack to the menu, game stays resumable
Alt+EnterToggle fullscreen
Up / Down, Enter / SpaceMenu navigation; Left / Right cycle a value in Options

Touch, on iOS, Android, and mobile browsers. All gestures, no buttons:

GestureAction
Tap the stockDeal, or recycle the waste when it is empty
Tap a cardSend it to a foundation, or to the best tableau build
DragMove a card or a run. It lifts clear of the fingertip, and the pile it would land on is highlighted
Two-finger tapBack to the menu, game stays resumable
Tap a menu rowChoose it; swipe up / down to move the selection

In the browser

The same C compiles to WebAssembly with Emscripten. Same rules, same code. Play it here. Nothing to install.

Download

Every push to main cuts a release with per-platform builds: Linux, macOS, and Windows archives, an Android APK, an iOS .ipa, and the WebAssembly bundle. Source is on GitHub under MIT; the README has the build instructions.

On iOS it will be on the App Store — free, iPhone, iOS 15 or later. The build is with Apple and pending review. The .ipa attached to the release is the App Store build and will not sideload. Android is not on Google Play, so install the APK directly. Everything else runs as-is.

Download openklondike on the App Store