Skip to content

Instantly share code, notes, and snippets.

@ArtikusHG
Created April 28, 2018 10:07
Show Gist options
  • Save ArtikusHG/2831657d368978a7ce913ab374dba455 to your computer and use it in GitHub Desktop.
Save ArtikusHG/2831657d368978a7ce913ab374dba455 to your computer and use it in GitHub Desktop.
The teacher told me I can get an additional A+...
import random
objects = ["Paper", "Scissors", "Stone", "Magma"]
playerScore = 0
aiScore = 0
magmaWasted = False
def whoWins(player):
global playerScore
global aiScore
global magmaWasted
player = player - 1
if player == 3 and magmaWasted == False:
print("You wasted your magma... So you win this round!")
playerScore += 1
magmaWasted = True
elif player == 3 and magmaWasted == True:
print("You tried to cheat... So we gave the AI some score!")
aiScore += 1
elif magmaWasted == False and player != 3:
ai = random.randint(0,2)
print("The player chooses " + objects[player] + "... And the AI chooses " + objects[ai] + "!")
if ai == 0 and player == 2:
print("So, the AI wins this round!")
aiScore += 1
elif ai == 2 and player == 0:
print("So, the player wins this round!")
playerScore += 1
elif ai > player:
print("So, the AI wins this round!")
aiScore += 1
elif ai < player:
print("So, the player wins this round!")
playerScore += 1
else:
print("The round ends in a draw!")
if playerScore == 3:
print("You got a score of 3... SO you get an extra Magma!")
magmaWasted = False
print("The player's score is " + str(playerScore) + ", and the AI's score is " + str(aiScore) + "\n")
print("Welcome to Paper, Scissors and Stone!\n\nRules:\n- There are five rounds\n- Paper is 1, Scissors is 2 and Stone is 3\n- You can choose Magma (4) that beats everything ONE time\n- You get an extra Magma if you get 3 wins\nGood luck!\n")
for i in range(1,6):
print("So round " + str(i) + " begins...\n")
player = int(input("Which one do you choose:"))
whoWins(player)
if aiScore > playerScore:
print("The AI wins the game!")
elif aiScore < playerScore:
print("The player wins the game!")
else:
print("The game ends in a draw!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment