From 5e4a8b512389268a30e3aecff60e062118223149 Mon Sep 17 00:00:00 2001 From: bo Date: Tue, 24 Jan 2023 23:05:00 +0100 Subject: [PATCH] new comments adding a few new comments for better documentation of the great job we did today :) --- states.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/states.py b/states.py index e5848b7..98e3ba9 100644 --- a/states.py +++ b/states.py @@ -1,5 +1,6 @@ import os , time , random +# Setting up the current (saved) state currentRoom = "aquarium" start = True graduation = False @@ -12,13 +13,14 @@ items = { inventory = [] -#seperating the text and printing in delay +# Seperating the text and printing in delay so the content on the screen is readable and easy to comprehend def printer (text): for t in text: print(t, end = "", flush= True) time.sleep(random.choice([0.01, 0.05, 0.1, 0.03, 0.02])) print() +# Defining the "taker" function and setting it up in each of the three rooms below def taker(room): if any(x in spliti for x in ["get", "grab", "take", "carry", "steal"]): for item in items[room]: @@ -27,6 +29,7 @@ def taker(room): inventory.append(item) items[room].remove(item) +# Creating the while-loop while True: if (start == True): printer("Graduation: The Game") @@ -35,26 +38,27 @@ while True: if (graduation == True): printer("You Win!") exit() - + +# Clearing the screen: "cls" for Windows; "clear" for macOS i = input() os.system("cls") spliti = i.split(" ") -#inventory + +# Creating an inventory if "inventory" in i: printer("In you current inventory is " + ", ".join(inventory)) -# Choices in the aquarium +# Choices in the aquarium if currentRoom == "aquarium": if i in ["look","see","view","explore"]: printer("Oh I'm in an aquarium cool") printer("Oh look in the room! There is " + ", ".join(items["aquarium"])) - - #finds the verb - + elif i in ["exit","walk","run","door","leave"]: printer("You use the door to exit the aquarium") currentRoom = "neutralzone" - + +# The ECTS condition, or the point-gaining system. Every "study" adds 30 points to the player's score. The goal is to reach 120 points or credits. elif i in ["learn","study","read", "pain", "frustration", "fun"]: printer("You have studied really hard. Noice") study = study + 30 @@ -64,7 +68,7 @@ while True: taker("aquarium") -# Choices in the neutral zone +# Choices in the neutral zone elif currentRoom == "neutralzone": if i in ["look","see","view","explore"]: printer("Oh the BA students have a presentation. annoying.") @@ -83,7 +87,7 @@ while True: taker("neutralzone") -# Choices in the office +# Choices in the office elif currentRoom == "office": if i in ["look","see","view","explore"]: printer("Oh I'm in an office, look theres Leslie. cool.") @@ -92,7 +96,8 @@ while True: elif i in ["exit","walk","run","door","leave"]: printer("You use the door to exit the office. Bye Leslie!") currentRoom = "neutralzone" - + +# The graduation condition, if ECTS points >= 119 --> Epic Win! If <119 --> Go study. elif i in ["talk","discuss","debate","ask","say"]: printer("Hiiiiii Leslie!") printer("Leslie: Hiiiiiii student, how can I help you?")