forked from WHC/Hermit
Vendored sashidown, OpenAI-compatible env (OPENAI_*), and bootstrap scripts. Co-authored-by: Cursor <cursoragent@cursor.com>
52 lines
916 B
Markdown
52 lines
916 B
Markdown
# Snake Game
|
|
|
|
A classic terminal-based Snake game written in C++17.
|
|
|
|
## Features
|
|
|
|
- Smooth snake movement using POSIX terminal I/O
|
|
- WASD or Arrow keys for movement
|
|
- Food spawning and snake growth
|
|
- Wall and self-collision detection
|
|
- Score tracking
|
|
- Pause functionality (P key)
|
|
- Clean terminal rendering
|
|
|
|
## Build
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
This compiles `snake.cpp` with optimization level O2 and C++17 standard.
|
|
|
|
## Run
|
|
|
|
```bash
|
|
./snake
|
|
```
|
|
|
|
## Controls
|
|
|
|
| Key | Action |
|
|
|-----|--------|
|
|
| W / ↑ | Move Up |
|
|
| S / ↓ | Move Down |
|
|
| A / ← | Move Left |
|
|
| D / → | Move Right |
|
|
| P | Pause/Resume |
|
|
| Q | Quit |
|
|
|
|
## Game Rules
|
|
|
|
- Eat the `*` food to grow and score points (+10 per food)
|
|
- Avoid hitting the walls `#`
|
|
- Avoid colliding with your own body `o`
|
|
- The snake moves continuously
|
|
|
|
## Requirements
|
|
|
|
- GCC/G++ with C++17 support
|
|
- POSIX-compliant system (Linux, macOS)
|
|
- Terminal with ANSI escape support
|