Metadata-Version: 2.5
Name: magmacrunch-nelikko
Version: 0.1.0
Summary: NELIKKO - Helsinki 1989. Terminal version.
Project-URL: Homepage, https://magmacrunch.com/arcade/nelikko/
Author: magmacrunch media
License-Expression: PolyForm-Noncommercial-1.0.0
License-File: LICENSE
License-File: NOTICE
Keywords: arcade,blocks,games,puzzle,terminal,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

# NELIKKO (terminal)

Helsinki, 1989, 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.

```
pipx install magmacrunch-nelikko
nelikko
```

For working on it:

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

## Keys

| key | |
|---|---|
| `←` `→` (or A/D) | siirrä, slide. Hold to keep sliding |
| `↑` (or W, X) | käännä, turn clockwise |
| `↓` (or S) | pudota, down a row |
| `SPACE` | heitä, drop |
| `C` | pidä, hold |
| `P` | tauko, pause |
| `R` | restart |
| `Esc` | the title (from the title, back to the arcade) |
| `Q` | quit |

Every control is a press, so a terminal plays this the way a browser does.
Holding an arrow is the terminal repeating it, which stands in for the
browser's own auto-shift; it starts a little later than the page's 170 ms,
and that is the only difference you can feel.

## It is the browser's game

`nelikko/rules.py` is the rules from `web/game.js`, which keeps them in one
file with the canvas and the page. `tests/test_oracle.py` checks the port
anyway: `tools/js_oracle.mjs` loads `web/game.js` unmodified with the page
stubbed out, plays it through its own `update()`, and the test replays every
op through the port and requires the same well, piece, score, level and clock
after each one. Ten games, about 25,000 ops, up to level 20.

Two things the browser does oddly are copied rather than fixed, because both
versions share a scoreboard and a rule fixed in one would make its scores mean
something else:

- **Levels 2 and 3 fall slower than level 1** (915 and 830 ms against 800).
  Level 1's interval is a literal and the rest come from
  `1000 - (level - 1) * 85`.
- **A piece swapped out of hold is not checked for room** at the spawn point.

Both are pinned in `tests/test_rules.py` by name. Fix them in `web/game.js`
and here together, and the oracle test will hold the two to each other.

Scores go to the board the browser already has, which is still called
`tetris` from before the rename. That is deliberate (see `../AGENTS.md`) and
never shown.

## Characters

Every glyph is in the engine's degradation table except the Finnish `ä` in
PIDÄ and the tagline. cp1252 and cp437 both carry it, so in practice it draws
everywhere; what it lacks is an ASCII stand-in under `--ascii`. The engine's
`nordic` group (magmacrunch-media/magmacrunch#4) adds one. Once a release
carries it, raise the `magmacrunch` floor here and drop `FINNISH` from
`tests/test_app.py`.

Needs a 52x22 terminal.

## Licence

[PolyForm Noncommercial 1.0.0](LICENSE), as the rest of this repository. See
[NOTICE](NOTICE).
