[mdlug] Slightly update spacemaze.py file
Gib
gibmaxn at gmail.com
Wed Apr 24 19:21:06 EDT 2019
#Slightly update spacemaze.py file 4/24/2019 gibmaxn at gmail.com
#common variables
global aliveflag
aliveflag = "true" # Is the player alive? true = alive, false = dead
def rooma001 ():
print ("rooma001")
print ("You fell in a hole and died")
global aliveflag
aliveflag = "false"
print ("bottom of rooma001", aliveflag)
return
def rooma002 ():
print ("rooma002")
print ("You are in a room with metal floor and three openings. To
the west is a entryway to a control room. To the north is a room with
a green light. To the east is a dark room")
print ("enter e w n s to move east west north south")
nextmove = input ("Enter next move")
if nextmove == "e":
print ("e")
roomb001()
if nextmove == "w":
print ("w")
roomb002()
if nextmove == "n":
print ("n")
roomb003()
if nextmove == "s":
print ("s")
roomb004()
return
def rooma003 ():
print ("rooma003")
return
def rooma004 ():
print ("rooma004")
return
def rooma005 ():
print ("rooma005")
return
#
def roomb001 ():
print ("roomb001")
print ("You fell in a hole and died")
aliveflag = "false"
return
def roomb002 ():
print ("roomb002")
print ("You found a control center")
# aliveflag = "false"
return
def roomb003 ():
print ("roomb003")
print ("You fell in a hole and died")
global aliveflag
print ("aliveflag",aliveflag)
aliveflag = "false"
print ("aliveflag",aliveflag)
return
def roomb004 ():
print ("roomb004")
print ("You fell in a hole and died")
aliveflag = "false"
return
#
#main
print ("This is Spacemaze 2/9/2019 a project of mdlug.org")
print ("You are in a room with dirt floor and three openings. To the
west is a entryway to a dark area. To the north is a room with a green
light. To the east is a dark room")
print ("enter e w n s to move east west north south")
#global aliveflag
#aliveflag = "true"
nextmove = input ("Enter next move")
if nextmove == "e":
print ("e")
rooma001()
elif nextmove == "w":
print ("w")
rooma002()
elif nextmove == "n":
print ("n")
rooma003()
elif nextmove == "s":
print ("s")
rooma004()
else:
print ("Input not recognised")
#
print ("You have returned to the main room. aliveflag", aliveflag)
if aliveflag == "true":
# print (aliveflag)
print ("You are alive")
else:
print ("You are not alive")
print ("End of Game")
More information about the mdlug
mailing list