Created
January 18, 2023 19:21
-
-
Save smileart/87b643e64fa097341b1aab2910f38651 to your computer and use it in GitHub Desktop.
Rock Paper Scissors Lizard Spock :: Python Version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
## | |
# Rock Paper Scissors Lizard Spock ASCII Art | |
# | |
# Rock | |
rock = """ | |
_______ | |
---' ____) | |
(_____) | |
(_____) | |
(____) | |
---.__(___) | |
""" | |
# Paper | |
paper = """ | |
________ | |
---' ____)____ | |
______) | |
_______) | |
_______) | |
---.__________) | |
""" | |
# Scissors | |
scissors = """ | |
_______ | |
---' ____)____ | |
______) | |
__________) | |
(____) | |
---.__(___) | |
""" | |
# Lizard | |
lizard = """ | |
---.___________ | |
_______) | |
---.________) | |
""" | |
# Spock | |
spock = """ | |
⌠⌒| | |
⌠⌒⌉| | ◜﹆◜﹆ | |
| ||⩧| / // / | |
|_|| | /-//=/ | |
| || |/ // / | |
( || | // / | |
| .______ | |
| __⫫____) | |
| | | |
""" | |
# Rules | |
# rock > scissors > lizard > paper > spock > rock | |
# https://d3qdvvkm3r2z1i.cloudfront.net/media/catalog/product/cache/1/image/1800x/6b9ffbf72458f4fd2d3cb995d92e8889/r/o/rockpaperscissorslizardspock_newthumb.png | |
# https://www.youtube.com/watch?v=x5Q6-wMx-K8 | |
# WARNING: Order of the hands below is important, do not change it!!! | |
hands = ["rock", "scissors", "lizard", "paper", "spock", "rock", "scissors"] | |
graphics = [rock, scissors, lizard, paper, spock] | |
human = input("Choose your hand: rock, paper, scissors, lizard, spock: ").lower() | |
computer = random.choice(hands) | |
human_index = hands.index(human) | |
computer_index = hands.index(computer) | |
print(f"You chose: {graphics[human_index]}") | |
print(f"Computer chose: {graphics[computer_index]}") | |
if human == computer: | |
print("It's a tie!") | |
elif hands[human_index + 1] == computer or hands[human_index + 2] == computer: | |
print("You win!") | |
else: | |
print("You lose!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment