コード例 #1
0
ファイル: creek.py プロジェクト: B0dz1o/LPyTHW
def siren():
    """
    Repeatable choice checker. If cannot determine, what
    should be done, returns False.
    """
    decision = def_input()
    if decision == '1' or decision == '1.':
        print "Siren attempts to suffocate you.", \
        "You're exhausted, but manage to let go of her grip.", \
        "Yet you fall to the water and let the flow take you away."
        return drown()
    elif decision == '2' or decision == '2.':
        print "It could be the love of your life,",
        print "but what the heck. Adventure, here I go!"
        return cave()
    else:
        print "Unknown choice. Try again."
        return False
コード例 #2
0
ファイル: cave.py プロジェクト: B0dz1o/LPyTHW
def gold():
    """
    Repeatable choice checker. If cannot determine, what
    should be done, returns False.
    """
    decision = def_input()
    try:
        gold = int(decision)
    except ValueError:
        print "Unknown choice. Try again."
        return False
    if gold > 50:
        print "You cannot carry that much!"
    elif gold > 10 and gold <= 50:
        print "It's a heavy load, but you manage to move."
        return goblin(True)
    elif gold > 0 and gold <= 10:
        print "You're not greedy! You leave the cave to come back home."
        return goblin(False)
コード例 #3
0
ファイル: drown.py プロジェクト: B0dz1o/LPyTHW
def swim():
    """
    Repeatable choice checker. If cannot determine, what
    should be done, returns False.
    """
    decision = def_input()
    if decision == '1' or decision == '1.':
        print "You managed to survive and got off the water."
        print "You wander carefully, but finally, you find a golden cave."
        print "Yaaaaaaaay!"
        return cave()
    elif decision == '2' or decision == '2.':
        print "Darkness covers your sight. You lose conscience..."
        for i in range(0,5):
            print '...'
            sleep(1)
        print "You lucky bastard! A fisherman caught you and brought you "\
        "home, where you can recover."
        print "You can start your adventure again!"
        return start.start()
    else:
        print "Unknown choice. Try again."
        return False