From d1f21ababa726aac31ba50ba9e507859278ec247 Mon Sep 17 00:00:00 2001 From: Manav55555555556357 <68435362+ekasnh@users.noreply.github.com> Date: Sat, 10 Aug 2024 21:28:57 +0530 Subject: [PATCH] game gae py by ekansh ik no one will ever see this and no one will ever acknowledge this shit but one day maybe one day awadhi will see this commit --- useless python game/game.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 useless python game/game.py diff --git a/useless python game/game.py b/useless python game/game.py new file mode 100644 index 0000000..d9ccea1 --- /dev/null +++ b/useless python game/game.py @@ -0,0 +1,37 @@ +import random + +# List of random syllables to generate nonsense words +syllables = ['bli', 'blu', 'bra', 'cri', 'cro', 'dra', 'dro', 'fla', 'flo', 'gra', 'gro', 'pli', 'plo', 'sli', 'slo', 'tra', 'tro'] + +def generate_nonsense_word(): + return random.choice(syllables) + random.choice(syllables) + random.choice(syllables) + +def play_game(): + print("Welcome to the Silly Word Generator Game!") + print("In this game, you'll have to guess the magic word.") + print("But beware... it's complete nonsense!") + + # Generate a list of nonsense words + words = [generate_nonsense_word() for _ in range(5)] + + # Randomly select one word as the "magic word" + magic_word = random.choice(words) + + print("\nHere are your nonsense words:") + for i, word in enumerate(words): + print(f"{i + 1}. {word}") + + # Get the player's guess + guess = input("\nWhich word do you think is the magic word? (Enter the number): ") + + try: + guess_index = int(guess) - 1 + if words[guess_index] == magic_word: + print(f"\nCongratulations! {words[guess_index]} was the magic word! You win!") + else: + print(f"\nOops! The magic word was actually {magic_word}. Better luck next time!") + except: + print("\nThat's not a valid number. Game over!") + +if __name__ == "__main__": + play_game()