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.2

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.2
File Size Uploaded Provenance Actions
magmacrunch_two_to_the_n-0.1.2.tar.gz 26.3 kB With provenance Details for magmacrunch_two_to_the_n-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 50.2 kB

Release files / magmacrunch_two_to_the_n-0.1.2.tar.gz

Download URL magmacrunch_two_to_the_n-0.1.2.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
02c98883d0b2f7e0f159ce3872e014fdd980e8571f06aa7e6b0ac08071dc7f05
BLAKE2b-256 checksum
How to use checksums
ddd1bd0f9178ca8e512a216bd578f89373be32b4a29028e0bb7fcbe99d298d37
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_two_to_the_n-0.1.2-py3-none-any.whl

Download URL magmacrunch_two_to_the_n-0.1.2-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
153772c828723efbf9746035597b18d034e93929858c10cb0a8cb94d0b711e26
BLAKE2b-256 checksum
How to use checksums
0c461d7ae40fcf712cea08aeb8199cdcb3b596c55cd5be421096ea235b4bcfc7
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-two-to-the-n 0.1.2

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_two_to_the_n-0.1.2.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