Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save HandsonMatheus/6d0ff90f8ddcfccba98c7b7773c67cf5 to your computer and use it in GitHub Desktop.

Select an option

Save HandsonMatheus/6d0ff90f8ddcfccba98c7b7773c67cf5 to your computer and use it in GitHub Desktop.
Rock, paper, scissors
import random
import time
rock = 1
paper = 2
scissor = 3
def cpu_intelligence():
cpu = random.randint(1, 3)
if cpu == 1:
return rock
elif cpu == 2:
return paper
else:
return scissor
def main():
while True:
print("(⌐■_■): S-So, you came. We're facing again.")
time.sleep(2)
print("YOU: C-C-CPU, I'm ready to play!")
time.sleep(2)
print("(⌐■_■): *take off his glasses slowly.")
time.sleep(2)
print("(ง •̀_•́)ง: Let's play Rock, Paper, Scissors!")
time.sleep(2)
print("[1] ROCK")
print("[2] PAPER")
print("[3] SCISSORS")
try:
player_choice = int(input("Your move >>> "))
if player_choice < 1 or player_choice > 3:
print("Bro, come on... Choose a valid option.")
return
except ValueError:
print("Are you stupid?")
return
print("PREPARE YOUR HAND! ᕦ( ͡° ͜ʖ ͡°)ᕤ CPU is getting ready...")
time.sleep(2)
print("...")
time.sleep(1)
print("CPU is ready! (ง ͠° ͟ʖ ͡°)ง")
time.sleep(1)
print("3...")
time.sleep(1)
print("2...")
time.sleep(1)
print("1...")
time.sleep(1)
cpu_choice = cpu_intelligence()
print(f"╰( ͡° ͜ʖ ͡° )つ CPU choose: {cpu_choice}")
if player_choice == cpu_choice:
print("That's a draw! You guys are fast af.")
elif (player_choice == rock and cpu_choice == scissor) or \
(player_choice == paper and cpu_choice == rock) or \
(player_choice == scissor and cpu_choice == paper):
print("You win!")
else:
print("You lose MF!")
play_again = input("Another round? [y/n] >>> ").lower()
if play_again != "y":
print("Thanks for playing!")
break
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment