#tui #crossterm #ratatui #snake

app reptil-en-peligro

A terminal-based Snake game in Rust using ratatui/crossterm with a stylish banner, square fruits, and smooth gameplay

2 stable releases

1.0.1 Aug 14, 2025

#154 in Games

MIT license

16KB
361 lines

Reptil en Peligro

Reptil en Peligro is a terminal-based Snake game built in Rust using ratatui for the TUI (Terminal User Interface) and crossterm for terminal input/output handling.

The size of the board depends on the size of your terminal's window.

Features

  • Responsive TUI rendering with ratatui
  • Smooth snake movement
  • Fruits displayed as square blocks for consistent visuals
  • Stylish top banner displaying:
    • Game title
    • Current score
    • Elapsed time
  • Dynamic board resizing based on terminal size
  • Collision detection (walls, snake body)
  • Arrow key controls + q / Esc to quit

Requirements

  • Rust and Cargo installed (Install Rust)
  • ANSI-compatible terminal

Installation

From source

git clone https://github.com/aguacero7/rep
cd reptil-en-peligro
cargo run

Global installation via cargo install

cargo install reptil-en-peligro

Then run:

rep

Controls

Key Action
Move up
Move down
Move left
Move right
q Quit
Esc Quit

Project Structure

src/
├── main.rs      # Entry point
├── ui.rs        # Board and interface rendering
├── game.rs      # Game logic
├── event.rs     # Keyboard input and tick handling

Example Screenshot

image ---

License: MIT

Dependencies

~8–21MB
~271K SLoC