new comments

adding a few new comments for better documentation of the great job we did today :)
fruitual
bo 1 year ago
parent f7c50fc860
commit 5e4a8b5123

@ -1,5 +1,6 @@
import os , time , random import os , time , random
# Setting up the current (saved) state
currentRoom = "aquarium" currentRoom = "aquarium"
start = True start = True
graduation = False graduation = False
@ -12,13 +13,14 @@ items = {
inventory = [] 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): def printer (text):
for t in text: for t in text:
print(t, end = "", flush= True) print(t, end = "", flush= True)
time.sleep(random.choice([0.01, 0.05, 0.1, 0.03, 0.02])) time.sleep(random.choice([0.01, 0.05, 0.1, 0.03, 0.02]))
print() print()
# Defining the "taker" function and setting it up in each of the three rooms below
def taker(room): def taker(room):
if any(x in spliti for x in ["get", "grab", "take", "carry", "steal"]): if any(x in spliti for x in ["get", "grab", "take", "carry", "steal"]):
for item in items[room]: for item in items[room]:
@ -27,6 +29,7 @@ def taker(room):
inventory.append(item) inventory.append(item)
items[room].remove(item) items[room].remove(item)
# Creating the while-loop
while True: while True:
if (start == True): if (start == True):
printer("Graduation: The Game") printer("Graduation: The Game")
@ -35,26 +38,27 @@ while True:
if (graduation == True): if (graduation == True):
printer("You Win!") printer("You Win!")
exit() exit()
# Clearing the screen: "cls" for Windows; "clear" for macOS
i = input() i = input()
os.system("cls") os.system("cls")
spliti = i.split(" ") spliti = i.split(" ")
#inventory
# Creating an inventory
if "inventory" in i: if "inventory" in i:
printer("In you current inventory is " + ", ".join(inventory)) printer("In you current inventory is " + ", ".join(inventory))
# Choices in the aquarium # Choices in the aquarium
if currentRoom == "aquarium": if currentRoom == "aquarium":
if i in ["look","see","view","explore"]: if i in ["look","see","view","explore"]:
printer("Oh I'm in an aquarium cool") printer("Oh I'm in an aquarium cool")
printer("Oh look in the room! There is " + ", ".join(items["aquarium"])) printer("Oh look in the room! There is " + ", ".join(items["aquarium"]))
#finds the verb
elif i in ["exit","walk","run","door","leave"]: elif i in ["exit","walk","run","door","leave"]:
printer("You use the door to exit the aquarium") printer("You use the door to exit the aquarium")
currentRoom = "neutralzone" 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"]: elif i in ["learn","study","read", "pain", "frustration", "fun"]:
printer("You have studied really hard. Noice") printer("You have studied really hard. Noice")
study = study + 30 study = study + 30
@ -64,7 +68,7 @@ while True:
taker("aquarium") taker("aquarium")
# Choices in the neutral zone # Choices in the neutral zone
elif currentRoom == "neutralzone": elif currentRoom == "neutralzone":
if i in ["look","see","view","explore"]: if i in ["look","see","view","explore"]:
printer("Oh the BA students have a presentation. annoying.") printer("Oh the BA students have a presentation. annoying.")
@ -83,7 +87,7 @@ while True:
taker("neutralzone") taker("neutralzone")
# Choices in the office # Choices in the office
elif currentRoom == "office": elif currentRoom == "office":
if i in ["look","see","view","explore"]: if i in ["look","see","view","explore"]:
printer("Oh I'm in an office, look theres Leslie. cool.") 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"]: elif i in ["exit","walk","run","door","leave"]:
printer("You use the door to exit the office. Bye Leslie!") printer("You use the door to exit the office. Bye Leslie!")
currentRoom = "neutralzone" currentRoom = "neutralzone"
# The graduation condition, if ECTS points >= 119 --> Epic Win! If <119 --> Go study.
elif i in ["talk","discuss","debate","ask","say"]: elif i in ["talk","discuss","debate","ask","say"]:
printer("Hiiiiii Leslie!") printer("Hiiiiii Leslie!")
printer("Leslie: Hiiiiiii student, how can I help you?") printer("Leslie: Hiiiiiii student, how can I help you?")

Loading…
Cancel
Save