Skip to content

rezkhaleghi/snake-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terminal Snake Game

A classic Snake game implementation in Rust using the Crossterm library for terminal manipulation.

Overview

This is a simple, terminal-based Snake game where you control a snake that grows longer as it eats food. The game ends when the snake hits the wall or itself.

Requirements

Installation

  1. Clone this repository or create a new Rust project
  2. Add the following dependencies to your Cargo.toml:
[dependencies]
crossterm = "0.26.1"
rand = "0.8.5"
  1. Copy the source code into src/main.rs
  2. Build and run the game with cargo run

How to Play

  • Use arrow keys (↑, ↓, ←, →) to navigate the snake
  • Eat food (●) to increase your score and make the snake grow
  • Avoid hitting walls and the snake's own body
  • Press 'q' to quit the game

Controls

  • ↑ (Up Arrow): Change direction to upward
  • ↓ (Down Arrow): Change direction to downward
  • ← (Left Arrow): Change direction to left
  • → (Right Arrow): Change direction to right
  • q: Quit the game

Game Elements

  • ■: Snake head
  • □: Snake body
  • ●: Food
  • █: Walls/Border

Author

Created and maintained by "PocketJack (Rez Khaleghi)"

Support

If you enjoy this app and would like to support my work:

License

This project is available under the MIT License.

Acknowledgments

  • Built with Rust and Crossterm
  • Inspired by the classic Snake game on nokia

Contributing

Contributions are welcome! Feel free to submit a Pull Request.

About

nokia snake game using rust and crossterm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages