Skip to content

An implementation of Klondike, the most popular version of Solitaire.

License

Notifications You must be signed in to change notification settings

scottwillmoore/klondike

Repository files navigation

Klondike

An implementation of Klondike, the most popular version of Solitaire, in Rust! While this project should support traditional Klondike, the aim is to support the less popular, but more skillful, "Thoughtful Klondike".

The best information about the winnability of Klondike concerns a modified version of the game called "Thoughtful Solitaire" or "Thoughtful Klondike", in which the location of all 52 cards is known.

Features

  • A Rust library which implements a standard 52-card deck.
  • A Rust library which implements the game of Klondike.
  • A "notation" for the game of Klondike.
  • A Rust library which implements a "Klondike engine".
  • A CLI application.
  • A TUI application?
  • A WASM binary that can be embedded in a web application.
  • A TypeScript library which interfaces with the WASM binary.
  • A GUI web application written in TypeScript which uses React.

Rules

...

Definitions

Klondike: ...

Solitaire: ...

Foundation: ...

Foundation pile: ...

Stock: ...

Tableau: ...

Tableau pile: ...

Notations

In chess, there is a standard notation also known as algebraic notation which is used to record the moves in a game of chess. However, in Klondike there does not appear to be a standard notation. A notation is important as it allows games to be represented in literature, and act as a format that can be transferred and processed by applications.

I have proposed a notation for Klondike that is very similar to the notation used in chess. The notation is still subject to change and hence not yet rigorously specified. It is also (at the moment) only implemented by this application. Two different, but similar notations have been described, with one suited for human-use and the other suited to computer-use.

Compact (human-readable)

A card is represented in uppercase with a rank and a suit. A rank is A, 2, ... 9, T, J, Q, or K. A suit is C, D, H or S. A suit could also be , , , or instead. A position is represented in lowercase which indicates the destination of the card. The tableau piles are a, b, c, d, e, f, or g. The foundation is z. A foundation could also just use no symbol? A complete move is represented as a card, followed by a position. For example, 4Sa is move the four of spades to the first pile in the tableau and ACz is move the ace of clubs to the foundation. The only other move is to draw a card from the stock which is represented by a ``? A win is indicated by a #? A loss is indicated by a `!`.

Efficient (machine-readable)

A binary format? Provide a derived description of the move, which includes all information! For example, it would indicate where the card is from and where the card is going to. It might include what the card is, but this might not be required? In addition, tableau moves would include how many cards are being moved.

References

Rust

WASM

Random Number Generation

Solitaire

Implementation