From 4dacaef6db3daf9e855bc39b16674d74ebba5e90 Mon Sep 17 00:00:00 2001 From: beastelassi Date: Thu, 1 Oct 2020 12:48:14 +0100 Subject: [PATCH 1/6] added main py HELP THIS IS HARD --- main.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..20a6c22 --- /dev/null +++ b/main.py @@ -0,0 +1,29 @@ +''' + +sphinx story +is good + +''' + + +def start(): + loop = True + + while loop == True: + + + difficulty = input("Enter Difficulty:\nA = EASY\nB = MEDIUM\nC = HARD\n->") + if difficulty == "a" or difficulty == "A": + print("You have selected EASY") + loop = False + elif difficulty == "b" or difficulty == "B": + print("You have selected MEDIUM") + loop = False + elif difficulty == "c" or difficulty == "C": + print("You have selected HARD") + loop = False + else: + print("Please enter a valid option.") + +# Main block +start() \ No newline at end of file From 10329503b16f272a808b4c4639b3e0b88871581a Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 13:07:42 +0100 Subject: [PATCH 2/6] typing git comming in the command line makes you edit a message like i am doing now --- main.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 20a6c22..59d536c 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,8 @@ sphinx story is good +choice = input("Enter choice:\nA = []\nB = []\nC = []\n->") + ''' @@ -11,7 +13,6 @@ def start(): while loop == True: - difficulty = input("Enter Difficulty:\nA = EASY\nB = MEDIUM\nC = HARD\n->") if difficulty == "a" or difficulty == "A": print("You have selected EASY") @@ -25,5 +26,27 @@ def start(): else: print("Please enter a valid option.") + # Main block -start() \ No newline at end of file +start() + +loop = True +while loop == True: + + print("You are reading a magazine. The phone rings.") + choice = input("Enter choice:" + "\nA = [Continue reading the magazine]" + "\nB = [Inspect the room]" + "\nC = [You pick up the phone]" + "\n->") + if choice == "a" or choice == "A": + print("You have selected A") + loop = False + elif choice == "b" or choice == "B": + print("You have selected B") + loop = False + elif choice == "c" or choice == "C": + print("You have selected C") + loop = False + else: + print("Please enter a valid option.") From 4e18083d851c9f079d54a2133f2c4ee820632816 Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 17:10:56 +0100 Subject: [PATCH 3/6] attempt at making things easier to work with e.g. less copy pasting of code --- alternative.py | 152 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 alternative.py diff --git a/alternative.py b/alternative.py new file mode 100644 index 0000000..749f143 --- /dev/null +++ b/alternative.py @@ -0,0 +1,152 @@ +''' + +sphinx story +is good + +https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx + +choice = input("Enter choice:\nA = []\nB = []\nC = []\n->") + +''' + +history = [] # empty storage area for choices + +def start(): + loop = True + difficulty = "" + + while loop == True: + + difficulty = input("Enter Difficulty:\nA = EASY\nB = MEDIUM\nC = HARD\n->") + if difficulty == "a" or difficulty == "A": + print("You have selected EASY") + loop = False + elif difficulty == "b" or difficulty == "B": + print("You have selected MEDIUM") + loop = False + elif difficulty == "c" or difficulty == "C": + print("You have selected HARD") + loop = False + else: + print("Please enter a valid option.") + + history.append(difficulty.upper()) + + +def getAnswer1(question, text): + loop = True + choice = "" + + while loop == True: + print(question) + choice = input("Enter choice:" + "\nA = " + text["A"] + + "\n->") + + if choice == "a" or choice == "A": + print("You have selected A: " + text[choice.upper()]) + loop = False + else: + print("Please enter a valid option.") # runs if the answer is not valid + + history.append(choice.upper()) # adds the choice the user picked + + +def getAnswer2(question, text): + loop = True + choice = "" + + while loop == True: + print(question) + choice = input("Enter choice:" + "\nA = " + text["A"] + + "\nB = " + text["B"] + + "\n->") + + if choice == "a" or choice == "A": + print("You have selected A: " + text[choice.upper()]) + loop = False + elif choice == "b" or choice == "B": + print("You have selected B: " + text[choice.upper()]) + loop = False + else: + print("Please enter a valid option.") # runs if the answer is not valid + + history.append(choice.upper()) # adds the choice the user picked + +def getAnswer3(question, text): + loop = True + choice = "" + + while loop == True: + print(question) + choice = input("Enter choice:" + "\nA = " + text["A"] + + "\nB = " + text["B"] + + "\nC = " + text["C"] + + "\n->") + + if choice == "a" or choice == "A": + print("You have selected A: " + text[choice.upper()]) + loop = False + elif choice == "b" or choice == "B": + print("You have selected B: " + text[choice.upper()]) + loop = False + elif choice == "c" or choice == "C": + print("You have selected C: " + text[choice.upper()]) + loop = False + else: + print("Please enter a valid option.") # runs if the answer is not valid + + history.append(choice.upper()) # adds the choice the user picked + + +def getAnswer4(question, text): + loop = True + choice = "" + + while loop == True: + print(question) + choice = input("Enter choice:" + "\nA = " + text["A"] + + "\nB = " + text["B"] + + "\nC = " + text["C"] + + "\nC = " + text["D"] + + "\n->") + + if choice == "a" or choice == "A": + print("You have selected A: " + text[choice.upper()]) + loop = False + elif choice == "b" or choice == "B": + print("You have selected B: " + text[choice.upper()]) + loop = False + elif choice == "c" or choice == "C": + print("You have selected C: " + text[choice.upper()]) + loop = False + elif choice == "d" or choice == "D": + print("You have selected D: " + text[choice.upper()]) + loop = False + else: + print("Please enter a valid option.") # runs if the answer is not valid + + history.append(choice.upper()) # adds the choice the user picked + +# Main block +start() + +question = "You are reading a magazine. The phone rings." + +text = {"A": "Continue reading the magazine", + "B": "Inspect the room", + "C": "You pick up the phone" + } + +getAnswer3(question, text) + +print(history) # prints the history of choices made by the user + +if history[1] == "A": + question = "You continue Archaeologist's Digest and read about how there's been a new discovery in Giza. How interesting. You can't read much further because the phone is still ringing. Loudly. " + text = {"A": "Answer"} + getAnswer1(question,text) + print(history) \ No newline at end of file From 147286a417d7198de0f9a9bb909f17ecfecb2fe3 Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 17:28:35 +0100 Subject: [PATCH 4/6] help --- alternative.py | 38 ++++++++++++++++++++++++++++---------- main.py | 9 +++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/alternative.py b/alternative.py index 749f143..e29e305 100644 --- a/alternative.py +++ b/alternative.py @@ -5,13 +5,12 @@ is good https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx -choice = input("Enter choice:\nA = []\nB = []\nC = []\n->") - ''' history = [] # empty storage area for choices -def start(): + +def start(): # super unnecessary and can be removed loop = True difficulty = "" @@ -33,7 +32,7 @@ def start(): history.append(difficulty.upper()) -def getAnswer1(question, text): +def getAnswer1(question, text): # function to handle 1 response from the user loop = True choice = "" @@ -52,7 +51,7 @@ def getAnswer1(question, text): history.append(choice.upper()) # adds the choice the user picked -def getAnswer2(question, text): +def getAnswer2(question, text): # function to handle 2 responses from the user loop = True choice = "" @@ -74,7 +73,7 @@ def getAnswer2(question, text): history.append(choice.upper()) # adds the choice the user picked -def getAnswer3(question, text): +def getAnswer3(question, text): # function to handle 3 responses from the user loop = True choice = "" @@ -101,7 +100,7 @@ def getAnswer3(question, text): history.append(choice.upper()) # adds the choice the user picked -def getAnswer4(question, text): +def getAnswer4(question, text): # function to handle 4 responses from the user loop = True choice = "" @@ -143,10 +142,29 @@ text = {"A": "Continue reading the magazine", getAnswer3(question, text) -print(history) # prints the history of choices made by the user +print(history) # prints the history of choices made by the user, not really needed. if history[1] == "A": - question = "You continue Archaeologist's Digest and read about how there's been a new discovery in Giza. How interesting. You can't read much further because the phone is still ringing. Loudly. " + question = "You continue Archaeologist's Digest and read about how there's been a new discovery in Giza. How interesting.\nYou can't read much further because the phone is still ringing. Loudly. " text = {"A": "Answer"} - getAnswer1(question,text) + getAnswer1(question, text) + print(history) +elif history[1] == "B": + question = "You're in your office. Large shelves are stacked from end to end.From ancient Latin and Hebrew to Greek and Hieroglyphics.\nPictures from previous expeditions are framed on the wall." + text = {"A": "Inspect images", + "B": "Inspect books", + "C": "Back to the magazine" + } + getAnswer3(question, text) + print(history) + if history[2] == "C": + pass # some sort of way to get back to the phone? do we store the data somewhere else? gg python i am confused +elif history[1] == "C": + question = "Ethan Stewart speaking, an interesting and rather weird door has been dug up.\nNo amount of force has worked on the door and I thought I'd contact you as the leading expert in hieroglyphs.\nI want you to fly over to Giza immediately and inspect the door." + text = {"A": "…", + "B": "Is it urgent? And who are you anyway?", + "C": "Don’t tell me what to do!", + "D": "I’ll be on my way." + } + getAnswer4(question, text) print(history) \ No newline at end of file diff --git a/main.py b/main.py index 59d536c..6da59ad 100644 --- a/main.py +++ b/main.py @@ -3,10 +3,13 @@ sphinx story is good +https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx + choice = input("Enter choice:\nA = []\nB = []\nC = []\n->") ''' +history = [] def start(): loop = True @@ -26,6 +29,8 @@ def start(): else: print("Please enter a valid option.") + history.append(difficulty.upper()) + # Main block start() @@ -50,3 +55,7 @@ while loop == True: loop = False else: print("Please enter a valid option.") + +history.append(choice) + +print(history) From 530d1859284e19fdf411de78ba696583ee07cce5 Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 17:30:58 +0100 Subject: [PATCH 5/6] spag --- alternative.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/alternative.py b/alternative.py index e29e305..8289c6b 100644 --- a/alternative.py +++ b/alternative.py @@ -133,8 +133,8 @@ def getAnswer4(question, text): # function to handle 4 responses from the user # Main block start() -question = "You are reading a magazine. The phone rings." +question = "You are reading a magazine. The phone rings." text = {"A": "Continue reading the magazine", "B": "Inspect the room", "C": "You pick up the phone" @@ -158,7 +158,7 @@ elif history[1] == "B": getAnswer3(question, text) print(history) if history[2] == "C": - pass # some sort of way to get back to the phone? do we store the data somewhere else? gg python i am confused + print("You go back to your magazine and realise MASUD HASN'T IMPLEMENTED THAT YET") # some sort of way to get back to the phone? do we store the data somewhere else? gg python i am confused elif history[1] == "C": question = "Ethan Stewart speaking, an interesting and rather weird door has been dug up.\nNo amount of force has worked on the door and I thought I'd contact you as the leading expert in hieroglyphs.\nI want you to fly over to Giza immediately and inspect the door." text = {"A": "…", From 82ae966c77d129d8f2d54c52638a4300df306bb5 Mon Sep 17 00:00:00 2001 From: mohammed masud Date: Thu, 1 Oct 2020 20:30:18 +0100 Subject: [PATCH 6/6] added text generator to make pasting easier --- alternative.py | 6 ++++-- textgenerator.py | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 textgenerator.py diff --git a/alternative.py b/alternative.py index 8289c6b..9cc6542 100644 --- a/alternative.py +++ b/alternative.py @@ -1,11 +1,11 @@ -''' +""" sphinx story is good https://github.coventry.ac.uk/lycette2/CuriosityKilledTheSphinx -''' +""" history = [] # empty storage area for choices @@ -73,6 +73,7 @@ def getAnswer2(question, text): # function to handle 2 responses from the user history.append(choice.upper()) # adds the choice the user picked + def getAnswer3(question, text): # function to handle 3 responses from the user loop = True choice = "" @@ -130,6 +131,7 @@ def getAnswer4(question, text): # function to handle 4 responses from the user history.append(choice.upper()) # adds the choice the user picked + # Main block start() diff --git a/textgenerator.py b/textgenerator.py new file mode 100644 index 0000000..2fa3843 --- /dev/null +++ b/textgenerator.py @@ -0,0 +1,20 @@ +optionsList = ["A", "B", "C", "D", "E", "F"] + +options = input("How many options? (max = 6)->") +line = "text = {" + +for i in range(1, int(options)+1): + if int(options) == 1: + textInput = input("Paste the text for option " + optionsList[i-1] + ":") + line = line + "\"" + optionsList[i-1] + "\": " + "\"" + textInput + "\"}" + elif i == 1: + textInput = input("Paste the text for option " + optionsList[i - 1] + ":") + line = line + "\"" + optionsList[i - 1] + "\": " + "\"" + textInput + "\",\n" + elif i < int(options): + textInput = input("Paste the text for option " + optionsList[i-1] + ":") + line = line + " \"" + optionsList[i-1] + "\": " + "\"" + textInput + "\",\n" + else: + textInput = input("Paste the text for option " + optionsList[i - 1] + ":") + line = line + " \"" + optionsList[i - 1] + "\": " + "\"" + textInput + "\"}" + +print(line)