Advertisement
daichan21

finalProduct

Nov 25th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.50 KB | None | 0 0
  1. import time
  2. import random
  3. import math
  4.  
  5. scoreCounter = 0
  6.  
  7. def twp(string, typewriterN):
  8.     listOfString = list(string)
  9.     indexOfString = list(range(len(listOfString)))
  10.     j = 0
  11.     while j < len(listOfString):
  12.         print(listOfString[j], end='')
  13.         j = j+1
  14.         time.sleep(1/typewriterN)
  15.  
  16. def cfnp(string, confusingN):
  17.     listOfString = list(string)
  18.     indexOfString = list(range(len(listOfString)))
  19.     while len(listOfString) >= 1:
  20.         k = random.randint(0, len(listOfString)-1)
  21.         print(listOfString[k], end='')
  22.         del listOfString[k]
  23.         time.sleep(1/confusingN)
  24.  
  25. twp("Please select language:\t ", 50)
  26. selectLanguage = input()
  27. while selectLanguage != "English":
  28.     twp("This game is currently under testing. English is the only option.\n", 50)
  29.     selectLanguage = input("Please select language:\t ")
  30. else:
  31.  
  32.     twp('How old are you? ', 50)
  33.     pAge = str(input('My age is '))    
  34.     if int(pAge) > 15:
  35.             twp('Minimum age requirement met.\n', 200)
  36.             twp('Initializing....................\n', 40)
  37.             twp('Loading....................\n', 40)
  38.             time.sleep(1)
  39.            
  40.     else:                              
  41.             twp('Minimum age requirement not met.\n', 200)
  42.             time.sleep(1)
  43.             twp('Initialize game in Guest Safety Mode.\n', 40)
  44.             twp('Initializing....................\n', 40)
  45.             twp('Loading....................', 40)
  46.    
  47.        
  48.     twp("""
  49.    ######  ######     #    #     # #######
  50.    #     # #     #   # #   #     # #      
  51.    #     # #     #  #   #  #     # #      
  52.    ######  ######  #     # #     # #####  
  53.    #     # #   #   #######  #   #  #      
  54.    #     # #    #  #     #   # #   #      
  55.    ######  #     # #     #    #    #######   \n""", 1600)
  56.  
  57.     twp(
  58.     """
  59.    #     # ####### #     #
  60.    ##    # #       #  #  #
  61.    # #   # #       #  #  #
  62.    #  #  # #####   #  #  #
  63.    #   # # #       #  #  #
  64.    #    ## #       #  #  #
  65.    #     # #######  ## ##      \n""", 1600)
  66.  
  67.     twp(
  68.     """
  69.    #     # ####### ######  #       ######  
  70.    #  #  # #     # #     # #       #     #
  71.    #  #  # #     # #     # #       #     #
  72.    #  #  # #     # ######  #       #     #
  73.    #  #  # #     # #   #   #       #     #
  74.    #  #  # #     # #    #  #       #     #
  75.     ## ##  ####### #     # ####### ######      \n""", 1600)
  76.  
  77.     twp("\n \n \t \t Python Project by 'daichan21' D. Zhang. November 2014. \n ", 100)
  78.     twp("\t \t Visit my blog DZ's Klavier @ http://daichan21.wordpress.com \n", 100)
  79.     twp("\t \t My GitHub: daichan21  My Pastebin: daichan21 \n", 100)
  80.     twp("\t \t Character names are based on Aldous Huxley's novel Brave New World \n", 100)
  81.     twp("\t \t Game concept and design by D. Zhang.", 100)
  82.  
  83.     initialization = input("\n \n Enter Enter Key to start game: \n")
  84.  
  85.     while initialization != '':
  86.         twp("Come on, you know where the Enter Key is. LOL \n", 100)
  87.         initialization = input("Press Enter Key to start game: \n")
  88.     else:
  89.         twp("Nice! Your adventure starts now!\n", 100)
  90.         birthPlace = input("Please input your place of birth.")
  91.  
  92.    
  93.     twp("What is your name, \n", 30)
  94.     twp("......Savage?\n", 20)
  95.     playerName = input()
  96.     time.sleep(1.5)
  97.  
  98.     twp(".....Oh I didn't realize that you are capable of speaking, hmm.. English. \n", 30)
  99.     twp("Apologies, " + playerName + ".\n", 30)
  100.     time.sleep(1.5)
  101.     twp("May I know if you are male or female, " + playerName + "?\n", 30)
  102.     print("Please enter your gender here:\t")
  103.     playerSex = input()
  104.    
  105.     if playerSex == "Male" or playerSex == "male":
  106.         newPlayerName = "Mr. " + playerName
  107.     elif playerSex == "Female" or playerSex == "female":
  108.         newPlayerName = "Ms. " + playerName
  109.  
  110.     twp("So, " + newPlayerName + ", Welcome to the \n", 30)
  111.  
  112.     twp("""
  113.    #     # ####### ######  #       ######  
  114.    #  #  # #     # #     # #       #     #
  115.    #  #  # #     # #     # #       #     #
  116.    #  #  # #     # ######  #       #     #
  117.    #  #  # #     # #   #   #       #     #
  118.    #  #  # #     # #    #  #       #     #
  119.     ## ##  ####### #     # ####### ######  
  120.                                            
  121.     #####  #######    #    ####### #######
  122.    #     #    #      # #      #    #      
  123.    #          #     #   #     #    #      
  124.     #####     #    #     #    #    #####  
  125.          #    #    #######    #    #      
  126.    #     #    #    #     #    #    #      
  127.     #####     #    #     #    #    ####### \n""", 1800)
  128.  
  129.     twp("Stability, Community, Identity. \n", 50)
  130.     twp("Everyone belongs to everyone else. \n ", 50)
  131.     twp("We are the WORLD STATE. Glory to us alone! \n", 45)
  132.     time.sleep(2)
  133.     twp("......\n", 30)
  134.     twp("Oh sorry, I forgot to introduce myself, \n" + newPlayerName + ".", 50)
  135.     twp("My name is Bernard Marx, the chief emotional engineer at the\n", 50)
  136.     twp("Central London Hatcheries and Development Centre. \n", 50)
  137.     twp("......\n", 30)
  138.     twp("I understand that you grew up in the land of " + birthPlace + "\n", 50)
  139.     twp("And I also appreciate the fact that you are in a state of shock. \n", 50)
  140.     twp("But......\n", 30)
  141.     twp("but we will still have to test your physical skills and intellectual capability\n", 50)
  142.     twp("in order to decide whether we should make you one of us\n", 50)
  143.     twp("......or......\n", 30)
  144.     time.sleep(2)
  145.     twp("EXECUTE YOU.\n", 5)
  146.     twp("This way please, " + newPlayerName + ". This will be really fun. \n \n \n \n", 100)
  147.  
  148.     varEmpty = input('Press Enter Key to Continue.\n \n \n \n')
  149.  
  150.     cfnp("TEST 1 - LITERACY AND COGNITIVE SKILLS   LOCATION: WEST HAM, LONDON, WORLD STATE\n", 30)
  151.     twp("TEST 1 - LITERACY AND COGNITIVE SKILLS   LOCATION: WEST HAM, LONDON, WORLD STATE\n", 15)
  152.     cfnp("TEST SUBJECT: " + "Savage" + newPlayerName + " of " + birthPlace + ", Savage Conservation\n", 30)
  153.     twp("TEST SUBJECT: " + "Savage" + newPlayerName + " of " + birthPlace + ", Savage Conservation\n", 15)
  154.     cfnp("CHIEF CONDUCTOR: BERNARD MARX OF WEST LONDON, WORLD STATE\n", 30)
  155.     twp("CHIEF CONDUCTOR: BERNARD MARX OF WEST LONDON, WORLD STATE\n", 15)
  156.     cfnp("SERIAL NUMBER: 904148\n", 30)
  157.     twp("SERIAL NUMBER: 904148\n", 15)
  158.     twp("BERNARD MARX: 'Savage, your sole task in this part of the test is to use the gadget in front of you, \n", 15)
  159.     twp("which is called 'keyboard' in World State, and type out the words you see. \n", 15)
  160.     twp("Remember that you have to type over 50% of the words/phrases correctly. Otherwise you will be electrocuted on the spot.\n", 5)
  161.     twp("Do you understand that, " + newPlayerName + "?\n", 15)
  162.    
  163.     print("\t \t A. Yes, Mr. Marx. I will try my best to impress you.\n")
  164.     print("\t \t B. No! What is this?! I want to go back to my homeland!\n")
  165.     deathAnswer = input("You have two possible answers: (Please type in A or B)\n")
  166.     twp("No matter what you say, " + newPlayerName + ". You will have to accept your fate.\n", 15)
  167.  
  168.     varEmpty2 = input('Press Enter Key to Continue.\n \n \n \n')
  169.    
  170.    
  171.  
  172.     obstacle1 = ['Miranda', 'Bernard', 'community', 'Mother', 'Emotional Engineer Bernard Marx', 'Everyone belongs to everyone else.']
  173.     obstacle2 = ['Tomakin', 'Antonio', 'identity', 'Malpais', 'The Honourable Aldous Huxley', 'We are the children, the future.']
  174.     obstacle3 = ['John', 'Savage', 'stability', 'World State', 'His Fordship Mustapha Mond', 'Our Ford is the greatest man ever lived.']
  175.     listOfObstacles = [obstacle1, obstacle2, obstacle3]
  176.     levelMemoryType = 0
  177.     scoreCounter = 0
  178.  
  179.     def memoryType(levelMemoryType):
  180.         while levelMemoryType <= 5:
  181.             choice = random.choice(listOfObstacles)[levelMemoryType]  
  182.             twp(choice, 50)
  183.             time.sleep(1.5)
  184.             print()
  185.             print("""
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.            """)
  222.  
  223.             twp("Please type in the word you saw.", 50)
  224.             playerAnswerObstacle1 = input()
  225.             if playerAnswerObstacle1 != choice:
  226.                 twp("Sorry, that was not the right answer, " + playerName + ". Please focus. \n \n", 50)
  227.                 scoreCounter = scoreCounter
  228.                
  229.                
  230.  
  231.                 levelMemoryType = levelMemoryType + 1
  232.                 memoryType(levelMemoryType)
  233.                
  234.                
  235.             else:
  236.                 twp("That's correct, " + playerName + "! It will get harder. \n \n", 50)
  237.                 scoreCounter = scoreCounter + 1
  238.                
  239.                
  240.                 levelMemoryType = levelMemoryType + 1
  241.                 memoryType(levelMemoryType)
  242.                
  243.  
  244.     memoryType(0)
  245.  
  246.     twp("BERNARD MARX: 'Congratulations, you survived!'\n", 35)
  247.     twp("'Now it's time for your next quest, baseball! \n", 35)
  248.     cfnp("TEST 2 - PHYSICAL CAPABILITIES   LOCATION: DODGER STADIUM, LOS ANGELES, WORLD STATE\n", 30)
  249.     twp("TEST 2 - PHYSICAL CAPABILITIES   LOCATION: DODGER STADIUM, LOS ANGELES, WORLD STATE\n", 15)
  250.    
  251.     varEmpty3 = input('Press Enter Key to Continue.\n \n \n \n')
  252.  
  253. theZone = [' '] * 10
  254.  
  255. twp("BERNARD MARX: 'Let's have some fun. I will be the pitcher and you will be the batter.\n'", 35)
  256. twp("Here's the strike zone. You see that each part of the Zone has a number on it.\n", 35)
  257. twp("As batter, you can pick 2 parts of the zone you are aiming at hitting.\n", 35)
  258. twp("You also have the choice of letting the electromagnetic computer decide for you.\n", 35)
  259. twp("Don't worry. The computer algorithm is purely random.\n", 35)
  260. twp("Do you want to hit for yourself or let the computer hit for you?\n", 20)
  261. twp("Choose A if you want to hit the ball yourself. Choose B for automatic control.\n", 35)
  262. howToHit = input()
  263. while howToHit == 'B':
  264.       twp("The game is currently under testing. This function is not yet available.\n", 35)
  265.       howToHit = input("Press A please.")
  266. else:
  267.      
  268.   twp("BERNARD MARX: 'Great. I, as pitcher, can choose to pitch to any part of the strike zone.\n", 35)
  269.   twp("If you choose to swing at my pitch and one of your numbers matches my number, you will survive.\n", 35)
  270.   twp("However, if you swing 3 times and you miss all of them. You will be executed.\n", 35)
  271.   twp("Let's get started!\n \n \n", 30)
  272.   time.sleep(0.76)
  273.    
  274.  
  275. def strikeZone(board):
  276.    
  277.     print('   |   |')
  278.     print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9])
  279.     print(' 1 | 2 | 3')
  280.     print('-----------')
  281.     print(' 4 | 5 | 6')
  282.     print(' ' + board[4] + ' | ' + board[5] + ' | ' + board[6])
  283.     print('   |   |')
  284.     print('-----------')
  285.     print(' 7 | 8 | 9')
  286.     print(' ' + board[1] + ' | ' + board[2] + ' | ' + board[3])
  287.     print('   |   |')
  288.  
  289. strikeZone(theZone)
  290.  
  291. def happyEnding():
  292.     twp("Bernard Marx decides that you are fit enough to be a part of the World State.\n", 30)
  293.     twp("Congratulations! You've managed to achieve the impossible.\n", 15)
  294.     twp("Thank you for playing Brave New World by D. Zhang\n", 10)
  295.     twp("THE END", 5)
  296.  
  297. def sadEnding():
  298.     twp("Bernard Marx decides that you are not fit enough to be a part of the World State.\n", 30)
  299.     twp("You have been defeated by destiny.\n", 15)
  300.     twp("Thank you for playing Brave New World by D. Zhang\n", 10)
  301.     twp("THE END", 5)
  302.  
  303. def strikeZone(board):
  304.    
  305.     print('   |   |')
  306.     print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9])
  307.     print(' 1 | 2 | 3')
  308.     print('-----------')
  309.     print(' 4 | 5 | 6')
  310.     print(' ' + board[4] + ' | ' + board[5] + ' | ' + board[6])
  311.     print('   |   |')
  312.     print('-----------')
  313.     print(' 7 | 8 | 9')
  314.     print(' ' + board[1] + ' | ' + board[2] + ' | ' + board[3])
  315.     print('   |   |')
  316.  
  317. strikeZone(theZone)
  318.  
  319. twp("Choose A if you want to hit the ball yourself. Choose B for automatic control.\n", 35)
  320. howToHit = input()
  321. while howToHit == 'B':
  322.       twp("The game is currently under testing. This function is not yet available.\n", 35)
  323.       howToHit = input("Press A please.")
  324. else:
  325.     strikeCount = 0
  326.     while strikeCount < 3:
  327.         twp("\nPlease select your first number between 1 and 9:\t", 30)
  328.  
  329.         firstChoice = input()
  330.  
  331.         twp("\nPlease select your second number between 1 and 9:\t", 30)
  332.  
  333.         secondChoice = input()
  334.  
  335.         pitcherNumber = random.randint(1, 9)
  336.         ballBank = ['75 mph curveball', '50 mph eephus', '99 mph 4 seamer fastball', '88 mph backdoor slider', '62 mph knuckleball']
  337.         ballType = random.choice(ballBank)
  338.         twp("Bernard Marx winds up on the mound...\n", 27)
  339.         time.sleep(0.75)
  340.         twp("he stretches...\n", 23)
  341.         time.sleep(0.85)
  342.         twp("and pitches a " + ballType + " that flies toward...\n", 15)
  343.         time.sleep(1)
  344.         twp(str(pitcherNumber) + " part of the strike zone!", 10)
  345.  
  346.         if firstChoice == pitcherNumber:
  347.             break
  348.         elif secondChoice == pitcherNumber:
  349.             break
  350.         else:
  351.             strikeCount = strikeCount + 1
  352.             if strikeCount == 3:
  353.                 twp("That is a really nasty pitch. It's impossible to locate. You miss terribly again.\n", 15)
  354.                 twp("That's the 3rd strike, and you are out. The World State will execute you.\n", 10)
  355.                 sadEnding()
  356.             else:
  357.                 twp("You try to locate the tricky pitch, but you miss it by inches. STRIKE!\n", 15)
  358.                 twp("Strike count: " + str(strikeCount), 19)
  359.  
  360.     twp("And you aim carefully, and swing the bat with all your might!",15)
  361.     twp("IT'S A HOMERUN!", 5)
  362.     happyEnding()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement