A Python command-line game based on the classic Indian hand game — Snake, Water, Gun. Similar to Rock, Paper, Scissors but with a desi twist! 🇮🇳
🐍 SNAKE
/ \
/ \
drinks killed by
\ /
\ /
💧 WATER --drowns--> 🔫 GUN
| Player | Beats | Loses To |
|---|---|---|
| 🐍 Snake | 💧 Water | 🔫 Gun |
| 💧 Water | 🔫 Gun | 🐍 Snake |
| 🔫 Gun | 🐍 Snake | 💧 Water |
| Same choice | — | Draw 🤝 |
snake-water-gun/
│
├── game.py # Main game logic
├── score_history.txt # Auto-generated after first game
└── README.md # You are here!
git clone https://github.com/abhishekyadav59859/snake-water-gun.git
cd snake-water-gunpython game.py========================================
Welcome to Snake, Water, Gun!
========================================
🏆 Your current best: 4 wins
1. Play game
2. View score history
Enter 1 or 2: 1
Choose: snake / water / gun (or 'quit' to exit)
Your choice: snake
Computer chose: water
✅ You win this round!
Score — You: 1 | Computer: 0
...
========================================
Game over! Rounds played: 5
Final Score — You: 5 | Computer: 0
🎉 You won the game! Well played.
========================================
Score saved to score_history.txt!
🏆 New Personal Best! You scored 5 wins!
| Feature | Description |
|---|---|
| 🎮 Unlimited Rounds | Play as many rounds as you want |
| 🤖 Computer AI | Random computer moves every round |
| 📊 Live Score | Real-time score shown after every round |
| ✅ Input Validation | Handles typos and wrong inputs gracefully |
| 🏆 Personal Best Tracker | Tracks and celebrates your all-time highest score |
| 💾 Score History | Saves every game result to score_history.txt |
| 📅 Timestamps | Every saved game includes date and time |
| 📜 View History | Check past game scores from the main menu |
START
│
▼
┌─────────────┐
│ Main Menu │◄── Shows your current best score
└──────┬──────┘
│
┌─────┴──────┐
│ │
▼ ▼
Play Game View History
│ │
│ Shows all-time best
▼
Enter Choice
(snake/water/gun)
│
▼
Computer picks
random choice
│
▼
Determine Winner
┌───┴────┐────┐
▼ ▼ ▼
Win ✅ Lose ❌ Draw 🤝
│
▼
Continue or Quit?
│
▼
Save Score → Check Personal Best
│
▼
END
- 🔧 Python functions and modular code structure
- 🎲
randommodule for computer AI - 🖊️ User input handling and validation
- 📈 Score tracking and game loop logic
- 📁 File handling — reading & writing to text files
- ⏰
datetimemodule for timestamping records - 🏆 Parsing saved data to compute personal best scores
- 🌿 Git workflow — commits, push, pull, merge
Language : Python 3
Libraries : random, datetime (built-in — no installs needed!)
Platform : Command Line Interface (CLI)
- Add difficulty levels (easy / hard computer AI)
- Add multiplayer (2 players on same machine)
- Add a best-of-3 or best-of-5 mode
- Convert to GUI using Tkinter
- Add a leaderboard system
- Add colorful output using colorama library
- Add a High Score display in terminal
- Add a difficulty mode — Easy / Medium / Hard
Abhishek Yadav
Made with ❤️ and Python 🐍
⭐ Star this repo if you liked it!
⭐ Star this repo if you liked it!