🎮 GAME: Goblin Hunt

PHOTO EMBED

Mon Oct 24 2022 10:20:34 GMT+0000 (Coordinated Universal Time)

Saved by @L0uJ1rky45M #python

import random

number_of_doors = 5

# Display welcome messages
print("Welcome to the Goblin Hunt")
print("An award-winning game full of adventure and excitement (!)")

# Get player name
player_name = input("What is your name? ")
print( player_name + ", a goblin is hiding in one of the kitchen cupboards. Do you think that you can find it?")

print("|_|" * number_of_doors)

goblin_position = random.randint(1, number_of_doors)

keep_trying = True

# Main game loop
while keep_trying:
  guessed_position = input("Can you guess where the goblin is hiding? ")
  guessed_position = int(guessed_position)

  if guessed_position == goblin_position:  # If player guesses correctly
    print("Well done. You've found the goblin.")
    keep_trying = False
  else:  # If player's guess is incorrect
    print("No, sorry. The goblin is still hiding somewhere.")
    
print("Thank you for playing. Now get back to work!")
content_copyCOPY

https://thepythoncodingbook.com/1-getting-started-with-the-fundamentals-of-programming/