print("Hello welcome to Type Fighter , this is an exciting game that test your typing speed") import time def countdown(seconds): while seconds > 0: seconds -= 1 time.sleep(1) import random words_for_goblin = ["crab", "grow", "screw"] words_for_minion_and_giant = ["abroad", "accept", "access", "agenda", "almost", "copper", "corner", "costly"] # player class class Player(): def __init__(self, health, damage): self.health = health self.damage = damage def health_dec(self): self.health = (self.health - 20) player = Player(100, 20) # personal stats stats = input("do you want to see your stats : " ) if stats == "yes": print(player.__dict__) # part 2 choose enemy/difficulty enemy_choice = input("choose your enemy \ngoblin(easy) - 4 letter word 6 seconds \nminion(medium) - 6 letter word 6 seconds \ngiant(hard) - 6 letter word 5 seconds \n: ") class enemy(): def __init__(self, health, damage): self.damage = damage self.health = health def health_dec(self): self.health = (self.health - 20) if enemy_choice == "goblin": goblin = enemy(100, 20) print(goblin.__dict__) elif enemy_choice == "giant": giant = enemy(150, 10) print(giant.__dict__) elif enemy_choice == "minion": minion = enemy(80, 30) print(minion.__dict__) else: print("choose appropriate enemy") # part 3 fight approval = input("the game is about to begin, are you ready : ") if approval == "yes": if enemy_choice == "minion": seconds = 6 while seconds > 0: on_screen = random.choice(words_for_minion_and_giant) print(on_screen) ans = input("type the word on screen : ") countdown(6) if ans == on_screen: minion.health_dec() print(minion.health) elif ans != on_screen: print("wrong word") player.health_dec() print(player.health) if player.health == 0: print("you died") break if minion.health == 0: print("enemy defeated") break if seconds == 0: print("ran out of time")