twozero48 ๐ŸŽฐ

May 28, 2026 ยท View on GitHub

A CLI implementation of 2048, in rust

Demo

twozero48 gameplay demo

Installation

To play the game, first install the crate:

cargo install twozero48

If you want to compile from source, ensure you have the rust tool chain installed, by going to after cloning to local and opening the directory in terminal, run

cargo run

Usage

twozero48
twozero48 --board-size 5 --winning 4096
twozero48 --help

---
CONTROLS:

WASD / arrow keys: move
Q / Esc / Ctrl-C: quit

Web App

The web app uses ratzilla to render the same Ratatui game UI in the browser!

check it out: shenoi.dev/twozero48

Build

To build the web app, use trunk(requires wasm toolchain)

rustup target add wasm32-unknown-unknown
cargo install --locked trunk --version 0.21.14
trunk build --release

Acknowledgements

  1. ratatui - the best way to build terminal UIs. period.
  2. crossterm - terminal handling done right.
  3. clap - breeziest cli argument parsing.
  4. rand - plug and play (pseudo)random number generation.
  5. criterion - easy benchmarking!
  6. ratzilla - eazipeazy ratatui on the web.

License

Code in this repository is licensed under the permissive MIT license. All code contributions are by default considered to be under the same.