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

Built distribution (wheel)

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

Total release size: 50.2 kB

Release files / magmacrunch_two_to_the_n-0.1.1.tar.gz

Download URL magmacrunch_two_to_the_n-0.1.1.tar.gz
Size 26.3 kB
Tags Source
SHA-256 checksum
How to use checksums
862ddf15092d4140a64221a9129ecd65f1818f9c7e828636fd06cd1b5f0d66d3
BLAKE2b-256 checksum
How to use checksums
7c9581c551fd75fabf5e26303e1a0b5bbeb039504950f2062f414850323636f6
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 22, 2026.

Transparency log

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

Download URL magmacrunch_two_to_the_n-0.1.1-py3-none-any.whl
Size 23.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba4c3404471799dae207dfa449522803026ee2e123c7fe66c1acf05c43df28ac
BLAKE2b-256 checksum
How to use checksums
a1f8818f17a6d28e2422df04cbe8585e76df3d59546f7b1afff7a00fe1b636ea
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 22, 2026.

Transparency log

Security for magmacrunch-two-to-the-n 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

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.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 22, 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.1 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