Let's Play - Stone Paper Scissors
Two players. One keyboard. Zero mercy.
| π€ | Local 2βplayer β pass the keyboard, no accounts, no internet |
| β‘ | Instant verdict β one input each, result printed immediately |
| π‘ | Case-insensitive input β Stone, STONE, and stone all work |
| π§ | Classic rules β stone beats scissor, scissor beats paper, paper beats stone |
| πͺΆ | Tiny footprint β a single file, pure Python, zero dependencies |
flowchart TD
A([Start game]) --> B[Clear screen & greet players]
B --> C[user1 enters a shape]
C --> D[user2 enters a shape]
D --> E{Compare shapes}
E -->|user1's shape beats user2's| F[π user1 WINS]
E -->|user2's shape beats user1's| G[π user2 WINS]
E -->|Same shape| H[π€ It's a tie β try again]
E -->|Unrecognized word| I[β Invalid syntax]
| user1 plays | beats | user2 plays |
|---|---|---|
| πͺ¨ stone | crushes | βοΈ scissor |
| π paper | covers | πͺ¨ stone |
| βοΈ scissor | cuts | π paper |
Same shape on both sides β tie. Anything else β invalid input.
- Python 3 installed on your machine
git clone <your-repo-url>
cd <your-repo-folder>
python3 rps.pyHELLO GUYZ! SHAKE YOUR HANDS. AFTER SHAKING , Enter data:)
user1 ENTER YOUR SHAPE: stone
user2 ENTER YOUR SHAPE: scissor
CONGRATS user1 WINS!
(Verified by actually running the script through every combination of stone / paper / scissor, plus a tie and an invalid word β all eight cases returned the correct message.)
Being upfront about what was checked, since a README should never overpromise:
- All 6 win conditions produce the correct winner.
- All 3 tie conditions (
stone/stone,paper/paper,scissor/scissor) correctly print "BOTH SHAPES ARE SAME!" with no crash. - Unrecognized input (e.g.
rock) correctly falls through to "INVALID SYNTAX!". - Heads-up:
os.system("cls")only clears the screen on Windows. On macOS/Linux it's a no-op (theclscommand doesn't exist there), so the screen simply won't clear β harmless, but worth knowing if you're on Mac/Linux and wondering why old output lingers. Swap inos.system("cls" if os.name == "nt" else "clear")if you want it cross-platform.
.
βββ rps.py # the game
βββ README.md
βββ assets/
βββ banner.svg
βββ terminal-demo.svg
Got an idea β best-of-3 rounds, a computer opponent, colored terminal output? PRs and issues are welcome.
This project is licensed under the MIT License β free to use, copy, modify, and share.
πͺ¨ π βοΈ May the best shape win.