Skip to content

A terminal-based snake game with dynamite hazards, built with Rust and Ratatui.

License

Notifications You must be signed in to change notification settings

ankitvashisht12/snako

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snako

A terminal-based snake game with dynamite hazards, built with Rust and Ratatui.

   ____  _   _    _    _  _____
  / ___|| \ | |  / \  | |/ / _ \
  \___ \|  \| | / _ \ | ' / | | |
   ___) | |\  |/ ___ \| . \ |_| |
  |____/|_| \_/_/   \_\_|\_\___/

Features

  • Classic snake gameplay with a twist
  • Dynamite obstacles with countdown timers
  • Progressive difficulty (speed increases as you grow)
  • Persistent high score tracking
  • Cross-platform (Linux, macOS, Windows)
  • Multiple control schemes (Arrow keys, WASD, Vi-keys)

Installation

Quick Install (Unix - Linux/macOS)

curl -sSL https://raw.githubusercontent.com/ankitvashisht12/snako/main/scripts/install.sh | bash

Quick Install (Windows PowerShell)

iwr https://raw.githubusercontent.com/ankitvashisht12/snako/main/scripts/install.ps1 | iex

From Source

# Requires Rust toolchain (https://rustup.rs)
cargo install --git https://github.com/ankitvashisht12/snako

From GitHub Releases

Download the appropriate binary from the Releases page.

Controls

Key Action
Arrow Keys / WASD / HJKL Move snake
P / ESC Pause game
Q Quit
Enter / Space Start game / Restart

Gameplay

┌────────────────────── SNAKO ──────────────────────┐
│ Time: 02:35 | Score:   150 | High Score:      420 │
├───────────────────────────────────────────────────┤
│                                                   │
│       @@####                                      │
│           ##                                      │
│           ##            ()                        │
│           ##                                      │
│                    [3]                            │
│                                                   │
│                                            [5]    │
└───────────────────────────────────────────────────┘
  • @@ - Snake head
  • ## - Snake body
  • () - Apple (eat to grow and score)
  • [N] - Dynamite with countdown timer (avoid!)

Rules

  1. Eat apples to grow your snake and earn points (+10 each)
  2. Avoid dynamites - touching one ends the game
  3. Don't hit walls or your own body
  4. Speed increases as your snake grows longer

Dynamite Mechanics

  • Dynamites spawn periodically during gameplay
  • Each has a countdown timer (displayed as a number)
  • When the timer reaches 0, the dynamite disappears safely
  • Touching a dynamite at any point = Game Over!

Configuration

High scores are automatically saved to:

Platform Location
Linux ~/.local/share/snako/save.json
macOS ~/Library/Application Support/com.snako.Snako/save.json
Windows %LOCALAPPDATA%\snako\save.json

Building from Source

# Clone the repository
git clone https://github.com/ankitvashisht12/snako.git
cd snako

# Build release version
cargo build --release

# Run the game
cargo run --release

Documentation

Requirements

  • Terminal with at least 80x24 character support
  • UTF-8 support (recommended for best visuals)
  • Works on most modern terminals including:
    • Linux: gnome-terminal, konsole, alacritty, kitty
    • macOS: Terminal.app, iTerm2
    • Windows: Windows Terminal, cmd.exe, PowerShell

Contributing

Contributions are welcome! Please read the Development Guide first.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add: amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Ratatui - Terminal UI framework
  • crossterm - Cross-platform terminal library
  • Inspired by classic snake games everywhere

About

A terminal-based snake game with dynamite hazards, built with Rust and Ratatui.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published