Skip to content

Instantly share code, notes, and snippets.

@Tehnix
Created November 12, 2013 14:17
Show Gist options
  • Select an option

  • Save Tehnix/7431535 to your computer and use it in GitHub Desktop.

Select an option

Save Tehnix/7431535 to your computer and use it in GitHub Desktop.
Mystery Mansion
"""
The game is called Mystery Mansion.
Simply put, the user has to go through door after door to gain access to the treasure.
Behind every door lurks an evil creature looking for its breakfast, lunch or dinner.
So, all the best.
"""
import random
import datetime
def intro():
print "Welcome to Mystery Mansion."
print "This house contains many secrets inside itself."
print "Fortune awaits for the one who unlocks all the doors."
print "Let us begin."
choose_door()
def choose_door():
possible_doors = {
"1": door_one,
"2": door_two
}
print "Which door do you want to enter into? %s" % " or ".join(possible_doors)
door = raw_input()
while door not in possible_doors:
print "You can only choose door %s! Which one do you want to enter?" % " or ".join(possible_doors)
door = raw_input()
possible_doors[door]()
def door_one():
weapons = ["shotgun", "sword"]
print "You enter a dark room..."
print "It is very spooky..."
print "There is a bear guarding the passageway."
print "You pick up a weapon (%s)" % ", ".join(weapons)
tool = raw_input("Pick your weapon: ")
if tool in weapons:
print "You have successfully killed the bear and crossed the passageway."
passageway(weapons=weapons)
else:
print "Sorry. The bear is powerful. It kills you. You are dead."
def door_two():
print "Not bad, you made it here so quick."
print "The gold is yours."
print "Let us quickly test your greed."
print "How much gold you want?"
gold = int(raw_input("gold amount: "))
if gold < 100:
print "You are a very good person."
else:
print "You are a pure greedy rascal."
def passageway(**kwargs):
print "So, now you have crossed the passageway."
if "weapons" in kwargs:
print "Remember, you still have your %s" % " and ".join(kwargs["weapons"])
print "The time today is : %s\n" % (datetime.datetime.now())
intro()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment