import time
import random
num2 = 12
Name = input("What is your name?: " )
print("")
print('You have' ,num2 ,'points')
print("")
print("You have 3 diffrent stats Agility, Intelligen-ce and perception")
print("")
time.sleep(1)
num1 = input("What is you agility stat?:")
print("")
num3 = int(input("What is you intelligence stat?:"))
print("")
num4 = int(input("What is your perception stat?: "))
print("")
print('you have',num3,'int,',num1,'agility and',num4,'perception')
#print('you have',num5,'points left')
time.sleep(1)
print("")
print('Hello' ,Name)
time.sleep(1)
print("")
if Name =='Emil':
    print("Testar du bra?")
print("pls answer in the way specified")
time.sleep(3)
print ("")
print("You are in front of a cave will you go in?:")
choice = input("y/n: ")
time.sleep(1)
if choice == 'y':
    print("")
    print("You go into the cave")
    time.sleep(1)
    print("")
    print("You continue into the cave untill you reach a large cavern")
    print("")
    time.sleep(1)
    print("Do you want to explore the cavern?")
    print("")
    choice1 = input("y/n: ")
    time.sleep(1)
    if choice1 == 'y':
        print("")
        print("You explore the cavern")
        time.sleep(1)
        print("")
        if num2 and num4 >= 4:
            print("You find an interesting hole in the ceiling")
            time.sleep(1)
            print("")
            print("Do you want to climb into the hole?")
            AGL_choice = input("y/n: ")
            if AGL_choice =='y':
                print("You climb into the hole")
                time.sleep(1)
                print("")
                print("The hole is starting to become tight")
                print("")
                time.sleep(1)
                print("You come of the hole into a large room with a lake")
                time.sleep(1)
                print("")
                print("You swear that you heard someone whisper")
                print("")
                print("you feel the urge to go to the lake")
                time.sleep(1)
                print("")
                print("You go to the lake")
                print("")
                print("You hear a sound behind you")
                print("")
                print("You turn around and see some kind of crab monster")
                time.sleep(1)
                Fight = input("look around/fight/speak: ")
                if Fight == 'fight':
                    print("you take up a boxing stance")
                    time.sleep(1)
                    print("")
                    print("the monster seems to be charging towards you")
                    Fight_fight1 = input("dodge/block: ")
                    if Fight_fight1 == 'dodge':
                        print("")
                        time.sleep(1)
                        print("the monster flies by you and into a wall")
                        print("")
                        time.sleep(1)
                        print("The monster seems stunned")
                        print("")
                        Fight_fight2 = input("attack/stay: ")
                        if Fight_fight2 =='attack':
                            print("You charge at the monster punching and kicking it")
                            print("")
                            time.sleep(1)
                            print("The monster seems to become active again")
                            print("")
                            time.sleep(1)
                            print("The monster hits you with its claw")
                            print("")
                            time.sleep(1)
                            print(Name,'dies from a heavy blow to the head')
                            time.sleep(3)
                            quit
        
        else:
            print("You find bones of dead animals")
            time.sleep(1)
            print("")
            if num3 >= 3:
                print("Because of your intelligence you notice that this cave is home to a bear")
                print("")
            print("You notice that it has become dark outside")
            print("")
            time.sleep(1)
            print("Do you want to sleep the cave?")
            choice3 = input("y/n: ")
            if choice3 =='y':
                print(Name,'gets killed by a bear')
                time.sleep(5)
                quit
            if choice3 =='n':
                print("You get out of the cave")
                print("")
                time.sleep(1)
                print("You hear steps coming from th	e cave")   
    if choice1 =='n':
            print("")
            print("You decide that you have better things to do")
            print("")
            time.sleep(1)
            print("You kinda just stand around for a while")
            time.sleep(3)
            print("")
            print("You hear growling sounds coming from the entr-ance of the cave")
            choice6 = input("Do you want to look around? y/n:")
            if choice6 == 'y':
                time.sleep(2)
                print("")
                print("You find a small hidey hole in the wall and you find a bunch of tree branches")
                print("")
                time.sleep(1)
                hide = input("Do you want to hide?:")
                if hide =='y':
                    hide2 = input("hole/branch/face the threat: ")
                    if hide2 =='hole':
                        print("You jump into the small hidey hole and hope for the best as the growling sounds are coming closer")
                        print("")
                        print("You hide untill the growling ends")
                        time.sleep(1)
                        print("")
                        print("A few hours later you come ut from you hidey hole")
                        print("")
                        time.sleep(1)
                        print("You run out of the cave as fast as you can")
                    if hide2 =='branch':
                        print("You hide underneath the branches")
                        print("")
                        time.sleep(1)
                        print("You hear the growling sounds coming closer")
                        print("")
                        time.sleep(1)
                        print("You feel a heavy thing sitting on the branches pushing the air out of your lungs")
                        print("")
                        time.sleep(1)
                        print("You die from the bear sitting on top of you")
                        time.sleep(2)
                        quit       	    	    	   
                    if hide2 =='face the threat':
                        print("You stand your ground as the sounds are closing")
                        print("")
                        time.sleep(1)
                        print("A bear comes from the entrance and spots you")
                        time.sleep
                        print("")
                        print("You feel the urge to run")
                        hide3 = input("Do you run? y/n: ")
                        if hide3 =='y':
                            print("You run as fast as you can around the bear")
                            print("")
                            time.sleep(1)
                            print("The bear turns around and smacks you in the knee with it's paw")
                            print(Name,'dies a horrible death by bear')
                            time.sleep(4)
                            quit
if choice == 'n':
    print("")
    print("You decide that going into the cave is stupid")
    time.sleep(1)
    print("")
    print("You wander around untill nightfall")
    print("")
    print ("You think about going home")
    choice4 = input("do you want to go home? y/n: ")
    if choice4 =='y':
        time.sleep(1)
        print("You go home")
        print("")
        time.sleep(1)
        print("Do you want to sleep?")
        choice5 = input("y/n: ")
        if choice5 =='y':
            print ("")
            time.sleep(1)
            print("you have gone to sleep")   
            print("")
            time.sleep(2)
            print("You wake up")
            print("")
            time.sleep(1)
            print(Name,'wins because he did the smart thing and stayed away from the cave')
            print("")
            time.sleep(1)
            print("\33[2;32;40mwon the boring way")
            time.sleep(2)
            quit
        if choice5 =='n':
            print("Oh no a meteor fell from other space onto you")
            print("")
            time.sleep(4)
            print('\33[2;31;40m',Name,'died from cowardice')
            time.sleep(2)
            quit
    if choice4 =='n':
        print("You decide that you want to stay for some reason")
        print("")
        print("It gets pitch black outside")
        print("")
        time.sleep(1)
        print("Do you want to find shelter?")
        Choice6 = input("y/n: ")
        if Choice6 =='y':
            print("")
            time.sleep(1)
            print("You find a forest with a few large trees")
            print("")
            time.sleep(1)
            print("You climb into a tree and fall asleep")
            print("")
            time.sleep(1)
            print("You awake to the sound of birds singing")
            time.sleep(1)
            print("")
            print("As the birds are singing you feel that everything is sore and hurtd like hell")
            print("")
            time.sleep(1)
            print("Because you have been sleeping on a branch")
            
        if Choice6 =='n':
            print("")
            print("You decide to stay up and about the entire night")
            print("")
            time.sleep(1)
            print("Do you want to go home?")
            home = input("y/n: ")
            if home =='y':
                print("")
                time.sleep(3)
                print("You realize that being outside in the night is stupid and go home")
                print("")
                time.sleep(3)
                print("As you are nearing home you start smelling smoke")
                print("")
                time.sleep(3)
                print("you look up towards your home town and see smoke rising from it")
                print("")
                time.sleep(3)
                print("you feel despair as you rush towards the village")
                time.sleep(3)
                print("")
                print("you come to the entrance of the village only to be met by ash and flame")
                print("")
                time.sleep(3)
                print("The end")
                print('And so',Name,'promised to get revenge on the one that did this')
                quit("\33[2;32;40mvictory?")
            if home =='n':
                print("You decide to stay outside again")
                time.sleep(2)
                print("")
                print("The sun starts to rise")
                print("")
                print("You feel tired")
                roll = input("write roll")
                if roll =='roll':
                    R =random.randrange(2)
                    if R =='0':
                        print("")
                        time.sleep(1)
                        print("You fail")
                        print("")
                        time.sleep(3)
                        print("You have fallen asleep")
                    if R =='1':
                        print("")
                        time.sleep(1)
                        print("You succeed")
                        time.sleep(3)
                        print("You stay awake")
