Metadata-Version: 2.5
Name: magmacrunch-threes
Version: 0.2.0
Summary: THREES - slide, merge, survive. Terminal version.
Project-URL: Homepage, https://magmacrunch.com/arcade/threes/
Author: magmacrunch media
License-Expression: PolyForm-Noncommercial-1.0.0
License-File: LICENSE
License-File: NOTICE
Keywords: arcade,games,puzzle,terminal,tiles,tui
Requires-Python: >=3.10
Requires-Dist: magmacrunch>=0.7.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# THREES (terminal)

Slide, merge, survive, in a terminal. The second version of the game beside
`web/`, on the [magmacrunch](https://github.com/magmacrunch-media/magmacrunch)
engine's terminal backend: a cabinet in the magmacrunch arcade and its own
command, the same either way.

```
pip install -e ".[dev]"
python -m threes
```

## Keys

| key | |
|---|---|
| arrows (or WASD, hjkl) | slide every tile one step |
| `R` | new game |
| `Esc` | the title (from the title, back to the arcade) |
| `Q` | quit |

1 + 2 makes 3, and from there same plus same; 1 + 1 and 2 + 2 do not merge.
The new tile comes in on the edge you slid away from, and lights up for a
moment so you can see where it landed.

## It is the browser's game

`threes/rules.py` is `web/js/game.js` plus the part of adenosine-puzzle's
`createGame` it relies on: a move is the left slide with the board rotated
round it, and only a move that changed something brings a tile and counts.
`tests/test_oracle.py` checks it: `tools/js_oracle.mjs` loads the website's
`adenosine-puzzle.js` and `web/js/game.js` unmodified with `Math.random`
seeded, plays 300 games through the game's own `handleMove()`, and the test
replays every move through the port and requires the same board, score and
move count after each one, and the same answer to whether it moved at all.

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
share a scoreboard and a rule changed in one would make its scores mean
something else:

- **Three new tiles in four are 1s** (75% 1, 15% 2, 10% 3), and a 1 merges only
  with a 2, so the board fills with 1s and a game lasts a few dozen moves.
  The original Threes! deals 1s and 2s about evenly.
- **The score is the sum of every merge**, not the original's powers of three.

Change either 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](LICENSE), as the rest of this repository. See
[NOTICE](NOTICE), which also says whose the name is.
