import builtins as _b _b.input = (lambda read: lambda prompt="": read(str(prompt)))(_b.input) del _b try: exec(compile("import random\nimport time\nimport sys\n\n\nprint(\"You spawn in a room, without knowing why you are there. All you know is that you are craving some ice cream\" \\\n\"You see an ice cream machine in front of you. You also see two doors, one to the left and one to the right.\")\nprint(\"You really want some ice cream so you make it your mission to find some.\")\n\nprint(\"Where would you like to go?\")\ngame = True\n\ncoin1 = False\ncoin2 = False\n\ndef gameRunning():\n global coin1\n global coin2\n while game == True:\n \n answer = input(\"Type 1 to go to the ice cream machine, 2 to go to the left room, and 3 to go to the right room: \")\n time.sleep(0.5)\n match (answer):\n case \"1\":\n print(\"You walk to the ice cream machine. It asks for two nickels\")\n if coin1 == True and coin2 == True:\n time.sleep(0.5)\n print(\"You have enough money.\")\n if input(\"Do you buy the ice cream (y/n): \") == \"y\":\n time.sleep(0.5)\n print(\"Hooray you got the ice cream!\")\n sys.exit(0)\n else:\n time.sleep(0.5)\n else:\n time.sleep(0.5)\n print(\"You don't have enough money to buy the ice cream. Visit the other rooms to perhaps gain some.\")\n time.sleep(0.5)\n gameRunning()\n case \"2\":\n if coin1 == True:\n print(\"You already have this coin.\")\n time.sleep(1)\n gameRunning()\n print(\"You enter the left room. There, there is a shiny nickel on a tall platform. To bring the platform down, you have to roll a multiple of 4 on a 20 sided dice, and insert it into the machine.\")\n time.sleep(0.5)\n while True:\n leftDoorAnswer = input(\"Press enter to roll the dice or q to leave the room: \")\n if leftDoorAnswer == \"\":\n print(\"Rolling the dice...\")\n time.sleep(0.5)\n dice = random.randint(1,20)\n print(\"You rolled a \" + str(dice))\n if dice % 4 == 0:\n print(\"Hooray you acquired the nickel.\")\n coin1 = True\n break\n else:\n print(\"Unfortunately you did not get the nickel.\")\n elif leftDoorAnswer == \"q\":\n gameRunning()\n else:\n print(\"press one of the suggested keys please.\")\n \n\n case \"3\":\n if coin2 == True:\n print(\"You already have this coin.\")\n time.sleep(1)\n gameRunning()\n print(\"You see 4 boxes which you don't know the contents off. You can choose to search the boxes or leave the room\")\n correctBox = str(random.randint(1,4))\n while True:\n rightRoomAnswer = input(\"Type 1-4 to search the boxes or type q to leave the room: \")\n if rightRoomAnswer == \"q\":\n gameRunning()\n elif rightRoomAnswer != correctBox:\n print(\"Searching...\")\n time.sleep(0.5)\n print(\"Sorry, there was nothing inside\")\n elif rightRoomAnswer == correctBox:\n print(\"Searching...\")\n time.sleep(0.5)\n print(\"Hooray, you found a nickel inside!\")\n coin2 = True\n break\n else:\n print(\"please choose one of the options.\")\n\n case _:\n print(\"please choose one of the options\")\n\n\n\ngameRunning()\n", "script.py", "exec")) except SystemExit: pass