Updated
Tetris
Tetris for keyboard and touch, with rules ported from a tiny display's firmware.
What it is
Tetris in the browser, for desktop and mobile. The rules came from a version I wrote for the 2.2-inch screen of an ODROID-SHOW2: SRS rotation states with simple wall kicks, NES scoring and gravity, and a 7-bag randomizer.
The first version was jQuery in 2011. That one is still in the repo, next to the rewrite.
How it works
- The rules are pure functions over immutable values. The session (title, playing, paused, game over) is a reducer on top of them.
- One hook owns the gravity timer, the keyboard, held-key repeat and saving the best score in
localStorage. - On phones, on-screen buttons move, rotate and drop. The game pauses on its own when the tab or app goes to the background.
- Every push is type-checked, linted, tested and built, and the main branch deploys to GitHub Pages.
Built with
Started