Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- from typing import Any
- #these are variables that control story branching that isn't caused by user input. This program can be different every time you run it.
- catone = int (randint (0,101)) #Amara running to the road as well as whether or not she gets hit when she does run.
- cattwo = int (randint (0,101)) #Jaelin opening the car door and it smashing into another car
- catthree = int (randint (0,101)) #Desmond eating a penny and choking as well as living or dying from it.
- catfour = int (randint (0,101)) #unused at this time
- instadeath = int (randint (0,101)) #This variable determines if a doom beyond your control strikes as well as what that doom is.
- #I sorted each portion of the story into it's own function so that programming the story itself would be easier. It was a mess when I tried it without it.
- #test is what it sounds like. It lets me see what all the random variables are that control the story branching. I used it to make sure my contitional logic functioned correctly
- def test ():
- print (catone)
- print (cattwo)
- print (catthree)
- print (catfour)
- print (instadeath)
- #intro is an introduction to the story.
- def intro ():
- print ('Hello, you brave fool.\nYou have decided to role play a Dad trying to do normal errands with his 3 kids. Jaelin (5), Amara (3), and Desmond (6m onths).')
- #voting_day includes the voting age test with a 1% chance of doom.
- def voting_day ():
- print ("You are browsing on your phone when a pop up... pops up. It is playing music loud enough to drown out the sounds of chaos around you\nYou try everythign to avoid answering its question but it just won't go away.")
- print ()
- print ('How Old Are You?')
- age = int (input ())
- def nuke ():
- if instadeath == 13:
- print ()
- print ('You notice a blinding flash of light in the window.\nOutside you see a mushroom cloud\nWhite Light everywhere... You have all died.')
- elif catthree > 75:
- print ()
- print ('You hear a gagging sound beside you on the ground.\nYou have a sense of dread as you peer over the couch and see desmond choking on a penny!')
- if catthree == 99:
- print ('Desmond is already blue in the face, he stops struggling as you watch in horror\n You have failed')
- else:
- print ('You manage to pull the penny out of his throat with your finger before any permanent damage as done\n\nYou begin the adventure of loading everybody into the car')
- def endvote ():
- print ()
- print ('You begin the adventure of loading everyone into the car.')
- if age >= 18:
- print ('YOU NEED TO GO VOTE NOW!!!\nTime is almost up.')
- print ('People aged ' + str (age) + ' are especially important this election')
- endvote()
- nuke()
- elif age == int (17):
- print ('Will you be 18 before the election?')
- while True:
- print ('y or n')
- a = input ()
- if a == 'y':
- print ('YOU NEED TO GO VOTE NOW!!!\nTime is almost up.')
- print ('People aged ' + str (age + 1) + ' are especially important this election')
- endvote()
- nuke()
- return
- elif a == 'n':
- print ('You are to young to vote')
- print ()
- print ('You decide to go to the polling place to learn about the process anyway')
- print ('You missed that education when you dropped out of school at age ' + str (int (age) - 5) + ' to start raising your kids.')
- endvote()
- nuke()
- return
- else:
- print ('You need to answer correctly.')
- continue
- else:
- print ('You are too young to vote but decide to go to the polling place anyway to learn the process anyway.')
- print ('You missed that education when you dropped out of school at age ' + str (age - 5) + ' to start raising your kids.')
- endvote()
- nuke()
- #the_trip contains the guessing game... and a 1% of doom
- def the_trip ():
- print ()
- print ('You dread this.\nYou really, really dread this... Every time\nGetting the kids into the car is always super stressful.\nYou try telling the kids that they are going to stay here with Mom but Jaelin asks')
- print ()
- number = int (randint (0,10))
- print ("Jaelin: I really want to go. If you can't guess my number then I get to go. It is between 1 and 10.")
- while True:
- print ("Enter your guess.")
- guess = int (input ())
- if guess < 0:
- print ("That guess doesn't count")
- continue
- elif guess > 10:
- print ("That guess doesn't count")
- elif guess == number:
- print ('Aww, you got it. I really wanted to go\n From the other room: YOU ARE TAKING THE KIDS WITH YOU!!!!')
- break
- elif guess != number:
- print ('YAY! I get to go!!')
- break
- print ()
- print ('You begin taking the kids to the car in one big group')
- print ()
- if instadeath == 69:
- print ('A semi-truck crashes into the house killin geverybody\n You are dead.')
- elif catone > int (70):
- print ('Amara suddenly bolts towards the road')
- if catone == 99:
- print ('She is crushed underneath a semi-truck dying instantly\nYou have failed')
- else:
- print ('but your quick reflexes allow you to catch her before she makes it to the road.\nYou have succeeded in loading the car with only a mild heart attack')
- else:
- print ('You did it! You got the kids into the car with minimal fuss.')
- #The_ride contains the addition program... again with a 1% of doom
- def the_ride ():
- print ()
- print ('As you search your memory you realize that this was, by far, the smoothest it has ever gone loading the car.\nIt is a little disconcerting.')
- print ()
- print ('Jaelin asks: Can you teach me to add numbers?\nYou: Of course Jae.')
- print ()
- print ('When you add two number together it is just like pushing two piles of blocks together.\nFor example a pile of 4 blocks plus another pile of 4 blocks make a new pile with 8 blocks.')
- print ()
- print ('I am going to ask you to add some numbers together for me.\nType "done" when you are finished')
- while True:
- print ('What is your first number?')
- x = input ()
- if x == 'done':
- print ()
- print ('You did very well Jaelin.')
- break
- else:
- print ('What is your second number?')
- y = input ()
- if y == 'done':
- print ()
- print ('You did very well Jaelin')
- break
- else:
- z = int (x) + int (y)
- if z > 100:
- print ('They add up to a big number Dad')
- continue
- else:
- print ('They add up to ' + str (z) + ' Dad.')
- print ()
- print ('What are your next numbers?\n type "done" when finished')
- print ()
- continue
- print ()
- if instadeath == 72:
- print ('A plane attempts an emergency landing on the road\nThe pilot of the plane has crushed your entire family in his bid to save the plane.\nYou are dead.')
- else:
- if cattwo > 70:
- print ('Jaelin accidentally opens the car door while driving down the road\nThe door smashes into an oncoming car totalling both cars.\nYou do not make it to the polls today.')
- else:
- print ('After a long car ride filled with exciting talk about ponies and princesses you arrive at the polling place.')
- def grade ():
- print ()
- print ('Professor Cullen,\nWhat did you think of my program?\nIf you enter the numeric grade I will tell your the letter grade')
- while True:
- score = input ()
- if int (score) >89:
- print ('That is an "A"')
- continue
- elif int (score) < 90 and int (score) > 79:
- print ('That is a "B"')
- continue
- elif int (score) < 80 and int (score) > 69:
- print ('That is a "C"')
- continue
- elif int (score) < 70 and int (score) >59:
- print ('That is a "D"')
- continue
- elif int (score) <60:
- print ('That is a "F"')
- continue
- def ending ():
- print ()
- print ('The End')
- #These are hashed out and are used for debugging.
- #test()
- #into()
- #voting_day()
- #the_trip()
- #the_ride()
- #grade()
- #this is the actual script that ties all the components together
- intro()
- voting_day() #killer number is 13 and catthree 99 is choking death >75 is choking but lives
- if instadeath != 13 and catthree != 99:
- the_trip() #killer number is 69 and cattone 99
- if instadeath != 69 and catone != 99:
- the_ride() #killer number is 72 / if cattwo >70 story ends with door smashing
- ending()
- else:
- ending()
- else:
- ending()
- grade()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement