Skip to content

Commit

Permalink
The Longer/Normal Version!
Browse files Browse the repository at this point in the history
  • Loading branch information
ARealWant authored Feb 19, 2021
1 parent 9b17b24 commit 9e4a1bf
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions ScissorsRockPaper.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,14 @@
while game_status is True: # Due to game_status will be True all the time, we're putting the process in the while loop

# The player will choose their figur here
player_choose = 0
while player_choose not in(1,2,3):
player_choose = int(input("\n[1] Scissors | [2] Rock | [3] Paper\n"))
# Tip: \n is the standard newline character, which prints a new line after printing the opportunities to choose
player_figur = figure[player_choose - 1]
try:
player_choose = 0
while player_choose not in(1,2,3):
player_choose = int(input("\n[1] Scissors | [2] Rock | [3] Paper\n"))
# Tip: \n is the standard newline character, which prints a new line after printing the opportunities to choose
player_figur = figure[player_choose - 1]
except:
continue # Should the player gives a wrong type, like a string e.g. we will catch the ValueError here

# Figur the computer will choose randomly, for this process we're going to use our already imported random
computer_figur = figure[random.randint(0, 2)] # Tip: Not "0,3" because you start count at zero in Python
Expand Down Expand Up @@ -51,14 +54,17 @@



choose_restart = "" # We're expecting a string, that's why we're defining it here
choose_restart = ""
while choose_restart.lower() not in ("y", "n"): # We're using the builtin .lower() here, should the player send the letter in caps the input will be lowercase automatically
# Tip: Should the player give us something else than "y" and "n", we'll show them the opportunities again = while loop
# Tip: Don't forget that game_status is set to True already, due to that the game will start again
choose_restart = input("\n[🔁] Restart the game? [y] YES | [n] NO\n")
time.sleep(2)

if choose_restart == "y":
game_status = True

if choose_restart == "n":
print("\n[✋] Alright! Game has been stopped, you can start it whenever you want again.\n")
time.sleep(5)
game_status = False # We'll stop the while loop with setting this to False, as mentioned above
time.sleep(2)
game_status = False # We'll stop the while loop with setting this to False, as mentioned above

0 comments on commit 9e4a1bf

Please sign in to comment.