Skip to main content

Crate rsnaker

Crate rsnaker 

Source
Expand description

§Snake Game using Ratatui

This module implements a terminal-based snake game using the Ratatui crate for rendering.

§Features

  • Terminal UI: Uses Ratatui for rendering a grid-based game.
  • Game Logic: Manages snake movement, collisions, and scoring.
  • Multithreading: Uses multiple threads for input handling, rendering at 60 FPS, and game logic execution.
  • Emoji-based graphics: Supports rendering the snake using emojis instead of ASCII.
  • Configurable parameters: With clap for command-line arguments.

§References

§Architecture

  • Uses RwLock for synchronization.
  • Spawns separate threads for input handling, rendering (60Hz), and game logic execution.
  • For more details, see ARCHITECTURE.md.

§Documentation generation

  • cargo doc --document-private-items --no-deps --open

§Tests

  • As usual, run them with cargo test the project is set up with a lib containing all the code, and a main.rs just calling it
  • As this is a widespread pattern providing full compliance with the Rust test ecosystem, allowing doc comment to be automatically tested, for example. For more details, see readme.md

Modules§

controls
Game Control Modules
game_logic
Game logic Modules
graphics
Game graphical Modules

Functions§

start_snake
Panics