# Variables for logic
num = 1
ItemGet = False
item = 0
var1 = True
split = False
splitLogic = False
print ('''
The Great
Adventure!
''')
# Gives Player Name
print ('>What is your name...')
name = input()
print (' Well ' + name + ' welcome to the great adventure. Let us Begin...\n')
def TwoChoice():
global name
global num
global ItemGet
global item
global var1
global split
global splitLogic
# Beggining of section of logic peices
if num == 1:
split = True
end = 'a'
question = ''' You Stand before your house would you like to enter your home? (you are hungry)
<(ENTER or STAY or CLIMB)>'''
result1 = " Path A"
result2 = ''' Path B'''
result3 = "You enter your house and sit down at the table"
choice1 = "Climb"
choice1a = "CLIMB"
choice1b = "climb"
choice2 = "Stay"
choice2a = "STAY"
choice2b = "stay"
choice3 = "Enter"
choice3a = "ENTER"
choice3b = "enter"
if num == 2:
split = False
end = 'b'
question = ''' Before you stands a huge stack of Pancakes, upstairs is your room where you could put your pack.
<(EAT or ROOM)>'''
result1 = " Soon after you finish off the plate you hear a maniacal laughter you turn around just in time to\n see a dark blur speed towards you then... Blackness"
result2 = " "
choice1 = "Eat"
choice1a = "EAT"
choice1b = "eat"
choice2 = "Room"
choice2a = "ROOM"
choice2b = "room"
choice3 = "cheat"
choice3a = "Cheat"
choice3b = "CHEAT"
if num == 3:
end = 'a'
result1 = " You pick up and read the note that was resting on you desk. As you read you hear soft footsteps behind you"
result2 = " You hear a shuffling sound. Then an Explosive pain in your side. You vainly try to hold on to the world of the living as your lifeblood leaves you."
choice1 = "Note"
choice1a = "NOTE"
choice1b = "note"
choice2 = "Rest"
choice2a = "REST"
choice2b = "rest"
choice3 = "STRING"
choice3a = "String"
choice3b = "string"
if ItemGet == False:
question = ''' You climb upstairs, enter your room and glance around. Your bed lies against the wall tucked
into a cosy corner. on your desk there is a note that is unread. Some string, that you could grab, is on your nightstand.
<(BED, NOTE, STRING)>'''
elif ItemGet == True:
question = ''' After you grab the string you put it in your pocket.
<(BED, NOTE)>'''
if num == 4:
end = 'b'
question = ''' Since you have the element of suprize do you want to
<(FIGHT or RUN)>'''
result1 = " you hear a maniacal laughter you turn around just in time to\n see a dark blur speed towards you then... Blackness"
result2 = " "
choice1 = "FIGHT"
choice1a = "Fight"
choice1b = "fight"
choice2 = "Run"
choice2a = "RUN"
choice2b = "run"
choice3 = "cheat"
choice3a = "Cheat"
choice3b = "CHEAT"
if num == 5:
end = 'b'
question = ''' Penguin.
<(EAT or ROOM)>'''
result1 = " A dark blur speed towards you then... Blackness"
result2 = " "
choice1 = "Eat"
choice1a = "EAT"
choice1b = "eat"
choice2 = "Room"
choice2a = "ROOM"
choice2b = "room"
choice3 = "cheat"
choice3a = "Cheat"
choice3b = "CHEAT"
if num == 6:
end = 'b'
question = ''' Ocelot.
<(EAT or ROOM)>'''
result1 = " Blackness"
result2 = " "
choice1 = "Eat"
choice1a = "EAT"
choice1b = "eat"
choice2 = "Room"
choice2a = "ROOM"
choice2b = "room"
choice3 = "cheat"
choice3a = "Cheat"
choice3b = "CHEAT"
if num == "A":
split = False
end = 'a'
question = ''' AAAA sucsess
<(ENTER or STAY or CLIMB)>'''
result1 = " sdffsdasfda"
result2 = ''' Pasdfasdf'''
result3 = "You enter your house and sit down at the table"
choice1 = "Climb"
choice1a = "CLIMB"
choice1b = "climb"
choice2 = "Stay"
choice2a = "STAY"
choice2b = "stay"
choice3 = "Enter"
choice3a = "ENTER"
choice3b = "enter"
if num == "B":
split = False
end = 'a'
question = ''' BBBBB Sucsess
<(ENTER or STAY or CLIMB)>'''
result1 = " Pasdfsadf"
result2 = ''' sadfasdf B'''
result3 = "You enter your house and sit down at the table"
choice1 = "Climb"
choice1a = "CLIMB"
choice1b = "climb"
choice2 = "Stay"
choice2a = "STAY"
choice2b = "stay"
choice3 = "Enter"
choice3a = "ENTER"
choice3b = "enter"
#End to logic peices
#Main Function (drives most logic)
if splitLogic == False:
print (question + ".")
if split == False:
gen = input()
if gen == choice1 or gen == choice1a or gen == choice1b or gen == choice2 or gen == choice2a or gen == choice2b or gen == choice3 or gen == choice3a or gen == choice3b:
if gen == choice1 or gen == choice1a or gen == choice1b:
print (result1 + ".")
if end == 'a':
num = num + 1
TwoChoice()
if end == 'b':
var1 = False
if gen == choice2 or gen == choice2a or gen == choice2b:
print (result2 + ".")
if end == 'b':
num = num + 1
TwoChoice()
if end == 'a':
var1 = False
if gen == choice3 or gen == choice3a or gen == choice3b:
if end == 'b':
ItemGet = False
item = item + 1
TwoChoice()
if end == 'a':
ItemGet = True
item = item + 1
TwoChoice()
if var1 == False:
print (" <(Game Reset)> ")
num = 1
ItemGet = False
item = 0
var1 = True
TwoChoice()
if gen != choice1 or gen != choice1a or gen != choice1b or gen != choice2 or gen != choice2a or gen != choice2b or gen != choice3 or gen != choice3a or gen != choice3b:
print (" Your an Idiot, that was not an option")
TwoChoice()
#question logic
if split == True:
gen = input()
if gen == choice1 or gen == choice1a or gen == choice1b or gen == choice2 or gen == choice2a or gen == choice2b or gen == choice3 or gen == choice3a or gen == choice3b:
if gen == choice1 or gen == choice1a or gen == choice1b:
print (result1 + ".")
if end == 'a':
num = "A"
splitLogic = True
TwoChoice()
if end == 'b':
var1 = False
if gen == choice2 or gen == choice2a or gen == choice2b:
print (result2 + ".")
if end == 'a':
num = "B"
splitLogic = True
TwoChoice()
if end == 'b':
var1 = False
if gen == choice3 or gen == choice3a or gen == choice3b:
print (result2 + ".")
if end == 'a':
splitLogic = False
num = num + 1
TwoChoice()
if end == 'b':
var1 = False
if var1 == False:
print (" <(Game Reset)> ")
num = 1
ItemGet = False
item = 0
var1 = True
TwoChoice()
if gen != choice1 or gen != choice1a or gen != choice1b or gen != choice2 or gen != choice2a or gen != choice2b or gen != choice3 or gen != choice3a or gen != choice3b:
print (" Your an Idiot, that was not an option")
TwoChoice()
# Logic Split
## A Section
if splitLogic == True:
gen = input()
if num == "A" or num == "AA" or num == "AAA" or num == "AAAA" or num == "AAAAA" or num == "AAAAAA" or num == "AAAAAAA" or num == "AAAAAAAA" or num == "AAAAAAAAA":
if gen == choice1 or gen == choice1a or gen == choice1b or gen == choice2 or gen == choice2a or gen == choice2b or gen == choice3 or gen == choice3a or gen == choice3b:
if gen == choice1 or gen == choice1a or gen == choice1b:
print (result1 + ".")
if end == 'a':
num = num + "A"
splitLogic = True
TwoChoice()
if end == 'b':
var1 = False
if gen == choice2 or gen == choice2a or gen == choice2b:
print (result2 + ".")
if end == 'b':
num = num + "A"
splitLogic = True
TwoChoice()
if end == 'a':
var1 = False
if gen == choice3 or gen == choice3a or gen == choice3b:
print (result2 + ".")
if end == 'a':
splitLogic = False
num = num + 1
TwoChoice()
if end == 'b':
var1 = False
if var1 == False:
print (" <(Game Reset)> ")
num = 1
ItemGet = False
item = 0
var1 = True
TwoChoice()
if gen != choice1 or gen != choice1a or gen != choice1b or gen != choice2 or gen != choice2a or gen != choice2b or gen != choice3 or gen != choice3a or gen != choice3b:
print (" Your an Idiot, that was not an option")
TwoChoice()
## B Section
if num == "B" or num == "BB" or num == "BBB" or num == "BBBB" or num == "BBBBB" or num == "BBBBBB" or num == "BBBBBBB" or num == "BBBBBBBB" or num == "BBBBBBBBB":
if gen == choice1 or gen == choice1a or gen == choice1b or gen == choice2 or gen == choice2a or gen == choice2b or gen == choice3 or gen == choice3a or gen == choice3b:
if gen == choice1 or gen == choice1a or gen == choice1b:
print (result1 + ".")
if end == 'a':
num = "A"
splitLogic = True
TwoChoice()
if end == 'b':
var1 = False
if gen == choice2 or gen == choice2a or gen == choice2b:
print (result2 + ".")
if end == 'a':
num = "B"
splitLogic = True
TwoChoice()
if end == 'b':
var1 = False
if gen == choice3 or gen == choice3a or gen == choice3b:
print (result2 + ".")
if end == 'a':
splitLogic = False
num = num + 1
TwoChoice()
if end == 'b':
var1 = False
if var1 == False:
print (" <(Game Reset)> ")
num = 1
ItemGet = False
item = 0
var1 = True
TwoChoice()
if gen != choice1 or gen != choice1a or gen != choice1b or gen != choice2 or gen != choice2a or gen != choice2b or gen != choice3 or gen != choice3a or gen != choice3b:
print (" that was not an option")
TwoChoice()
print ('Logic Split')
else:
print (" <(Game Reset)> ")
num = 1
ItemGet = False
item = 0
TwoChoice()
TwoChoice()
3 Replies - 478 Views - Last Post: 30 August 2012 - 05:18 PM
#1
(no error message) Program stops part way through
Posted 29 August 2012 - 04:28 PM
Hi I am rather new to programming and I kind of attempted to make a basic game. I made most of it successfully, but I am getting stumped on some of the logic that I recently tried to add. My problem is after the name input, the next choice wont work down 2 of the 3 path's. (basically trying to get these paths to work.) I know it is very incomplete and probably is far from the best proctice. This is not urgent in any manner of speaking, I'm just trying to teach myself, I just don't know were to look. (I am very willing to listen to suggestions on how to program the split differently.)
Replies To: (no error message) Program stops part way through
#2
Re: (no error message) Program stops part way through
Posted 30 August 2012 - 01:30 AM
Please replace your code with a minimal but complete code sample that runs and produces the same error as the original, but is much much shorter. Nobody's going to read through all of that.
Also please try to describe your problem more clearly to give us an idea of what to look for.
Also please try to describe your problem more clearly to give us an idea of what to look for.
#3
Re: (no error message) Program stops part way through
Posted 30 August 2012 - 06:36 AM
Your issues are likely due to numerous recursive calls. Rather than calling TwoChoice again and again, you should put a while loop inside your function and work iteratively. Give it a shot, and if you get stuck, post your updated code
#4
Re: (no error message) Program stops part way through
Posted 30 August 2012 - 05:18 PM
Ok, thanks I will try it, but I probably won't have time to modify it like that for a long time. So I'll work on it but you probably won't here back from me anytime soon. Once again thank you for your advice.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|