# Snake Snack

> A fast, keyboard-controlled Snake game that runs in a single desktop window - built in Python with pygame.

---

## What it does

Snake Snack is the classic arcade game. You steer a growing snake around the board with the arrow keys, eating the red food dots to score points. Every dot makes the snake longer and the game a little faster. Hit a wall or your own tail and it's game over - press **R** to jump straight back in. It's a small, self-contained game meant to be quick to pick up and hard to put down.

## Demo

Snake Snack gameplay - a green snake chasing red food on a dark board

- **Video:** https://youtube.com/shorts/_dUGYTcLjsc

## Built with

- **Python 3** - the whole game is one `.py` file
- **pygame** - the graphics and input library that draws the board and reads your keystrokes (one quick `pip3 install pygame`)

---

## Method to Run

### 1. Prerequisites

- **Python 3.10 or newer.** Check yours with `python3 --version`. If you don't have it, download it from https://python.org.
- **pygame.** Install it once with pip:

  ```bash
  pip3 install pygame
  ```

  If you skip this you'll see `Pygame is not installed. Run: pip3 install pygame` when you start the game. That just means the line above hasn't been run yet.

### 2. Installation

```bash
Clone/Fork https://merget.ai/preston/snake_game
cd snake-game
```

Then install the one dependency:

```bash
pip3 install pygame
```

### 3. How to run it

```bash
# Windows
python snake.py

# macOS / Linux
python3 snake.py
```

A 600x648 game window opens: a 600x600 board with a score bar on top. Steer with the **arrow keys**, press **R** to restart after a game over, and press **Esc** or close the window to quit. That's it.

### Environment variables (API keys & secrets)

None. The game runs fully offline and needs no keys, accounts, or `.env` file.

---

## How it works

The board is a 20x20 grid drawn on a pygame window. The snake is just a list of grid squares; each step, we add a new head in the direction you're facing and drop the tail - unless the head landed on food, in which case the tail stays and the snake grows. The main loop runs at 60 FPS via `clock.tick(60)`, but the snake only advances once its move delay, about 130 ms, has elapsed, and that delay shrinks slightly with each food eaten. Game over is a single check: did the new head hit a wall or a square the snake already occupies?

## Known issues / What's next

- No pause button yet - once you start, you're committed.
- The high score resets when you close the app. **Next up:** save it to a small local file so it sticks.
- No sound. We'd love to add a crunch when you eat and a buzz on game over.
- Possible future feature: difficulty levels and wrap-around walls.

## Team

- **Fady Adal** - game logic & collision detection - [@fady]
- **Dominick Chatas** - visuals, colors & playtesting - [@bigDom]

## License

MIT
