Built a Snake-Water-Gun Game in Python Just created my own version of the classic hand game - think Rock-Paper-Scissors with a twist! Had a blast building this mini project from scratch. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 🎯 How It Works: 🐍 Snake drinks Water 💧 Water rusts Gun 🔫 Gun shoots Snake ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✨ What I Built: Smart computer opponent with randomized moves Clean input validation system Multiple rounds with replay option User-friendly interface with instant feedback Modular, well-documented code structure ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 💡 Skills Applied: This project helped me practice Python fundamentals including dictionary mappings, control flow logic, the random module, function-based architecture, and handling user input effectively. ━━━━━━━━━━━━━━━━━━━━ 🔗 Code available on GitHub : https://lnkd.in/dQjEDmW7 💬 Drop a comment if you'd like to see a tutorial walkthrough! Always excited to learn and build! 💻✨ #Python #PythonProgramming #Coding #Programming #LearnToCode #Developer #SoftwareEngineering #TechProjects #CodeNewbie #PythonProjects #OpenSource #GitHub #BuildInPublic #DeveloperCommunity
More Relevant Posts
-
Ever had a “perfect” Python function quietly break in production — and wondered why your tests didn’t catch it? I did. I thought my unit tests covered all cases until Hypothesis came along and threw hundreds of unexpected inputs at my code. Suddenly, edge cases I never imagined popped up, exposing bugs hidden deep inside. Hypothesis flips testing on its head: instead of writing examples, you describe the properties your code should always follow. Then it generates countless inputs, hunting for the exact one that makes your code fail — and it even shrinks that input so debugging feels less like detective work and more like solving a puzzle. From checking that encoding and decoding always round-trip correctly, to revealing bugs in cache eviction policies, or validating optimized functions against simple references — this tool makes your code bulletproof in ways traditional tests can’t. 🛠 Catch weird edge cases without brainstorming endless inputs ⚡ Test complex data models or stateful classes efficiently 🔎 Find the exact failing example to debug faster What if your next bug isn’t a mystery but a challenge waiting for Hypothesis to uncover? Ever let your tests surprise you? What hidden bugs has property-based testing caught for you? #Python #DataScience #SoftwareTesting #Hypothesis #CodingTips #QualityAssurance #DeveloperLife
To view or add a comment, sign in
-
-
Really enjoyed this read from Python Snacks about using uv to help sidestep having to create a new virtual environment when working on a quick project (or perhaps having to deal with some other dependencies). Classically speaking, you would either have to pollute your current environment or switch over to a new environment. A really cool feature with uv allows you to declare dependencies in your python script directly. The syntax is as follows: # /// script # dependencies = ['package_1', 'package_2'] # /// uv will create a temp virtual environment prior to the script executing, install the dependencies, and execute the script. At the conclusion of the script execution, the virtual environment will be deleted. This is incredible for quick projects, prototyping, or avoiding having to set up a virtual environment for those who that may not be a common workflow for them. Below is an example script named test.py that I used this on: # /// script # dependencies = ["numpy"] # /// import numpy as np x = np.array([[1,2,3], [4,5,6]]) print(x) I then ran (in a terminal): python -m uv run test.py Below was the output I got: Installed 1 package in 450ms [[1 2 3] [4 5 6]] Really cool! Thankful they shared this article! #Python #VirtualEnvironments #DevTools #PythonTips #CodeSnippets #PyDev #PythonSnacks #SoftwareEngineering #Prototyping #RapidDevelopment #PythonScripts #DependencyManagement #UVTool #CodingProductivity #PythonEcosystem
To view or add a comment, sign in
-
“From Rock-Paper-Scissors to Snake-Water-Gun: A Python Twist” A console-based Snake, Water, Gun game (our local twist on Rock, Paper, Scissors). It’s simple, interactive, and a great refresher in Python fundamentals. Here’s what’s happening under the hood: 1. The random module helps the computer make its choice. 2. User input is validated and compared against game rules. 3. A clean logic system decides the winner each round: Gun beats Snake Snake beats Water Water beats Gun 4. The program tracks and displays ongoing scores until the user decides to stop. 🧠 Main methods used: 1. get_computer_choice() → random selection 2. get_user_choice() → user input validation 3. check_winner() → rule-based comparison logic 4. display_result() → formatted output with results 5. play_game() → the main loop managing flow and scores 💡 Key takeaways: This project is a compact demo of Python’s functions, loops, conditionals, and user interaction — all working together in a smooth, replayable program. Sometimes, the best way to stay sharp is to build something small that makes you smile. #Python #Programming #Coding #SoftwareDevelopment #Developer #PythonProjects #GameDevelopment #TechCommunity #LearnByBuilding #AI #ProblemSolving
To view or add a comment, sign in
-
🎮 Built a Rock-Paper-Scissors Game in Python — With a GUI Twist! Needed a break from dashboards and data pipelines, so I whipped up something fun: a Rock-Paper-Scissors game using Python and Tkinter! It’s a simple project, but packed with personality — and a great way to flex those GUI muscles. 💡 What it does: 1. You pick Rock, Paper, or Scissors — your move, your rules. 2. The computer picks too (randomly, like a squirrel on espresso). 3. You get instant results: win, lose, or tie — all with a splash of drama. There’s even a “Play Again” button, because let’s be honest… one round is never enough. 🏆 What you’ll see: 1. You Win! 🎉 Time to brag. 2. Computer Wins! 🤖 Bow to the silicon overlord. 3. It’s a Tie! 🍪 Everyone gets cookies. 🧰 Tech Stack: 1. Tkinter for the GUI 2. random for the computer’s chaotic energy 3. PIL and time if you want to get fancy with images or suspense 😄 Why I built it: Sometimes, you just want to code something playful. This project helped me brush up on event handling, GUI layout, and making Python feel like a game engine — minus the 3D headaches. Want to try it out or see the code? Drop a ✋ and I’ll send the warriors your way. #PythonProjects #PIL #Tkinter #RockPaperScissors #WeekendBuild #LearnByBuilding #PlayAgain
To view or add a comment, sign in
-
🚀 Just built the first version of my own programming language — JSC (Just a Simple Compiler)! Over the past few days, I’ve been experimenting with building a custom compiler and interpreter using Python. The idea is to have a simple, human-readable scripting language that ends statements with semicolons, uses var for declarations, render for output, and even supports a future AI helper command assist. Here’s a quick example: /-----------------------------------------------/ | | *c Just a Simple Compiler Example v1.1 | | var name = "Manvendra"; | var x = 5; | var y = 10; | | render "Hello, " + name + "!"; | var total = y - x; | render "Total = " + total; | /-----------------------------------------------/ Running this gives: /-----------------------/ | | Hello, Manvendra! | Total = 5 | /-----------------------/ I also added type-smart addition, comments, and planned AI-assisted syntax hints 👨💻 Still early, but it feels great seeing something I imagined actually run line by line like a real language. Will keep evolving it — maybe next step: loops, conditionals, and basic error handling! #Python #CompilerDesign #ProgrammingLanguage #DevProject #LearningInPublic #FrontendToSystems
To view or add a comment, sign in
-
-
Can you unlock them all with one question? My daughter is working on a Python assignment for Guess Who. She’s using a series of nested if-else statements to identify each character. While writing code to guess the character is easy, figuring out how to do it with the fewest questions is a problem of heuristics; how to make the smartest decisions with limited information. To reframe the challenge, imagine looking at just five rows of character data and designing questions that lead to the right answer with the minimum number of decisions. In this case, hobbies tend to be unique, so asking about a hobby can quickly pinpoint the character. I’ve attached a gist that includes a generalized version of the code, which applies this heuristic by peeking into five rows. https://lnkd.in/gsChQQxB
To view or add a comment, sign in
-
-
Ever wondered why your Python code looks right but doesn’t “work” the way you expect? from my last post, i made a simple calculator program. But what if the result from our arithmetic operation requires being stored to be reused subsequently? Let’s talk about one of the most common confusions for beginners, the difference between return and print. At first glance, they look like twin. But trust me, they’re more like cousins who live in different cities. Here’s the difference 👇 🔹 print() Displays the result on your screen Great for showing outputs while testing or debugging But once it’s printed and it’s gone, you can’t reuse that value 🔹 return Sends the result back to the program Allows you to reuse it, store it, or process it further It doesn’t display anything unless you tell it to Think of it this way: print() is like talking out loud, people can hear it, but it vanishes afterward. return is like sending a message, it can be read, stored, and acted upon later. When I finally understood this difference, my functions started making sense , and my code started thinking for itself. The real growth happens when you stop writing code just to see results… and start writing code that can use those results. 👇 Now it’s your turn: If you had to explain return vs print to a total beginner, what funny analogy would you use? Drop yours in the comments let’s make learning Python fun again! 💬🐍 #PythonProgramming #LearnPython #CodingCommunity #Developers #ProblemSolving #ProgrammingLife #PythonDeveloper #TechInnovation #CodeNewbie #Automation #LinkedInLearning #DigitalSkills #TechEducation #CodeYourWorld
To view or add a comment, sign in
-
-
Hey everyone! 👋 As part of my new series “1% Smarter with Python Daily”, here’s Day 1. If you’re using print() statements for debugging and monitoring your Python code, you’re definitely not alone. But here’s the thing — for anything beyond quick one-time scripts, print() often falls short. That’s where the built-in logging module comes in. Here’s why using logging rather than print() can level up your code: With logging, you get severity levels (DEBUG, INFO, WARNING, ERROR, CRITICAL) — so you can distinguish between normal messages vs alerts. You can direct output not just to console, but to files, sockets, or external systems — much harder when you scatter print()s. Stack Overflow+1 You get contextual information automatically: timestamps, module name, line number — helps when debugging later rather than just in the moment. print() is fine for small throwaway scripts — but once your codebase grows, you’ll thank yourself for not relying exclusively on print(). Why this is better than print(): If you want to silence debug logs in production you just change the log level, without removing/changing calls in code. All logs go through the same centralized system; you can redirect to a file, filter by module, tag by severity. Helps you maintain code clarity, production readiness, and better observability. ✅ Takeaway Challenge: Instead of writing print("something happened:", x) when you’re debugging or logging events — try replacing it with logger.info() or logger.debug() (depending on severity) and configure your logging as shown. I challenge you: in your next script, swap out one print() and replace it with logging. See how it changes the flow, how you filter logs, and what it gives you. #Python #Coding #DeveloperTips #Logging #SoftwareEngineering #TechTips #PythonTips #CleanCode
To view or add a comment, sign in
-
-
# MicroPython or similar on UNIHIKER K10 import camera_module, qr_scanner, wifi_module, servo_driver, time # Setup wifi_module.connect(ssid, pw) servo_driver.setup(lock_pin) button = digital_input(pin_button) state = "idle" while True: if button.pressed(): if state == "idle": # Start borrow process board.display("Scan your user QR") user_id = qr_scanner.scan() board.display("Scan item QR") item_id = qr_scanner.scan() board.display("Unlocking...") servo_driver.unlock() time.sleep(lock_open_time) servo_driver.lock() # Log event wifi_module.send_json({ "event":"borrow", "user": user_id, "item": item_id, "time": time.time() }) state = "borrowed" elif state == "borrowed": # Return process board.display("Scan item QR to return") item_id = qr_scanner.scan() board.display("Scan your user QR") user_id = qr_scanner.scan() board.display("Unlocking...") servo_driver.unlock() time.sleep(lock_open_time) servo_driver.lock() wifi_module.send_json({ "event":"return", "user": user_id, "item": item_id, "time": time.time() }) state = "idle" # optionally, check for overdue items and alert time.sleep(0.1)
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Good job👍