Skip to content

Instantly share code, notes, and snippets.

@valentinzberea
Last active November 25, 2015 15:52
Show Gist options
  • Save valentinzberea/482838373a198049c0da to your computer and use it in GitHub Desktop.
Save valentinzberea/482838373a198049c0da to your computer and use it in GitHub Desktop.

Revisions

  1. valentinzberea revised this gist Nov 25, 2015. 1 changed file with 50 additions and 90 deletions.
    140 changes: 50 additions & 90 deletions game.py
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,18 @@
    import random



    pocket_list = []

    table_phrase = "You put it in your pocket. "



    def table_book():

    print "On table you find a knife and 2 books."



    choice_table = raw_input("What do you take?> ")

    compare_num = random.randint(1,2)


    compare_num = random.randint(1, 2)

    if "knife" in choice_table:

    @@ -28,12 +22,8 @@ def table_book():

    stairs()



    elif "book" in choice_table:



    if compare_num == 1:

    print "You taked a psihological book and started to read."
    @@ -42,8 +32,6 @@ def table_book():

    stairs()



    elif compare_num == 2:

    print "You taked a book about fighting and read it."
    @@ -52,42 +40,37 @@ def table_book():

    stairs()



    else:

    print "You didn't pick anything."

    table_book()



    else:

    print "You didn't pick anything."

    table_book()





    def win():

    win_list = ["You are so brave. Congratulations!", "You beat them so hard. Nice!", "You have serious injures, but you escaped.", "You almost got killed, but now you're free."]

    print win_list[random.randint(0,3)]
    win_list = ["You are so brave. Congratulations!",
    "You beat them so hard. Nice!",
    "You have serious injures, but you escaped.",
    "You almost got killed, but now you're free."]

    print win_list[random.randint(0, 3)]


    def dead():

    lose_list = ["You tried your best but you got killed.", "You aren't strong enough to beat them.", "You couldn't escape.", "Nice try, but you got killed!"]

    print lose_list[random.randint(0,3)]


    lose_list = ["You tried your best but you got killed.",
    "You aren't strong enough to beat them.",
    "You couldn't escape.",
    "Nice try, but you got killed!"]

    print lose_list[random.randint(0, 3)]


    def front_door():
    @@ -105,17 +88,12 @@ def front_door():
    dead()





    def left_room():

    print "You open the door and find a warrior."

    left_room_choice = raw_input("What do you do? talk/fight> ")



    if "fight" in left_room_choice:

    if "knife_having" in pocket_list or "fight_book" in pocket_list:
    @@ -126,99 +104,94 @@ def left_room():

    dead()



    elif "talk" in left_room_choice:

    if "psiho_book" in pocket_list:

    print "You tell him that you just search someone to talk with. He's glad that he can speak with you."

    print "The warrior talks about his drama. He was kidnapped when he was a little boy and was trained to kill."
    print "You tell him that you just search someone to talk with. "
    "He's glad that he can speak with you."

    print "You try to understand him and to offer support. He's grateful to you because you helped him to talk about his drama."
    print "The warrior talks about his drama. "
    "He was kidnapped when he was a little boy and "
    "was trained to kill."

    print "You tell him that you also have been kidnapped and you want to escape."

    warrior_choice = raw_input("You tell him 1.'Goodbye' or 2.'Come with me and became free!'?> ")
    print "You try to understand him and to offer support. "
    "He's grateful to you because you helped him to talk "
    "about his drama."

    print "You tell him that you also have been kidnapped and "
    "you want to escape."

    warrior_choice = raw_input("You tell him 1.'Goodbye' or "
    "2.'Come with me and became free!'?> ")

    if "1" in warrior_choice:

    print "You were so excited about warrior's drama that you jumped out the window."
    print "You were so excited about warrior's drama that you "
    "jumped out the window."

    dead()



    elif "2" in warrior_choice:

    print "Warrior helped you to beat the monsters and he got free. You became his best friend."
    print "Warrior helped you to beat the monsters and "
    "he got free. You became his best friend."

    win()



    else:

    print "Learn to tape a number!"

    left_room()



    else:

    print "He didn't want to listen to you."



    else:

    print "You didn't choose anything."

    left_room()





    def right_room():

    print "Here you find a little boy, a weapon and some clothes."

    right_room_choice = raw_input("What do you choose?> ")



    if "little boy" in right_room_choice:

    if "psiho_book" in pocket_list:

    print "You go to the little boy and try to talk with him. He explains to you that he was kiddnaped and he doesn't know where he is."
    print "You go to the little boy and try to talk with him. "
    "He explains to you that he was kiddnaped and "
    "he doesn't know where he is."

    print "You take the boy with you, smash the window and escape the house."
    print "You take the boy with you, smash the window and "
    "escape the house."

    win()



    elif "fight_book" in pocket_list:

    print "You take the little boy and teach him to fight."

    print "After that you go downstairs at the front door and fight the monsters."
    print "After that you go downstairs at the front door and "
    "fight the monsters."

    win()

    elif "knife" in pocket_list:

    print "You take the boy and smash the window."

    print "The monsters see you and you must fight them and defeat the boy."
    print "The monsters see you and you must fight them and "
    "defeat the boy."

    rand_num = random.randint(0,1)
    rand_num = random.randint(0, 1)

    if rand_num == 1:

    @@ -236,52 +209,45 @@ def right_room():

    dead()



    elif "weapon" in right_room_choice:

    print "You take the boy and the weapon, go at the front door and try to kill the monsters."
    print "You take the boy and the weapon, go at the front door and "
    "try to kill the monsters."

    print "But the weapon wasn't charged and you and the boy got killed."

    dead()



    elif "clothes" in right_room_choice:

    print "You take the clothes and change."

    print "You put the boy on window, go downstairs, pass through monsters and take the boy from the window."
    print "You put the boy on window, go downstairs, "
    "pass through monsters and take the boy from the window."

    win()



    else:

    print "You didn't tape anything"

    right_room()





    def stairs():

    stairs_phrase = "Now you climb up the stairs and in front of your eyes you have two rooms: one to the left and one to the right."
    stairs_phrase = "Now you climb up the stairs and in front of your eyes "
    "you have two rooms: one to the left and one to the right."

    if "knife_having" in pocket_list or "fight_book" in pocket_list or "psiho_book" in pocket_list:
    if ("knife_having" in pocket_list or
    "fight_book" in pocket_list or "psiho_book" in pocket_list):

    print table_phrase + stairs_phrase

    else:

    print stairs_phrase



    choice_stairs = raw_input("Which room do you enter?> ")

    if "left" in choice_stairs:
    @@ -299,17 +265,12 @@ def stairs():
    stairs()





    def corridor():

    print "In corridor you see some stairs and a table."

    choice_corridor = raw_input("Do you go at the table or check the stairs?")



    if "table" in choice_corridor:

    table_book()
    @@ -325,16 +286,15 @@ def corridor():
    corridor()





    def start():

    print "You are a prisoner in a abandoned house."

    print "You must escape but at the front door of the house there are 2 monsters which you can't beat them without help."
    print "You must escape but at the front door of the house there are "
    "2 monsters which you can't beat them without help."

    print "You have the chance to try to fight them or to find another way out."
    print "You have the chance to try to fight them or "
    "to find another way out."

    print "After you get out your room you see a corridor and the front door."

    @@ -355,4 +315,4 @@ def start():
    start()


    start()
    start()
  2. valentinzberea revised this gist Nov 25, 2015. No changes.
  3. valentinzberea renamed this gist Nov 25, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. valentinzberea created this gist Nov 25, 2015.
    358 changes: 358 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,358 @@
    import random



    pocket_list = []

    table_phrase = "You put it in your pocket. "



    def table_book():

    print "On table you find a knife and 2 books."



    choice_table = raw_input("What do you take?> ")

    compare_num = random.randint(1,2)



    if "knife" in choice_table:

    print "You taked the knife."

    pocket_list.append("knife_having")

    stairs()



    elif "book" in choice_table:



    if compare_num == 1:

    print "You taked a psihological book and started to read."

    pocket_list.append("psiho_book")

    stairs()



    elif compare_num == 2:

    print "You taked a book about fighting and read it."

    pocket_list.append("fight_book")

    stairs()



    else:

    print "You didn't pick anything."

    table_book()



    else:

    print "You didn't pick anything."

    table_book()





    def win():

    win_list = ["You are so brave. Congratulations!", "You beat them so hard. Nice!", "You have serious injures, but you escaped.", "You almost got killed, but now you're free."]

    print win_list[random.randint(0,3)]



    def dead():

    lose_list = ["You tried your best but you got killed.", "You aren't strong enough to beat them.", "You couldn't escape.", "Nice try, but you got killed!"]

    print lose_list[random.randint(0,3)]





    def front_door():

    print "At the front door are 2 monsters."

    choice = raw_input("What do you do? >")

    if "open door" in choice and "fight_book" in pocket_list:

    win()

    else:

    dead()





    def left_room():

    print "You open the door and find a warrior."

    left_room_choice = raw_input("What do you do? talk/fight> ")



    if "fight" in left_room_choice:

    if "knife_having" in pocket_list or "fight_book" in pocket_list:

    win()

    else:

    dead()



    elif "talk" in left_room_choice:

    if "psiho_book" in pocket_list:

    print "You tell him that you just search someone to talk with. He's glad that he can speak with you."

    print "The warrior talks about his drama. He was kidnapped when he was a little boy and was trained to kill."

    print "You try to understand him and to offer support. He's grateful to you because you helped him to talk about his drama."

    print "You tell him that you also have been kidnapped and you want to escape."

    warrior_choice = raw_input("You tell him 1.'Goodbye' or 2.'Come with me and became free!'?> ")



    if "1" in warrior_choice:

    print "You were so excited about warrior's drama that you jumped out the window."

    dead()



    elif "2" in warrior_choice:

    print "Warrior helped you to beat the monsters and he got free. You became his best friend."

    win()



    else:

    print "Learn to tape a number!"

    left_room()



    else:

    print "He didn't want to listen to you."



    else:

    print "You didn't choose anything."

    left_room()





    def right_room():

    print "Here you find a little boy, a weapon and some clothes."

    right_room_choice = raw_input("What do you choose?> ")



    if "little boy" in right_room_choice:

    if "psiho_book" in pocket_list:

    print "You go to the little boy and try to talk with him. He explains to you that he was kiddnaped and he doesn't know where he is."

    print "You take the boy with you, smash the window and escape the house."

    win()



    elif "fight_book" in pocket_list:

    print "You take the little boy and teach him to fight."

    print "After that you go downstairs at the front door and fight the monsters."

    win()

    elif "knife" in pocket_list:

    print "You take the boy and smash the window."

    print "The monsters see you and you must fight them and defeat the boy."

    rand_num = random.randint(0,1)

    if rand_num == 1:

    win()

    else:

    dead()

    else:

    print "You try to talk with the boy, but he didn't listen to you."

    print "He taked the weapon and shout you."

    dead()



    elif "weapon" in right_room_choice:

    print "You take the boy and the weapon, go at the front door and try to kill the monsters."

    print "But the weapon wasn't charged and you and the boy got killed."

    dead()



    elif "clothes" in right_room_choice:

    print "You take the clothes and change."

    print "You put the boy on window, go downstairs, pass through monsters and take the boy from the window."

    win()



    else:

    print "You didn't tape anything"

    right_room()





    def stairs():

    stairs_phrase = "Now you climb up the stairs and in front of your eyes you have two rooms: one to the left and one to the right."

    if "knife_having" in pocket_list or "fight_book" in pocket_list or "psiho_book" in pocket_list:

    print table_phrase + stairs_phrase

    else:

    print stairs_phrase



    choice_stairs = raw_input("Which room do you enter?> ")

    if "left" in choice_stairs:

    left_room()

    elif "right" in choice_stairs:

    right_room()

    else:

    print "You didn't choose anything."

    stairs()





    def corridor():

    print "In corridor you see some stairs and a table."

    choice_corridor = raw_input("Do you go at the table or check the stairs?")



    if "table" in choice_corridor:

    table_book()

    elif "stairs" in choice_corridor:

    stairs()

    else:

    print "You didn't choose anything."

    corridor()





    def start():

    print "You are a prisoner in a abandoned house."

    print "You must escape but at the front door of the house there are 2 monsters which you can't beat them without help."

    print "You have the chance to try to fight them or to find another way out."

    print "After you get out your room you see a corridor and the front door."

    first_choice = raw_input("What do you do?> ")

    if "front door" in first_choice:

    front_door()

    elif "corridor" in first_choice:

    corridor()

    else:

    print "You didn't choose anything."

    start()


    start()