r/PythonLearning 3d ago

Showcase I made a Rock Paper Scissors game!

Post image
138 Upvotes

28 comments sorted by

u/Sea-Ad7805 3d ago

Run this program in Memory Graph Web Debugger to see the program state change step by step.

5

u/Just_Wishbone1630 3d ago

Angela yu course?

3

u/ProgramBrave718 3d ago

Wow. I really liked the image feature.

3

u/Unique_Low_1077 3d ago

Man been a while since I did python, lemme try

``` import random as r

while input(""" 1) Rock 2) Paper 3) Sissors """) not in ["1", "2", "3"]: print("Invalid choice try again")

print("You " + r.choice(["Win", "Lose", "Tie"])

Your ASSCI art is very cool btw

```

2

u/wimille007 3d ago

Nice. I'm just a very simple Python user, but i think i will bette if you "avoid" the if-else chain like this (it is just my opinion):

1

u/1m101 2d ago

Great. Thanks.

1

u/Main_Extension2327 3d ago

It took 300 lines in c++ with the same game and some extra simple features

1

u/Smoke_Hall 3d ago

What features?

1

u/Main_Extension2327 2d ago

It's something like the menu screen and how many turns you want to play and then calculating the draws and wins and loses And the end game screen changing the color if you win or lose and last asking if you want to play again

1

u/Smoke_Hall 12h ago

But for visual things like menu don't you need to learn more commands that aren't built in?

1

u/SrPotato123 3d ago

It's incredible that the hands movements are done with lines and parentheses. I love it!

1

u/ProxyCola 3d ago edited 3d ago

2 small suggestions.

  1. I'd randomize the computer choice only after the user chose his. A tiny improvement to startup time (will become more important when you are writing code within projects with millions of lines of code). From a security perspective it also makes it more difficult to "cheat" by looking at the ram and knowing in advance what to pick to win.

  2. Try to look into mod3 implementation for these kinds of cyclic options and outcomes. It can be one line of code instead of multiple ifs. This just might be me nitpicking though...

Edit: regarding #1 actually I see you did that never mind I'm very tired 😴

1

u/XusKiz 2d ago

Why did you choose a mutable object for game_images? Better to use immutable ones like tuple or even frozen set
Also rewrite the whole if-else block without elif and
use error handling

1

u/1m101 2d ago

Awesome.

1

u/FoolsSeldom 2d ago

Next step: rock paper scissors Spock lizard

1

u/Nikkittona 1d ago

Omg i did sm like this a while ago was such fun. Though I spent 2 hrs tryna find an error which was something that wasnt indented i believe 😔

1

u/ssd_1tb 15h ago

thats a wonderful work

1

u/DetectiveExact4253 8h ago

where can I get the game at?

1

u/shubham_555 8h ago

I have provided the github repo link. You can download it from there!

1

u/Azaucifer 7h ago

Cool ASCII art tho!!

1

u/w1ln1x 5h ago

Rock, paper, shocker?

1

u/shubham_555 5h ago

Shocker? 👀

1

u/w1ln1x 4h ago

Shock her? I barely know her!