reznum-snakegame 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reznum_snakegame-0.1.0/LICENSE +21 -0
- reznum_snakegame-0.1.0/PKG-INFO +239 -0
- reznum_snakegame-0.1.0/README.md +206 -0
- reznum_snakegame-0.1.0/pyproject.toml +68 -0
- reznum_snakegame-0.1.0/setup.cfg +4 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/PKG-INFO +239 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/SOURCES.txt +32 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/dependency_links.txt +1 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/entry_points.txt +4 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/requires.txt +6 -0
- reznum_snakegame-0.1.0/src/reznum_snakegame.egg-info/top_level.txt +1 -0
- reznum_snakegame-0.1.0/src/snakegame/__init__.py +4 -0
- reznum_snakegame-0.1.0/src/snakegame/__main__.py +5 -0
- reznum_snakegame-0.1.0/src/snakegame/board.py +29 -0
- reznum_snakegame-0.1.0/src/snakegame/cli.py +181 -0
- reznum_snakegame-0.1.0/src/snakegame/config.py +107 -0
- reznum_snakegame-0.1.0/src/snakegame/food.py +67 -0
- reznum_snakegame-0.1.0/src/snakegame/game.py +431 -0
- reznum_snakegame-0.1.0/src/snakegame/input.py +213 -0
- reznum_snakegame-0.1.0/src/snakegame/snake.py +91 -0
- reznum_snakegame-0.1.0/src/snakegame/storage.py +35 -0
- reznum_snakegame-0.1.0/src/snakegame/theme.py +74 -0
- reznum_snakegame-0.1.0/src/snakegame/ui.py +541 -0
- reznum_snakegame-0.1.0/tests/test_board.py +30 -0
- reznum_snakegame-0.1.0/tests/test_cli.py +37 -0
- reznum_snakegame-0.1.0/tests/test_config.py +62 -0
- reznum_snakegame-0.1.0/tests/test_food.py +36 -0
- reznum_snakegame-0.1.0/tests/test_game.py +174 -0
- reznum_snakegame-0.1.0/tests/test_input.py +36 -0
- reznum_snakegame-0.1.0/tests/test_settings.py +43 -0
- reznum_snakegame-0.1.0/tests/test_snake.py +89 -0
- reznum_snakegame-0.1.0/tests/test_storage.py +33 -0
- reznum_snakegame-0.1.0/tests/test_super_food.py +53 -0
- reznum_snakegame-0.1.0/tests/test_theme.py +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ItsReZNuM <rmohamadnia85@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: reznum-snakegame
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A polished, retro Nokia-inspired Snake game for your terminal powered by Rich.
|
|
5
|
+
Author-email: ItsReZNuM <rmohamadnia85@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ItsReZNuM/SnakeGame-CLI
|
|
8
|
+
Project-URL: Repository, https://github.com/ItsReZNuM/SnakeGame-CLI
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/ItsReZNuM/SnakeGame-CLI/issues
|
|
10
|
+
Keywords: snake,game,cli,terminal,rich,nokia,retro,arcade
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Operating System :: POSIX
|
|
16
|
+
Classifier: Operating System :: MacOS
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Games/Entertainment :: Arcade
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: build>=1.0.0; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=4.0.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# SnakeGame CLI
|
|
35
|
+
|
|
36
|
+
[](https://www.python.org/downloads/)
|
|
37
|
+
[](LICENSE)
|
|
38
|
+
[](https://github.com/ItsReZNuM/SnakeGame-CLI)
|
|
39
|
+
|
|
40
|
+
A complete, polished, retro arcade Snake game for your terminal, engineered in Python using the [Rich](https://github.com/Textualize/rich) library.
|
|
41
|
+
|
|
42
|
+
Built with extensive customization, 5 vibrant color themes, an interactive main menu, real-time terminal size detection, timed SuperFood events, and high-score tracking. Designed for Windows (Command Prompt, PowerShell, Windows Terminal) with native support for POSIX environments (Linux, macOS).
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
- **Interactive Main Menu**: Navigate like a full arcade game:
|
|
49
|
+
- `Start Game`: Launch directly into the action.
|
|
50
|
+
- `Settings`: Adjust arena width, height, initial speed, color themes, and toggle bonus SuperFoods.
|
|
51
|
+
- `About Creator`: View developer links and social channels.
|
|
52
|
+
- `Exit`: Cleanly leave the application.
|
|
53
|
+
- **5 Beautiful Color Themes**:
|
|
54
|
+
- `Nokia Classic`: Retro green and yellow arcade aesthetic.
|
|
55
|
+
- `Cyberpunk Neon`: Vibrant cyan, magenta, and yellow.
|
|
56
|
+
- `Retro Amber`: Warm gold, amber, and red.
|
|
57
|
+
- `Synthwave`: Electric magenta, purple, and cyan.
|
|
58
|
+
- `Matrix Monochrome`: High-contrast minimal white.
|
|
59
|
+
- **Timed SuperFood Bonus**:
|
|
60
|
+
- A glowing SuperFood (`★`) spawns after every 5 regular foods eaten.
|
|
61
|
+
- Features an active **5-second countdown timer**.
|
|
62
|
+
- Awards **+50 bonus points** and **+3 length growth** if eaten before time runs out.
|
|
63
|
+
- **Live Terminal Dimension Reader**:
|
|
64
|
+
- Settings screen monitors console width and height in real time.
|
|
65
|
+
- Alerts you if the terminal window is too small for the selected arena dimensions.
|
|
66
|
+
- **Responsive Controls & Turn Buffering**:
|
|
67
|
+
- Fully supports both **Arrow Keys** (`↑`, `↓`, `←`, `→`) and **W / A / S / D**.
|
|
68
|
+
- Built-in turn buffering prevents rapid opposite-direction reversals into the snake's neck.
|
|
69
|
+
- **Persistent High Scores & Settings**:
|
|
70
|
+
- Automatically saves best scores to `~/.snakegame/scores.json`.
|
|
71
|
+
- Automatically remembers your customized settings in `~/.snakegame/settings.json`.
|
|
72
|
+
- **Accurate Gameplay Timer**:
|
|
73
|
+
- Millisecond-precision active timer (`MM:SS`) that pauses when you pause or browse menus.
|
|
74
|
+
- **Polished CLI**:
|
|
75
|
+
- Custom Rich-rendered `--help` guide, `--theme` flag, and user-friendly error messages without Python tracebacks.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Preview
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
╔═══════════════════════════════════════════════════╗
|
|
83
|
+
║ S N A K E G A M E ║
|
|
84
|
+
║ Terminal CLI Edition ║
|
|
85
|
+
╚═══════════════════════════════════════════════════╝
|
|
86
|
+
|
|
87
|
+
╭──────────────── Snake Game CLI ────────────╮
|
|
88
|
+
│ │
|
|
89
|
+
│ ██████████ │
|
|
90
|
+
│ █ │
|
|
91
|
+
│ █ ◆ ★ │
|
|
92
|
+
│ │
|
|
93
|
+
╰────────────────────────────────────────────╯
|
|
94
|
+
╭────────────────────────────────────────────╮
|
|
95
|
+
│ SCORE: 60 BEST: 150 TIME: 01:24 │
|
|
96
|
+
│ SPEED: 7.8/s LENGTH: 9 │
|
|
97
|
+
│ ★ SUPERFOOD: 3.4s (+50 PTS) ★ │
|
|
98
|
+
│ Controls: [WASD / Arrows] Move [P] Pause │
|
|
99
|
+
╰────────────────────────────────────────────╯
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
|
|
106
|
+
- Python **3.8+**
|
|
107
|
+
- `rich >= 13.0.0`
|
|
108
|
+
- Operating System:
|
|
109
|
+
- Windows 10/11 (Windows Terminal, PowerShell, CMD)
|
|
110
|
+
- Linux / macOS
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Installation
|
|
115
|
+
|
|
116
|
+
### Install from Source
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Clone repository
|
|
120
|
+
git clone https://github.com/ItsReZNuM/SnakeGame-CLI.git
|
|
121
|
+
cd SnakeGame-CLI
|
|
122
|
+
|
|
123
|
+
# Install package
|
|
124
|
+
pip install .
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
For editable development mode:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
pip install -e .
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Usage
|
|
136
|
+
|
|
137
|
+
Launch directly via the console command:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
snakegame
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Or execute as a Python module:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
python -m snakegame
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## CLI Options
|
|
152
|
+
|
|
153
|
+
```text
|
|
154
|
+
Usage: snakegame [OPTIONS]
|
|
155
|
+
Module: python -m snakegame [OPTIONS]
|
|
156
|
+
|
|
157
|
+
Options:
|
|
158
|
+
-w, --width <int> Grid width in cells (range: 10 - 60, default: 24)
|
|
159
|
+
-H, --height <int> Grid height in cells (range: 8 - 35, default: 16)
|
|
160
|
+
-s, --speed <float> Initial speed in moves/second (range: 1.0 - 25.0, default: 6.0)
|
|
161
|
+
-t, --theme <str> Color theme: Nokia Classic, Cyberpunk Neon, Retro Amber,
|
|
162
|
+
Synthwave, Matrix Monochrome
|
|
163
|
+
--no-color Disable terminal colors (monochrome mode)
|
|
164
|
+
-v, --version Display version information and exit
|
|
165
|
+
-h, --help Show the polished Rich help guide and exit
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Examples
|
|
169
|
+
|
|
170
|
+
Run standard game with Main Menu:
|
|
171
|
+
```bash
|
|
172
|
+
snakegame
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Start with Cyberpunk Neon theme:
|
|
176
|
+
```bash
|
|
177
|
+
snakegame --theme "Cyberpunk Neon"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Play on a larger arena:
|
|
181
|
+
```bash
|
|
182
|
+
snakegame --width 32 --height 20
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Fast challenge mode:
|
|
186
|
+
```bash
|
|
187
|
+
snakegame --speed 10.0
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Controls
|
|
193
|
+
|
|
194
|
+
| Action | Primary Keys | Alternative Keys |
|
|
195
|
+
| :--- | :--- | :--- |
|
|
196
|
+
| **Move / Menu Navigate** | `↑` `↓` `←` `→` (Arrow Keys) | Custom Keys (`W` `A` `S` `D` default) |
|
|
197
|
+
| **Select / Confirm** | `Enter` | `Spacebar` |
|
|
198
|
+
| **Back / Cancel** | `ESC` | `B` / `Backspace` |
|
|
199
|
+
| **Pause / Resume** | `Spacebar` | `ESC` / `P` |
|
|
200
|
+
| **Restart Game** | `R` *(after Game Over)* | `Enter` / `Spacebar` |
|
|
201
|
+
| **Main Menu** | `M` *(after Game Over or Pause)* | `ESC` |
|
|
202
|
+
| **Quit** | `Q` | `ESC` (on Menu/GameOver) |
|
|
203
|
+
|
|
204
|
+
> 💡 **Custom Keybindings**: Configure your custom controls anytime from **Settings → Keybindings**! Changes are automatically saved to `~/.snakegame/settings.json`.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## About the Creator
|
|
209
|
+
|
|
210
|
+
Made with ❤️ by **ItsReZNuM**
|
|
211
|
+
|
|
212
|
+
- **GitHub Profile**: [https://github.com/ItsReZNuM](https://github.com/ItsReZNuM)
|
|
213
|
+
- **Repository**: [https://github.com/ItsReZNuM/SnakeGame-CLI](https://github.com/ItsReZNuM/SnakeGame-CLI)
|
|
214
|
+
- **Telegram**: [@ItsReZNuM](https://t.me/ItsReZNuM)
|
|
215
|
+
- **Instagram**: [@rez.num](https://instagram.com/rez.num)
|
|
216
|
+
|
|
217
|
+
⭐ **Enjoyed the game?** Please consider giving the repository a star on GitHub! It means a lot and helps support future development.
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Development & Testing
|
|
222
|
+
|
|
223
|
+
Run all 38 automated unit tests with `pytest`:
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
pytest -v
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Build source distribution and wheels:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
python -m build
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# SnakeGame CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/downloads/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://github.com/ItsReZNuM/SnakeGame-CLI)
|
|
6
|
+
|
|
7
|
+
A complete, polished, retro arcade Snake game for your terminal, engineered in Python using the [Rich](https://github.com/Textualize/rich) library.
|
|
8
|
+
|
|
9
|
+
Built with extensive customization, 5 vibrant color themes, an interactive main menu, real-time terminal size detection, timed SuperFood events, and high-score tracking. Designed for Windows (Command Prompt, PowerShell, Windows Terminal) with native support for POSIX environments (Linux, macOS).
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Interactive Main Menu**: Navigate like a full arcade game:
|
|
16
|
+
- `Start Game`: Launch directly into the action.
|
|
17
|
+
- `Settings`: Adjust arena width, height, initial speed, color themes, and toggle bonus SuperFoods.
|
|
18
|
+
- `About Creator`: View developer links and social channels.
|
|
19
|
+
- `Exit`: Cleanly leave the application.
|
|
20
|
+
- **5 Beautiful Color Themes**:
|
|
21
|
+
- `Nokia Classic`: Retro green and yellow arcade aesthetic.
|
|
22
|
+
- `Cyberpunk Neon`: Vibrant cyan, magenta, and yellow.
|
|
23
|
+
- `Retro Amber`: Warm gold, amber, and red.
|
|
24
|
+
- `Synthwave`: Electric magenta, purple, and cyan.
|
|
25
|
+
- `Matrix Monochrome`: High-contrast minimal white.
|
|
26
|
+
- **Timed SuperFood Bonus**:
|
|
27
|
+
- A glowing SuperFood (`★`) spawns after every 5 regular foods eaten.
|
|
28
|
+
- Features an active **5-second countdown timer**.
|
|
29
|
+
- Awards **+50 bonus points** and **+3 length growth** if eaten before time runs out.
|
|
30
|
+
- **Live Terminal Dimension Reader**:
|
|
31
|
+
- Settings screen monitors console width and height in real time.
|
|
32
|
+
- Alerts you if the terminal window is too small for the selected arena dimensions.
|
|
33
|
+
- **Responsive Controls & Turn Buffering**:
|
|
34
|
+
- Fully supports both **Arrow Keys** (`↑`, `↓`, `←`, `→`) and **W / A / S / D**.
|
|
35
|
+
- Built-in turn buffering prevents rapid opposite-direction reversals into the snake's neck.
|
|
36
|
+
- **Persistent High Scores & Settings**:
|
|
37
|
+
- Automatically saves best scores to `~/.snakegame/scores.json`.
|
|
38
|
+
- Automatically remembers your customized settings in `~/.snakegame/settings.json`.
|
|
39
|
+
- **Accurate Gameplay Timer**:
|
|
40
|
+
- Millisecond-precision active timer (`MM:SS`) that pauses when you pause or browse menus.
|
|
41
|
+
- **Polished CLI**:
|
|
42
|
+
- Custom Rich-rendered `--help` guide, `--theme` flag, and user-friendly error messages without Python tracebacks.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## Preview
|
|
47
|
+
|
|
48
|
+
```text
|
|
49
|
+
╔═══════════════════════════════════════════════════╗
|
|
50
|
+
║ S N A K E G A M E ║
|
|
51
|
+
║ Terminal CLI Edition ║
|
|
52
|
+
╚═══════════════════════════════════════════════════╝
|
|
53
|
+
|
|
54
|
+
╭──────────────── Snake Game CLI ────────────╮
|
|
55
|
+
│ │
|
|
56
|
+
│ ██████████ │
|
|
57
|
+
│ █ │
|
|
58
|
+
│ █ ◆ ★ │
|
|
59
|
+
│ │
|
|
60
|
+
╰────────────────────────────────────────────╯
|
|
61
|
+
╭────────────────────────────────────────────╮
|
|
62
|
+
│ SCORE: 60 BEST: 150 TIME: 01:24 │
|
|
63
|
+
│ SPEED: 7.8/s LENGTH: 9 │
|
|
64
|
+
│ ★ SUPERFOOD: 3.4s (+50 PTS) ★ │
|
|
65
|
+
│ Controls: [WASD / Arrows] Move [P] Pause │
|
|
66
|
+
╰────────────────────────────────────────────╯
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Requirements
|
|
72
|
+
|
|
73
|
+
- Python **3.8+**
|
|
74
|
+
- `rich >= 13.0.0`
|
|
75
|
+
- Operating System:
|
|
76
|
+
- Windows 10/11 (Windows Terminal, PowerShell, CMD)
|
|
77
|
+
- Linux / macOS
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Installation
|
|
82
|
+
|
|
83
|
+
### Install from Source
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Clone repository
|
|
87
|
+
git clone https://github.com/ItsReZNuM/SnakeGame-CLI.git
|
|
88
|
+
cd SnakeGame-CLI
|
|
89
|
+
|
|
90
|
+
# Install package
|
|
91
|
+
pip install .
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For editable development mode:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install -e .
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Usage
|
|
103
|
+
|
|
104
|
+
Launch directly via the console command:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
snakegame
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or execute as a Python module:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
python -m snakegame
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## CLI Options
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
Usage: snakegame [OPTIONS]
|
|
122
|
+
Module: python -m snakegame [OPTIONS]
|
|
123
|
+
|
|
124
|
+
Options:
|
|
125
|
+
-w, --width <int> Grid width in cells (range: 10 - 60, default: 24)
|
|
126
|
+
-H, --height <int> Grid height in cells (range: 8 - 35, default: 16)
|
|
127
|
+
-s, --speed <float> Initial speed in moves/second (range: 1.0 - 25.0, default: 6.0)
|
|
128
|
+
-t, --theme <str> Color theme: Nokia Classic, Cyberpunk Neon, Retro Amber,
|
|
129
|
+
Synthwave, Matrix Monochrome
|
|
130
|
+
--no-color Disable terminal colors (monochrome mode)
|
|
131
|
+
-v, --version Display version information and exit
|
|
132
|
+
-h, --help Show the polished Rich help guide and exit
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Examples
|
|
136
|
+
|
|
137
|
+
Run standard game with Main Menu:
|
|
138
|
+
```bash
|
|
139
|
+
snakegame
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Start with Cyberpunk Neon theme:
|
|
143
|
+
```bash
|
|
144
|
+
snakegame --theme "Cyberpunk Neon"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Play on a larger arena:
|
|
148
|
+
```bash
|
|
149
|
+
snakegame --width 32 --height 20
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Fast challenge mode:
|
|
153
|
+
```bash
|
|
154
|
+
snakegame --speed 10.0
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Controls
|
|
160
|
+
|
|
161
|
+
| Action | Primary Keys | Alternative Keys |
|
|
162
|
+
| :--- | :--- | :--- |
|
|
163
|
+
| **Move / Menu Navigate** | `↑` `↓` `←` `→` (Arrow Keys) | Custom Keys (`W` `A` `S` `D` default) |
|
|
164
|
+
| **Select / Confirm** | `Enter` | `Spacebar` |
|
|
165
|
+
| **Back / Cancel** | `ESC` | `B` / `Backspace` |
|
|
166
|
+
| **Pause / Resume** | `Spacebar` | `ESC` / `P` |
|
|
167
|
+
| **Restart Game** | `R` *(after Game Over)* | `Enter` / `Spacebar` |
|
|
168
|
+
| **Main Menu** | `M` *(after Game Over or Pause)* | `ESC` |
|
|
169
|
+
| **Quit** | `Q` | `ESC` (on Menu/GameOver) |
|
|
170
|
+
|
|
171
|
+
> 💡 **Custom Keybindings**: Configure your custom controls anytime from **Settings → Keybindings**! Changes are automatically saved to `~/.snakegame/settings.json`.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## About the Creator
|
|
176
|
+
|
|
177
|
+
Made with ❤️ by **ItsReZNuM**
|
|
178
|
+
|
|
179
|
+
- **GitHub Profile**: [https://github.com/ItsReZNuM](https://github.com/ItsReZNuM)
|
|
180
|
+
- **Repository**: [https://github.com/ItsReZNuM/SnakeGame-CLI](https://github.com/ItsReZNuM/SnakeGame-CLI)
|
|
181
|
+
- **Telegram**: [@ItsReZNuM](https://t.me/ItsReZNuM)
|
|
182
|
+
- **Instagram**: [@rez.num](https://instagram.com/rez.num)
|
|
183
|
+
|
|
184
|
+
⭐ **Enjoyed the game?** Please consider giving the repository a star on GitHub! It means a lot and helps support future development.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Development & Testing
|
|
189
|
+
|
|
190
|
+
Run all 38 automated unit tests with `pytest`:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
pytest -v
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Build source distribution and wheels:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
python -m build
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## License
|
|
205
|
+
|
|
206
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "reznum-snakegame"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A polished, retro Nokia-inspired Snake game for your terminal powered by Rich."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "ItsReZNuM", email = "rmohamadnia85@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"snake",
|
|
17
|
+
"game",
|
|
18
|
+
"cli",
|
|
19
|
+
"terminal",
|
|
20
|
+
"rich",
|
|
21
|
+
"nokia",
|
|
22
|
+
"retro",
|
|
23
|
+
"arcade"
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Environment :: Console",
|
|
28
|
+
"Intended Audience :: End Users/Desktop",
|
|
29
|
+
"Operating System :: Microsoft :: Windows",
|
|
30
|
+
"Operating System :: POSIX",
|
|
31
|
+
"Operating System :: MacOS",
|
|
32
|
+
"Programming Language :: Python :: 3",
|
|
33
|
+
"Programming Language :: Python :: 3.8",
|
|
34
|
+
"Programming Language :: Python :: 3.9",
|
|
35
|
+
"Programming Language :: Python :: 3.10",
|
|
36
|
+
"Programming Language :: Python :: 3.11",
|
|
37
|
+
"Programming Language :: Python :: 3.12",
|
|
38
|
+
"Topic :: Games/Entertainment :: Arcade",
|
|
39
|
+
]
|
|
40
|
+
dependencies = [
|
|
41
|
+
"rich>=13.0.0",
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
dev = [
|
|
46
|
+
"pytest>=7.0.0",
|
|
47
|
+
"build>=1.0.0",
|
|
48
|
+
"twine>=4.0.0",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
snakegame = "snakegame.cli:main"
|
|
53
|
+
snakegame-cli = "snakegame.cli:main"
|
|
54
|
+
reznum-snakegame = "snakegame.cli:main"
|
|
55
|
+
|
|
56
|
+
[project.urls]
|
|
57
|
+
Homepage = "https://github.com/ItsReZNuM/SnakeGame-CLI"
|
|
58
|
+
Repository = "https://github.com/ItsReZNuM/SnakeGame-CLI"
|
|
59
|
+
"Bug Tracker" = "https://github.com/ItsReZNuM/SnakeGame-CLI/issues"
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.packages.find]
|
|
62
|
+
where = ["src"]
|
|
63
|
+
|
|
64
|
+
[tool.pytest.ini_options]
|
|
65
|
+
testpaths = ["tests"]
|
|
66
|
+
pythonpath = ["src"]
|
|
67
|
+
python_files = ["test_*.py"]
|
|
68
|
+
python_functions = ["test_*"]
|