From e9cc730925facf93a3c46f6c6a8b5476086c511f Mon Sep 17 00:00:00 2001 From: "Benjamin Herrick-Blake (blakeb)" Date: Thu, 1 Oct 2020 16:26:36 +0100 Subject: [PATCH] Add files via upload --- ...InteractiveStoryPythonConversionProject.py | 33 +++++++++++++++++ ...ractiveStoryPythonConversionProject.pyproj | 35 +++++++++++++++++++ ...nteractiveStoryPythonConversionProject.sln | 23 ++++++++++++ 3 files changed, 91 insertions(+) create mode 100644 InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.py create mode 100644 InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.pyproj create mode 100644 InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.sln diff --git a/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.py b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.py new file mode 100644 index 0000000..a056236 --- /dev/null +++ b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.py @@ -0,0 +1,33 @@ + +#Module formatting into story dictionary, 0:text where 0 is the index number of the module and text is the text of the module. \n=linebreak +story={0:"You are reading a magazine. The phone rings.\n (1)continue reading the magazine and ignore the call \n (2)Inspect the room \n (3)you pick up the phone", 1:"[{You pick up the phone section}]", 2:"hi", 3:"OOOP", 4: "AAAAAA"} +y = 0 +moduleProgressList = [] + +while True: + if y > -1: + moduleProgressList.append(y) #Adds the current module to the list of travelled modules + text = story[y] + print(text) #Displays module text based on y value recieved + x = input("Your choice is...") + if x.isdigit() == False: #This determines whether the value input is a digit + while x.isdigit() ==False: + print("This is an invalid input") + x = input("Your choice is...") + choiceNumber = int(x) + y = choiceNumber #y is the target module as chosen by the user input + else: + while y != int or ( y < 0): + print("This is an invalid input") + x = input("Your choice is...") + if x.isdigit() == False: + while x.isdigit() ==False: + print("This is an invalid input") + x = input("Your choice is...") + choiceNumber = int(x) + y = choiceNumber #This ensures that only valid numbers + + + + + \ No newline at end of file diff --git a/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.pyproj b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.pyproj new file mode 100644 index 0000000..e269569 --- /dev/null +++ b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.pyproj @@ -0,0 +1,35 @@ + + + Debug + 2.0 + 5a2aedf8-4803-4ed5-9b52-33877185571f + . + InteractiveStoryPythonConversionProject.py + + + . + . + InteractiveStoryPythonConversionProject + InteractiveStoryPythonConversionProject + + + true + false + + + true + false + + + + + + + + + + + + \ No newline at end of file diff --git a/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.sln b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.sln new file mode 100644 index 0000000..7fc27b2 --- /dev/null +++ b/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30517.126 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "InteractiveStoryPythonConversionProject", "InteractiveStoryPythonConversionProject.pyproj", "{5A2AEDF8-4803-4ED5-9B52-33877185571F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5A2AEDF8-4803-4ED5-9B52-33877185571F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A2AEDF8-4803-4ED5-9B52-33877185571F}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4686DB6A-A6AF-498B-8F1C-3090F980BC0F} + EndGlobalSection +EndGlobal