> For the complete documentation index, see [llms.txt](https://university-of-games.gitbook.io/welcome/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university-of-games.gitbook.io/welcome/products/complete-game-tutorials/klondike-solitaire.md).

# Klondike Solitaire

Klondike Solitaire — complete Unity 6 card game with draw-1/3, Normal & Vegas scoring, undo/redo, hints, autocomplete, and portrait/landscape UI. Docs by University of Games.

![Klondike Solitaire](https://assetstorev1-prd-cdn.unity3d.com/key-image/f665a196-d866-4a58-93b2-2255dc818510.jpg)

**Klondike Solitaire** is a complete Unity card game — not a code snippet. It ships a playable Klondike ruleset with portrait and landscape layouts, draw-1 / draw-3, Normal and Vegas scoring, hints, autocomplete, unlimited undo (and redo), click-to-move, drag-and-drop, and a built-in tween animator with **no third-party tween dependency**.

{% hint style="info" %}
**Who is this for?** Indie developers shipping a casual card game, teams learning uGUI card architecture, or anyone who needs a production-ready Klondike loop to reskin and extend.
{% endhint %}

{% hint style="success" %}
**Requirements:** Unity **6** (tested on `6000.5.4f1`) · **uGUI** only · **no DOTween** · render-pipeline agnostic
{% endhint %}

{% hint style="info" %}
**Unity Asset Store:** [Klondike Solitaire — Complete Game Tutorial](https://assetstore.unity.com/packages/templates/tutorials/klondike-solitaire-complete-game-tutorial-101265) · Publisher: [University of Games](https://assetstore.unity.com/publishers/25633) · Package version **2.0.0**
{% endhint %}

***

## In plain language — what do you get?

A namespaced runtime assembly (`KlondikeSolitaire.Runtime`) with a pure Core layer and a full playable demo:

1. **Classic Klondike** — 7 tableaus, 4 foundations, stock & waste; Draw 1 or Draw 3; Normal and Vegas scoring.
2. **Input that feels good** — drag-and-drop stacks, click-to-move autofit, animated hints, autocomplete when the board is clear enough to finish.
3. **Unlimited history** — snapshot undo *and* redo (Redo is implemented; wire a button in the demo if you want it on the toolbar).
4. **Mobile-ready UI** — portrait and landscape layouts with dynamic spacing; timer, moves and score HUD.
5. **Built-in tweens** — `TweenAnimator` + `AnimationQueueController` (no external tween package).
6. **Clean architecture** — XML-documented public APIs, `KlondikeSolitaire.Core` free of MonoBehaviour, optional `GameServices` / ScriptableObject config.

***

## Quick start

{% stepper %}
{% step %}

### Import

Everything lives under `Assets/KlondikeSolitaire/`.
{% endstep %}

{% step %}

### Open the demo

Open `Assets/KlondikeSolitaire/Demo/Scenes/Game.unity` and press **Play**.
{% endstep %}

{% step %}

### Try the toolbar

**New Game**, **Replay**, **Undo**, **Hint**, **Autocomplete**. Settings: Draw 3, Normal / Vegas scoring.
{% endstep %}

{% step %}

### Reskin or extend

Swap card art with `CardTheme`, hook orientation events, or drive custom logic through the Core API.
{% endstep %}
{% endstepper %}

Full walkthroughs and wiring recipes: [Getting Started & Recipes](/welcome/products/complete-game-tutorials/klondike-solitaire/getting-started-and-recipes.md).

***

## Features

| Area      | Highlights                                                               |
| --------- | ------------------------------------------------------------------------ |
| Gameplay  | Classic Klondike, Draw 1/3, Normal & Vegas, autofit, hints, autocomplete |
| History   | Unlimited snapshot undo + redo                                           |
| UI        | Portrait / landscape, timer, moves, score, “no more moves” popup         |
| Audio     | Pick, drop, flip, UI click                                               |
| Code      | Core (pure C#) + Presentation; single asmdef; XML docs                   |
| Platforms | Editor, standalone, mobile, optional WebGL loader                        |

***

## Documentation map

| Page                                                                                                                     | Contents                                                         |
| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------- |
| [Getting Started & Recipes](/welcome/products/complete-game-tutorials/klondike-solitaire/getting-started-and-recipes.md) | Demo scene, Build Settings, toolbar wiring, themes, WebGL        |
| [Core API](/welcome/products/complete-game-tutorials/klondike-solitaire/core-api.md)                                     | `BoardState`, `MoveValidator`, `MoveFinder`, scoring, undo stack |
| [Presentation API](/welcome/products/complete-game-tutorials/klondike-solitaire/presentation-api.md)                     | `BoardManager`, piles, cards, hints, `SaveManager`, UI           |
| [Customization & Extending](/welcome/products/complete-game-tutorials/klondike-solitaire/customization-and-extending.md) | Themes, rules, solvers, orientation, troubleshooting             |

***

## Architecture

```mermaid
flowchart LR
    Input[Drag / Click / Stock] --> Present[Presentation managers]
    Present --> Queue[AnimationQueueController]
    Queue --> Board[BoardManager + piles]
    Board --> Rules[MoveValidator]
    Present -.->|integrations| Core[BoardState / MoveFinder / ScoringService]
    Save[SaveManager snapshots] --> Board
```

### Design principles

1. **Core vs Presentation** — rules and state live in pure C#; MonoBehaviours own scene, animation and input.
2. **One rules source** — `MoveValidator` for foundation / tableau placement (used by piles and autofit).
3. **Serialized animations** — `AnimationQueueController` keeps deal, move, undo and hints from colliding.
4. **Optional bootstrap** — `GameServices` holds `GameRulesConfig` / `CardTheme` and Core services; the demo works without it.
5. **Two undo paths** — snapshot (`SaveManager`, demo) and command (`UndoRedoStack`, integrations).

### Assembly

| Property       | Value                       |
| -------------- | --------------------------- |
| Assembly       | `KlondikeSolitaire.Runtime` |
| Root namespace | `KlondikeSolitaire`         |
| Core           | `KlondikeSolitaire.Core`    |
| Config         | `KlondikeSolitaire.Config`  |
| References     | Unity uGUI only             |

{% hint style="info" %}
**What the demo uses today** — Presentation managers (`BoardManager`, `MatchStatistics`, `HintManager`, `SaveManager`) and `Constants`. Core types are for integrations, custom hints/solvers and command-based undo — they are not the live sync source for the demo board.
{% endhint %}

***

## Package layout

```
Assets/KlondikeSolitaire/
├── Runtime/                 KlondikeSolitaire.Runtime
│   ├── Core/                BoardState, MoveValidator, MoveFinder, …
│   ├── Config/              GameRulesConfig, CardTheme
│   ├── Presentation/        Gameplay, UI, Persistence, GameServices
│   ├── Utilities/           TweenAnimator, Constants, Randomizer, …
│   └── KlondikeSolitaire.Runtime.asmdef
├── Demo/Scenes/Game.unity
├── Resources/               card faces + prefabs
├── Art/                     UI, audio, fonts, alternate backs
├── Documentation/           README, CHANGELOG, Rules.pdf
└── WebGL/WebGLLoader.unity
```

***

## Scoring reference

**Normal**

| Action                 | Points |
| ---------------------- | ------ |
| Turn over tableau card | +5     |
| Waste → tableau        | +5     |
| Waste → foundation     | +15    |
| Tableau → foundation   | +10    |
| Foundation → tableau   | −15    |

**Vegas** — start **−52**; **+5** per foundation card; stock recycle limit **1** (draw-1) or **3** (draw-3).

***

## What's included

| Category | Contents                                              |
| -------- | ----------------------------------------------------- |
| Scenes   | `Demo/Scenes/Game.unity`, `WebGL/WebGLLoader.unity`   |
| Scripts  | 44 C# files under `Runtime/`                          |
| Prefabs  | `cardPrefab`, `RaycastHelper`                         |
| Art      | 52 faces, default + alternate backs, UI sprites, font |
| Audio    | take / drop / revert card, button click               |
| Docs     | README, CHANGELOG, Rules.pdf + this GitBook           |

***

## Version history

{% updates format="short" %}
{% update date="2026-08-03" tags="major" %}

## 2.0.0 — Architecture rebuild

Introduced `KlondikeSolitaire.Core` and `KlondikeSolitaire.Runtime` asmdef; `GameRulesConfig` / `CardTheme`; snapshot **redo**; Fisher–Yates shuffle; centralized `MoveValidator`; floating-card / autocomplete / Resources path fixes; removed DOTween claims; folder renamed to `KlondikeSolitaire`.
{% endupdate %}
{% endupdates %}

***

## Support

Questions about the package? Reach us via the [Unity Asset Store publisher page](https://assetstore.unity.com/publishers/25633) or the channels listed under [Community](https://university-of-games.gitbook.io/welcome/community).
