Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
CuriosityKilledTheSphinx/InteractiveStoryPythonConversionProject/InteractiveStoryPythonConversionProject.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
49 lines (44 sloc)
2.38 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dictionary import * | |
y = 0 | |
moduleProgressList = [] | |
condition = True | |
while True: | |
condition = True | |
while condition == True: | |
if y > -1 and y < 61: | |
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 | |
if y==50 or y==60 or y==59 or y==48 or y==52 or y==47: | |
condition = False #prevents user from accessing a different part once they have reached an endin | |
else: | |
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) | |
previous = y | |
y = choiceNumber #y is the target module as chosen by the user input | |
if y == 24: | |
hold = str(previous) | |
else: | |
while y != int or ( y < 0) or y > 60: | |
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) | |
previous = y | |
y = choiceNumber #This ensures that only valid numbers | |
if y == 24: | |
hold = previous #holds the location prior to moving into the runaway side branch so that the page they would return to is displayed on the screen when they go back | |
x = input("The End would you like to play again? y/n") | |
if x != "y" and x != "Y" and x!= "n" and x!= "N": #This determines whether the value input is a digit | |
while x != "y" and x != "Y" and x!= "n" and x!= "N": | |
print("This is an invalid input") | |
x = input("Your choice is...") | |
if x == "n" or "N": | |
break # breaks the while true loop if players dont want to restart | |