A little “explore” type of game in Python
I have another little text based game, this time, you're exploring a little castle. I have wanted to do this type of game for a while, and I finally got to do it!
You are exploring a little castle, choosing which halls and rooms to go into, you find keys as well, which unlock doors, which lead to more halls and rooms!
import time
import sys
import random
class Player:
def __init__(self, name):
self.name = name
self.key = 0
self.northemb = 0
self.rustynail = 0
pass
p = Player("Player")
#p.key += 1
##############
class Emblem:
def __init__(self, name):
self.name = name
self.Emblem = 0
northemb = Emblem("North Emblem")
southemb = Emblem("South Emblem")
def mid():
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
elif mid == 2:
east()
elif mid == 3:
south()
elif mid == 4:
west()
def north():
if northemb.Emblem == 0:
p.key += 1
northemb.Emblem += 1
print("You got a key! I wonder what it unlocks...")
time.sleep(3)
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
else:
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
def east():
print("You are in the east hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) South Hall")
print("4.) West Hall")
east = input("")
if east == 1:
north()
elif east == 2:
mid()
elif east == 3:
south()
elif east == 4:
west()
def south():
if southemb.Emblem == 0:
southemb.Emblem += 1
p.key += 1
print("You got a key! I wonder what it unlocks.")
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
elif southemb.Emblem == 1:
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
def west():
if p.key == 1:
print("You see a locked door...")
print("You have a key!")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East Hall")
print("4.) South Hall")
print("5.) Unlock Door")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
elif west == 5:
door()
else:
print("You see a locked door...")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) South hall")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
def door():
print("You unlock the door.")
print("-1 Key")
p.key -= 1
time.sleep(3)
print("You see stairs going down..")
time.sleep(2)
print("1.) Go back and keep exploring")
print("2.) Go down the stairs")
door = input("")
if door == 1:
west()
elif door == 2:
floor1()
def floor1():
if p.key == 0:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
floo1 = input("")
if floo1 == 1:
west()
elif p.key == 1:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
print("2.) Unlock Door")
floo2 = input("")
if floo2 == 1:
west()
elif floo2 == 2:
p.key -= 1
deep()
def deep():
print("You unlock the door.")
print("-1 Key")
time.sleep(2)
print("You open the door and see more stairs, and walk down them.")
print("As you walk down the steps, the door swing backs behind you, locking you in. ")
time.sleep(2)
print("You see a rusty nail on the stairs, and you think to yourself that it might be of good use at somepoint.")
p.rustynail += 1
time.sleep(2)
print("You see another locked door.")
time.sleep(2)
print("You see 3 locked doors, you know you can open one with the rusty nail, but then it would break.")
time.sleep(3)
print("1.) Open Red Door")
print("2.) Open Green Door")
print("3.) Open Blue Door")
deep1 = input("")
if deep1 == 1:
t1 = random.randint(1,3)
if t1 == 1:
door5()
elif t1 == 2:
door5()
elif t1 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 2:
t2 = random.randint(1,3)
if t2 == 1:
door5()
if t2 == 2:
door5()
elif t2 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 3:
t3 = random.randint(1,3)
if t3 == 1:
door5()
elif t3 == 2:
door5()
elif t3 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you. ")
sys.exit()
def door5():
p.rustynail -= 1
print("-1 Rustynail")
time.sleep(3)
print("You see a labryinth in front of you, much like the castle.")
mid()
mid()
python python-3.x adventure-game
add a comment |
I have another little text based game, this time, you're exploring a little castle. I have wanted to do this type of game for a while, and I finally got to do it!
You are exploring a little castle, choosing which halls and rooms to go into, you find keys as well, which unlock doors, which lead to more halls and rooms!
import time
import sys
import random
class Player:
def __init__(self, name):
self.name = name
self.key = 0
self.northemb = 0
self.rustynail = 0
pass
p = Player("Player")
#p.key += 1
##############
class Emblem:
def __init__(self, name):
self.name = name
self.Emblem = 0
northemb = Emblem("North Emblem")
southemb = Emblem("South Emblem")
def mid():
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
elif mid == 2:
east()
elif mid == 3:
south()
elif mid == 4:
west()
def north():
if northemb.Emblem == 0:
p.key += 1
northemb.Emblem += 1
print("You got a key! I wonder what it unlocks...")
time.sleep(3)
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
else:
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
def east():
print("You are in the east hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) South Hall")
print("4.) West Hall")
east = input("")
if east == 1:
north()
elif east == 2:
mid()
elif east == 3:
south()
elif east == 4:
west()
def south():
if southemb.Emblem == 0:
southemb.Emblem += 1
p.key += 1
print("You got a key! I wonder what it unlocks.")
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
elif southemb.Emblem == 1:
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
def west():
if p.key == 1:
print("You see a locked door...")
print("You have a key!")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East Hall")
print("4.) South Hall")
print("5.) Unlock Door")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
elif west == 5:
door()
else:
print("You see a locked door...")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) South hall")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
def door():
print("You unlock the door.")
print("-1 Key")
p.key -= 1
time.sleep(3)
print("You see stairs going down..")
time.sleep(2)
print("1.) Go back and keep exploring")
print("2.) Go down the stairs")
door = input("")
if door == 1:
west()
elif door == 2:
floor1()
def floor1():
if p.key == 0:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
floo1 = input("")
if floo1 == 1:
west()
elif p.key == 1:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
print("2.) Unlock Door")
floo2 = input("")
if floo2 == 1:
west()
elif floo2 == 2:
p.key -= 1
deep()
def deep():
print("You unlock the door.")
print("-1 Key")
time.sleep(2)
print("You open the door and see more stairs, and walk down them.")
print("As you walk down the steps, the door swing backs behind you, locking you in. ")
time.sleep(2)
print("You see a rusty nail on the stairs, and you think to yourself that it might be of good use at somepoint.")
p.rustynail += 1
time.sleep(2)
print("You see another locked door.")
time.sleep(2)
print("You see 3 locked doors, you know you can open one with the rusty nail, but then it would break.")
time.sleep(3)
print("1.) Open Red Door")
print("2.) Open Green Door")
print("3.) Open Blue Door")
deep1 = input("")
if deep1 == 1:
t1 = random.randint(1,3)
if t1 == 1:
door5()
elif t1 == 2:
door5()
elif t1 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 2:
t2 = random.randint(1,3)
if t2 == 1:
door5()
if t2 == 2:
door5()
elif t2 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 3:
t3 = random.randint(1,3)
if t3 == 1:
door5()
elif t3 == 2:
door5()
elif t3 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you. ")
sys.exit()
def door5():
p.rustynail -= 1
print("-1 Rustynail")
time.sleep(3)
print("You see a labryinth in front of you, much like the castle.")
mid()
mid()
python python-3.x adventure-game
1
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
1
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
I have another little text based game, this time, you're exploring a little castle. I have wanted to do this type of game for a while, and I finally got to do it!
You are exploring a little castle, choosing which halls and rooms to go into, you find keys as well, which unlock doors, which lead to more halls and rooms!
import time
import sys
import random
class Player:
def __init__(self, name):
self.name = name
self.key = 0
self.northemb = 0
self.rustynail = 0
pass
p = Player("Player")
#p.key += 1
##############
class Emblem:
def __init__(self, name):
self.name = name
self.Emblem = 0
northemb = Emblem("North Emblem")
southemb = Emblem("South Emblem")
def mid():
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
elif mid == 2:
east()
elif mid == 3:
south()
elif mid == 4:
west()
def north():
if northemb.Emblem == 0:
p.key += 1
northemb.Emblem += 1
print("You got a key! I wonder what it unlocks...")
time.sleep(3)
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
else:
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
def east():
print("You are in the east hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) South Hall")
print("4.) West Hall")
east = input("")
if east == 1:
north()
elif east == 2:
mid()
elif east == 3:
south()
elif east == 4:
west()
def south():
if southemb.Emblem == 0:
southemb.Emblem += 1
p.key += 1
print("You got a key! I wonder what it unlocks.")
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
elif southemb.Emblem == 1:
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
def west():
if p.key == 1:
print("You see a locked door...")
print("You have a key!")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East Hall")
print("4.) South Hall")
print("5.) Unlock Door")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
elif west == 5:
door()
else:
print("You see a locked door...")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) South hall")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
def door():
print("You unlock the door.")
print("-1 Key")
p.key -= 1
time.sleep(3)
print("You see stairs going down..")
time.sleep(2)
print("1.) Go back and keep exploring")
print("2.) Go down the stairs")
door = input("")
if door == 1:
west()
elif door == 2:
floor1()
def floor1():
if p.key == 0:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
floo1 = input("")
if floo1 == 1:
west()
elif p.key == 1:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
print("2.) Unlock Door")
floo2 = input("")
if floo2 == 1:
west()
elif floo2 == 2:
p.key -= 1
deep()
def deep():
print("You unlock the door.")
print("-1 Key")
time.sleep(2)
print("You open the door and see more stairs, and walk down them.")
print("As you walk down the steps, the door swing backs behind you, locking you in. ")
time.sleep(2)
print("You see a rusty nail on the stairs, and you think to yourself that it might be of good use at somepoint.")
p.rustynail += 1
time.sleep(2)
print("You see another locked door.")
time.sleep(2)
print("You see 3 locked doors, you know you can open one with the rusty nail, but then it would break.")
time.sleep(3)
print("1.) Open Red Door")
print("2.) Open Green Door")
print("3.) Open Blue Door")
deep1 = input("")
if deep1 == 1:
t1 = random.randint(1,3)
if t1 == 1:
door5()
elif t1 == 2:
door5()
elif t1 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 2:
t2 = random.randint(1,3)
if t2 == 1:
door5()
if t2 == 2:
door5()
elif t2 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 3:
t3 = random.randint(1,3)
if t3 == 1:
door5()
elif t3 == 2:
door5()
elif t3 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you. ")
sys.exit()
def door5():
p.rustynail -= 1
print("-1 Rustynail")
time.sleep(3)
print("You see a labryinth in front of you, much like the castle.")
mid()
mid()
python python-3.x adventure-game
I have another little text based game, this time, you're exploring a little castle. I have wanted to do this type of game for a while, and I finally got to do it!
You are exploring a little castle, choosing which halls and rooms to go into, you find keys as well, which unlock doors, which lead to more halls and rooms!
import time
import sys
import random
class Player:
def __init__(self, name):
self.name = name
self.key = 0
self.northemb = 0
self.rustynail = 0
pass
p = Player("Player")
#p.key += 1
##############
class Emblem:
def __init__(self, name):
self.name = name
self.Emblem = 0
northemb = Emblem("North Emblem")
southemb = Emblem("South Emblem")
def mid():
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
elif mid == 2:
east()
elif mid == 3:
south()
elif mid == 4:
west()
def north():
if northemb.Emblem == 0:
p.key += 1
northemb.Emblem += 1
print("You got a key! I wonder what it unlocks...")
time.sleep(3)
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
else:
print("You are in the north hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) Middle Circle")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
north = input("")
if north == 1:
mid()
elif north == 2:
east()
elif north == 3:
south()
elif north == 4:
west()
def east():
print("You are in the east hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) South Hall")
print("4.) West Hall")
east = input("")
if east == 1:
north()
elif east == 2:
mid()
elif east == 3:
south()
elif east == 4:
west()
def south():
if southemb.Emblem == 0:
southemb.Emblem += 1
p.key += 1
print("You got a key! I wonder what it unlocks.")
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
elif southemb.Emblem == 1:
print("You are in the south hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) West Hall")
south = input("")
if south == 1:
north()
elif south == 2:
mid()
elif south == 3:
east()
elif south == 4:
west()
def west():
if p.key == 1:
print("You see a locked door...")
print("You have a key!")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East Hall")
print("4.) South Hall")
print("5.) Unlock Door")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
elif west == 5:
door()
else:
print("You see a locked door...")
time.sleep(2)
print("You are in the west hall of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) Middle Hall")
print("3.) East hall")
print("4.) South hall")
west = input("")
if west == 1:
north()
elif west == 2:
mid()
elif west == 3:
east()
elif west == 4:
south()
def door():
print("You unlock the door.")
print("-1 Key")
p.key -= 1
time.sleep(3)
print("You see stairs going down..")
time.sleep(2)
print("1.) Go back and keep exploring")
print("2.) Go down the stairs")
door = input("")
if door == 1:
west()
elif door == 2:
floor1()
def floor1():
if p.key == 0:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
floo1 = input("")
if floo1 == 1:
west()
elif p.key == 1:
print("You walk down the stairs, and see another locked door.")
time.sleep(1)
print("1.) Go back")
print("2.) Unlock Door")
floo2 = input("")
if floo2 == 1:
west()
elif floo2 == 2:
p.key -= 1
deep()
def deep():
print("You unlock the door.")
print("-1 Key")
time.sleep(2)
print("You open the door and see more stairs, and walk down them.")
print("As you walk down the steps, the door swing backs behind you, locking you in. ")
time.sleep(2)
print("You see a rusty nail on the stairs, and you think to yourself that it might be of good use at somepoint.")
p.rustynail += 1
time.sleep(2)
print("You see another locked door.")
time.sleep(2)
print("You see 3 locked doors, you know you can open one with the rusty nail, but then it would break.")
time.sleep(3)
print("1.) Open Red Door")
print("2.) Open Green Door")
print("3.) Open Blue Door")
deep1 = input("")
if deep1 == 1:
t1 = random.randint(1,3)
if t1 == 1:
door5()
elif t1 == 2:
door5()
elif t1 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 2:
t2 = random.randint(1,3)
if t2 == 1:
door5()
if t2 == 2:
door5()
elif t2 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you.")
sys.exit()
elif deep1 == 3:
t3 = random.randint(1,3)
if t3 == 1:
door5()
elif t3 == 2:
door5()
elif t3 == 3:
print("You open the door, and see a goblin armed with a knife, which promptly butchers you. ")
sys.exit()
def door5():
p.rustynail -= 1
print("-1 Rustynail")
time.sleep(3)
print("You see a labryinth in front of you, much like the castle.")
mid()
mid()
python python-3.x adventure-game
python python-3.x adventure-game
edited yesterday
Jamal♦
30.3k11116226
30.3k11116226
asked Mar 30 '18 at 20:42
ColeaColea
21412
21412
1
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
1
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
1
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
1
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday
1
1
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
1
1
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
1 Answer
1
active
oldest
votes
I think you should change the way a user inputs their decision. For example, look at these lines:
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
The first time I ran the program, I did this:
You are in the middle of the castle.
Where do you want to go?
1.) North Hall
2.) East Hall
3.) South Hall
4.) West Hall
North Hall
>>>
I also tried entering the number one too, but it didn't work. You need to add quotes around the code like this:
if mid == '1':
north()
elif mid == '2':
east()
elif mid == '3':
south()
elif mid == '4':
west()
or:
mid = int(input(""))
New contributor
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
});
});
}, "mathjax-editing");
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "196"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190891%2fa-little-explore-type-of-game-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I think you should change the way a user inputs their decision. For example, look at these lines:
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
The first time I ran the program, I did this:
You are in the middle of the castle.
Where do you want to go?
1.) North Hall
2.) East Hall
3.) South Hall
4.) West Hall
North Hall
>>>
I also tried entering the number one too, but it didn't work. You need to add quotes around the code like this:
if mid == '1':
north()
elif mid == '2':
east()
elif mid == '3':
south()
elif mid == '4':
west()
or:
mid = int(input(""))
New contributor
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
I think you should change the way a user inputs their decision. For example, look at these lines:
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
The first time I ran the program, I did this:
You are in the middle of the castle.
Where do you want to go?
1.) North Hall
2.) East Hall
3.) South Hall
4.) West Hall
North Hall
>>>
I also tried entering the number one too, but it didn't work. You need to add quotes around the code like this:
if mid == '1':
north()
elif mid == '2':
east()
elif mid == '3':
south()
elif mid == '4':
west()
or:
mid = int(input(""))
New contributor
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
I think you should change the way a user inputs their decision. For example, look at these lines:
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
The first time I ran the program, I did this:
You are in the middle of the castle.
Where do you want to go?
1.) North Hall
2.) East Hall
3.) South Hall
4.) West Hall
North Hall
>>>
I also tried entering the number one too, but it didn't work. You need to add quotes around the code like this:
if mid == '1':
north()
elif mid == '2':
east()
elif mid == '3':
south()
elif mid == '4':
west()
or:
mid = int(input(""))
New contributor
I think you should change the way a user inputs their decision. For example, look at these lines:
print("You are in the middle of the castle.")
print("Where do you want to go?")
time.sleep(3)
print("1.) North Hall")
print("2.) East Hall")
print("3.) South Hall")
print("4.) West Hall")
mid = input("")
if mid == 1:
north()
The first time I ran the program, I did this:
You are in the middle of the castle.
Where do you want to go?
1.) North Hall
2.) East Hall
3.) South Hall
4.) West Hall
North Hall
>>>
I also tried entering the number one too, but it didn't work. You need to add quotes around the code like this:
if mid == '1':
north()
elif mid == '2':
east()
elif mid == '3':
south()
elif mid == '4':
west()
or:
mid = int(input(""))
New contributor
New contributor
answered yesterday
Jerry CuiJerry Cui
214
214
New contributor
New contributor
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
3
3
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
The second method is probably better, but the OP will probably want to go more generic; for CLI programs, it's important to have input validation so the program doesn't crash when an non-number input or a number out of range is input. However, given that you have uncovered such a major bug in the program from a basic test, I think the question needs to be closed as Code not implemented or not working as intended.
– Graham
yesterday
add a comment |
Thanks for contributing an answer to Code Review Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f190891%2fa-little-explore-type-of-game-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Again, as with your previous question, I suggest you to add some more information about the game into your post. That way reviewers know what to expect from their initial game session and whether you've met that expectations.
– Zeta
Mar 30 '18 at 20:45
Alright, done. @Zeta
– Colea
Mar 30 '18 at 20:47
You're using Python 3.x right?
– Phrancis
Mar 30 '18 at 21:05
1
Given Jerry Cui answer's revealed a basic failure in functioning correctly, I think this question should be closed as Code not implemented or not working as intended.
– Graham
yesterday