diff --git a/README.md b/README.md new file mode 100644 index 0000000..0b6e52b --- /dev/null +++ b/README.md @@ -0,0 +1,90 @@ +# 🐍 Snake Game (C++ Console Edition) + +A colorful and modern **Snake Game** built entirely in **C++** for the terminal. +This version includes a **menu system, persistent leaderboard, scoring with time tracking, smooth controls, and a retro ASCII-art UI** that makes the classic snake experience both fun and polished. + +--- + +## 🎮 Features + +- 🏠 **Main Menu:** Start a new game, view the leaderboard, or exit. +- 👤 **Player Names:** Each player enters their name before starting, and their performance is tracked. +- đŸŽ¯ **Scoring System:** + - +10 points for each fruit collected + - Timer shows how long you survived + - Score combined with time for leaderboard ranking +- 🏆 **Leaderboard:** Sorted by **score** (higher is better), with **time** used as a tiebreaker. +- 🐍 **Snake Mechanics:** Grow longer each time you eat fruit, but avoid running into your own tail! +- 🔄 **Wrap-Around Walls:** When hitting borders, snake reappears on the opposite side. +- ⏱ **Time Tracking:** Total game duration is displayed alongside your score. +- 🎨 **Colorful Console Graphics:** Snake, fruits, borders, and leaderboard are all highlighted with ANSI colors. +- 💾 **Persistent Save:** Player data is stored in `leaderboard.txt` so you can keep competing across sessions. +- ⚡ **Fast and Simple UI:** Runs directly in terminal — no extra dependencies. + +--- + +## 📷 Screenshots + +### 🏠 Main Menu +![Menu](./image/Menu.png) + +--- + +### 🏆 Leaderboard +![Leaderboard](./image/leaderboard.png) + +--- + +### 🎮 In-Game +![Gameplay](./image/Game.png) + +--- + +## âš™ī¸ Setup & Run + +### ✅ Requirements +- A C++ compiler (e.g., g++, MSVC) +- Windows OS (project uses `conio.h` and `windows.h`) +- Console with UTF-8 and ANSI color support + +### đŸ“Ļ Build & Run + +#### On Windows: +```bash +g++ -o snake snake.cpp -std=c++11 +snake.exe +``` + +#### On Linux/macOS: +> âš ī¸ This version relies on Windows-specific libraries. For Linux/macOS, small adjustments are required (replace `conio.h` and `windows.h` with platform-specific functions). + +--- + +## đŸ•šī¸ Controls + +- `W` or **Up Arrow** → Move Up +- `S` or **Down Arrow** → Move Down +- `A` or **Left Arrow** → Move Left +- `D` or **Right Arrow** → Move Right +- `ESC` → End the game immediately + +--- + +## 📁 Project Files + +- `snake.cpp` → Main source code +- `leaderboard.txt` → Stores player leaderboard data + + +--- + +## 👤 Creator + +> **Name:** _[Meraj Derafshi]_ +> **Contact/Portfolio:** _[https://github.com/MerajDerafshi]_ + +--- + +## 📜 License + +This project is open-source. Feel free to use, modify, or expand it for learning or fun. Attribution is appreciated. diff --git a/image/Game.png b/image/Game.png new file mode 100644 index 0000000..b1c608c Binary files /dev/null and b/image/Game.png differ diff --git a/image/Menu.png b/image/Menu.png new file mode 100644 index 0000000..3f6a059 Binary files /dev/null and b/image/Menu.png differ diff --git a/image/leaderboard.png b/image/leaderboard.png new file mode 100644 index 0000000..9f3e048 Binary files /dev/null and b/image/leaderboard.png differ