Skip to main content

Solitaire (terminal)

The magmacrunch arcade's Solitaire, Klondike draw three, in a terminal. It is the second version of the game, beside web/. It runs on the magmacrunch engine's terminal backend, either as a cabinet in the magmacrunch arcade or as its own command, and plays the same either way.

pipx install magmacrunch-solitaire
solitaire                    # the title
solitaire --play --seed 7    # straight to a deal, the same deals every time

For working on it, from this folder, once the website's shared/ is linked in beside web/ (node tools/link-shared.mjs from the repository's root), which the oracle test needs:

pip install -e ".[dev]"
python -m klondike

Keys

A cursor stands for the mouse, and ENTER is a click wherever it stands.

key
← → along the top row (stock, waste, foundations) or across the columns
↑ ↓ up and down a column's face-up cards, and between the top row and the columns
1 to 7 a column
ENTER SPACE click: draw from the stock, pick a card up, or put the held card there
F double-click: a card to its foundation, if it can go
D draw, wherever the cursor is
X click the felt: put the held card down
N deal again
H S help, the scores; the clock stops while they are open
Esc Esc leave the deal, for the title (and from there, the arcade)
Q quit

The stock shows its back and how many cards are left. The waste shows its top three, fanned. A column shows its face-down cards as one back and a count, then its face-up cards one to a row. The held card is lit cyan and the cursor pink. A win shows the page's win screen: time, moves, score, and the time bonus, with a NEW HIGH SCORE badge when the score makes the board. It goes on the board with its time beside it, as the page saves it.

Needs a 41x24 terminal.

It is the browser's game, on the browser's clock

klondike/rules.py is web/js/game.js, method for method, with the deck and its shuffle from the website's shared/adenosine-cards.js. The page keeps its time with a one-second setInterval, and that is part of the rules: the time on the table, and the bonus a win is paid, are whatever that timer last set. So the port keeps the page's clock too. Its time only moves when the screen moves it, by the real time gone, and the interval fires at each of its seconds on the way. A double click is two clicks on one card inside 300 ms of that time. Two tests hold the port to the page:

  • tests/test_oracle.py. tools/js_oracle.mjs loads those files unmodified on a page that does nothing, with a seeded Math.random and a clock of its own. It plays 40 games through the Solitaire class the way the page's clicks reach it: the stock, a card, an empty foundation or column, the felt, the menu's pauses and New. Half are a random clicker that now and then clicks the same card again quickly. Half are a greedy player, which won 16 of its 285 deals. That is 134,958 clicks and clock steps. The test makes the same ones through the port and requires the same state after every one: every pile, face up or down, the card held and where from, moves, score, the seconds on the clock, whether it runs, and the win screens set going. Widening the double click to 310 ms fails it at seed 1, event 266; a bonus of x36 fails it at seed 2, event 3,194.
  • tests/test_rules.py. It sets up by hand the cases worth pinning, including the fixes below, so that undoing one shows as a change.

Fixed in both

  • Only a column's top card goes to a foundation. The page checked the card picked and moved the column's top card: with the 5♥ and 4♠ face up and the hearts at 4, picking the 5♥ put the 4♠ on the hearts. Now nothing moves.
  • A card on a foundation stays there. Moving one to another foundation counted a move and moved nothing; now it counts nothing.
  • A won table is finished. It still played: a king taken off its foundation and put back won again, with a second bonus and a second score. A win now stops the clock for good, and Help and the scores no longer start it again.
  • The bonus is paid on the time to the win, read at the winning move, not on the timer's last tick up to a second before it. A win under 30 seconds is paid as 30, so the bonus never falls as a win gets faster: it was 24,500,000 at one second and nothing under one.
  • The clock holds for every reason at once. A modal and the page being hidden each hold it, and it runs again only once neither does. A new deal starts it clean, and drops a win screen still waiting from the last deal.
  • A draw puts down a waste card held. The page kept it held by its old place on the waste, so the next move took whatever card the draw had put there. Worse, holding the waste's king, turning the waste back into the stock and clicking an empty column pushed undefined into the column, and every render after threw: in Chromium, "Cannot read properties of undefined (reading 'getHTML')", and the table stopped answering clicks. drawFromStock and draw_from_stock now put a held waste card down first; a tableau card held stays held. In Chromium the same clicks on the fixed page leave the column empty, and the king, drawn again, goes there. Taking the fix out of the port alone fails the oracle at seed 1, event 252; the trace has 57 draws with a waste card held, three of them turn-overs.

Licence

PolyForm Noncommercial 1.0.0, as for the rest of this repository. See LICENSE and NOTICE.

Metadata

Release files for magmacrunch-solitaire 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magmacrunch-solitaire 0.1.1
File Size Uploaded Provenance Actions
magmacrunch_solitaire-0.1.1.tar.gz 25.1 kB With provenance Details for magmacrunch_solitaire-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for magmacrunch-solitaire 0.1.1
File Interpreter ABI Platform Actions
magmacrunch_solitaire-0.1.1-py3-none-any.whl Python 3 none any Details for magmacrunch_solitaire-0.1.1-py3-none-any.whl

Total release size: 46.2 kB

Release files / magmacrunch_solitaire-0.1.1.tar.gz

Download URL magmacrunch_solitaire-0.1.1.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
152f5a0475205eeedfdcf40646d8d857fdf4992b3552bc25c147d97902fdde08
BLAKE2b-256 checksum
How to use checksums
22e0d57330db56265be71242e76e5b2fc8901b84e14c87b9a019460779f5a385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Release files / magmacrunch_solitaire-0.1.1-py3-none-any.whl

Download URL magmacrunch_solitaire-0.1.1-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97b67966c4ce199db693c0639ced0b53c8492372f52b052e3b9ee462add8114a
BLAKE2b-256 checksum
How to use checksums
33e1e4394bc30aa53858347a0e82cc887af943fd8ec9826c34595b267fbdf7d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

Security for magmacrunch-solitaire 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for magmacrunch_solitaire-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page