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

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.3
File Size Uploaded Provenance Actions
magmacrunch_two_to_the_n-0.1.3.tar.gz 27.7 kB With provenance Details for magmacrunch_two_to_the_n-0.1.3.tar.gz

Built distribution (wheel)

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

Total release size: 52.3 kB

Release files / magmacrunch_two_to_the_n-0.1.3.tar.gz

Download URL magmacrunch_two_to_the_n-0.1.3.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ac188c1f796bffa045def6dfb4ceae50261bbf33f20e36104b03a2545cfecf70
BLAKE2b-256 checksum
How to use checksums
8ed3770f0837c8d8b382259d8a649a82cd92926f773c86691a7fb46ff6ee64a7
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 Nov 8, 2026.

Transparency log

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

Download URL magmacrunch_two_to_the_n-0.1.3-py3-none-any.whl
Size 24.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e50a50ddad65cd27382bd818f9089cca7ac76e219176c1b98789d7dbad7f394
BLAKE2b-256 checksum
How to use checksums
0be1e55c8ce278a526c04e4d70d2facd2b185f5b52062242b431f03346abb235
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 Nov 8, 2026.

Transparency log

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

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.3.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 Nov 8, 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