Skip to main content

2^N (terminal)

2048, generalised, in a terminal: where the game started. The third version beside web/ and wii/, on the magmacrunch engine's terminal backend: a cabinet in the magmacrunch arcade and its own command, the same either way.

pip install -e ".[dev]"
two-to-the-n                  # or python -m two_to_the_n
two-to-the-n --mode 4         # straight to a target of 16
two-to-the-n --mode endless --play

Keys

key
arrows (or WASD, hjkl) slide every tile
left / right on the title choose N, from 2-bit (target 4) to 16-bit (65,536), or endless
R new game
Esc the title (from the title, back to the arcade)
Q quit

Two equal tiles that touch merge into their sum, and the merge scores the tile it makes. The game ends when a tile reaches 2^N, which is a win, or when the board is full with no pair left. The newly dealt tile lights up for a moment. Past 2048 the tiles cycle through the page's plasma.

It is the browser's game

two_to_the_n/rules.py is web/js/game.js plus the three lines of web/js/main.js that make a slide into a turn: slide, and only if anything moved, deal a tile and check for the end. tests/test_oracle.py checks it: tools/js_oracle.mjs loads the website's adenosine-puzzle.js and web/js/game.js with Math.random seeded, plays a few hundred games across every mode, some mashed and some played into a corner past 2048, and the test replays every move through the port and requires the same board, score and ending after each one.

The oracle needs the website, for the bundle. It finds it the way tools/link-shared.mjs does: ../shared, $WEBSITE, ../../website, ../../../web/website. CI checks the website out beside the game.

The browser's choices are copied rather than improved, because both versions file scores the same way:

  • One board, 2n, with the mode beside each score as difficulty, and a top ten per mode. A score is asked for initials only if it makes its own mode's ten, as the page asks.
  • 2-bit mode never deals a 4, which would be its target, while the value draw is still taken so the odds elsewhere match.
  • Reaching the target ends the game, as a win, after a half-second pause to see the tile that did it.

Change any of these in web/js/game.js and here together, and the oracle will hold the two to each other.

Needs a 67x21 terminal.

Licence

PolyForm Noncommercial 1.0.0, as the rest of this repository. See NOTICE, which also says whose game 2048 is.

Metadata

Release files for magmacrunch-two-to-the-n 0.1.0

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-two-to-the-n 0.1.0
File Size Uploaded Provenance
magmacrunch_two_to_the_n-0.1.0.tar.gz 29.4 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for magmacrunch-two-to-the-n 0.1.0
File Interpreter ABI Platform
magmacrunch_two_to_the_n-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 53.3 kB

Release files / magmacrunch_two_to_the_n-0.1.0.tar.gz

Download URL magmacrunch_two_to_the_n-0.1.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
bf1e0cc442d85ea76748fe2341c4eeba20f528b208f1504ee5d63ae6712ee9f0
BLAKE2b-256 checksum
How to use checksums
c5a92fd6343964cace7c3a7d609a9f79f9a89c1bf36514cc7cd136f8a587433f
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 20, 2026.

Transparency log

Release files / magmacrunch_two_to_the_n-0.1.0-py3-none-any.whl

Download URL magmacrunch_two_to_the_n-0.1.0-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bece3eb8c7ac1755bdfdd44ba46bc26216eaeaea8b8fd67f1c293ed7180d3348
BLAKE2b-256 checksum
How to use checksums
828daa50d577f1c568401a0741bbfef694ca180d0efa4b66aa81cb97fa6035ce
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 20, 2026.

Transparency log

Security for magmacrunch-two-to-the-n 0.1.0

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for magmacrunch_two_to_the_n-0.1.0.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 20, 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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