Skip to main content

Crate t2048

Crate t2048 

Source
Expand description

A 2048 clone for the terminal, built with ratatui.

The crate is split so the rules can be tested without a terminal:

  • game holds the rules and knows nothing about rendering.
  • app holds the application state and turns key presses into moves.
  • ui draws an app::App with ratatui.
  • theme holds the colour palette.
  • storage remembers the best score between runs.

The t2048 binary in src/main.rs is a thin wrapper that wires these together with a terminal event loop.

Modulesยง

app
Application state and input handling.
game
Terminal-agnostic 2048 rules.
storage
Best-score persistence.
theme
Colour palette for the board.
ui
Drawing the game with ratatui.