Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import random
- import math
- scoreCounter = 0
- theZone = [' '] * 10
- def twp(string, typewriterN):
- listOfString = list(string)
- indexOfString = list(range(len(listOfString)))
- j = 0
- while j < len(listOfString):
- print(listOfString[j], end='')
- j = j+1
- time.sleep(1/typewriterN)
- def cfnp(string, confusingN):
- listOfString = list(string)
- indexOfString = list(range(len(listOfString)))
- while len(listOfString) >= 1:
- k = random.randint(0, len(listOfString)-1)
- print(listOfString[k], end='')
- del listOfString[k]
- time.sleep(1/confusingN)
- def happyEnding():
- twp("Bernard Marx decides that you are fit enough to be a part of the World State.\n", 30)
- twp("Congratulations! You've managed to achieve the impossible.\n", 15)
- twp("Thank you for playing Brave New World by D. Zhang\n", 10)
- twp("THE END", 5)
- def sadEnding():
- twp("Bernard Marx decides that you are not fit enough to be a part of the World State.\n", 30)
- twp("You have been defeated by destiny.\n", 15)
- twp("Thank you for playing Brave New World by D. Zhang\n", 10)
- twp("THE END", 5)
- def strikeZone(board):
- print(' | |')
- print(' ' + board[7] + ' | ' + board[8] + ' | ' + board[9])
- print(' 1 | 2 | 3')
- print('-----------')
- print(' 4 | 5 | 6')
- print(' ' + board[4] + ' | ' + board[5] + ' | ' + board[6])
- print(' | |')
- print('-----------')
- print(' 7 | 8 | 9')
- print(' ' + board[1] + ' | ' + board[2] + ' | ' + board[3])
- print(' | |')
- twp("""
- ###### ####### # ####### # #
- # # # # # # # #
- # # # # # # # #
- # # ##### # # # #######
- # # # ####### # # #
- # # # # # # # #
- ###### ####### # # # # #
- ###### # ##### ####### ###### # # #
- # # # # # # # # # # # # #
- # # # # # # # # # # # #
- ###### # # ##### ##### ###### # # # #
- # # ####### # # # # ####### # #
- # # # # # # # # # # # # #
- ###### # # ##### ####### ###### # # ####### ####### by D. Zhang
- """, 1000)
- twp("BERNARD MARX: 'Congratulations, you survived!'\n", 35)
- twp("'Now it's time for your next quest, baseball! \n", 35)
- cfnp("TEST 2 - PHYSICAL CAPABILITIES LOCATION: DODGER STADIUM, LOS ANGELES, WORLD STATE\n", 30)
- twp("TEST 2 - PHYSICAL CAPABILITIES LOCATION: DODGER STADIUM, LOS ANGELES, WORLD STATE\n", 15)
- def baseballLegit():
- twp("Please select difficulty: rookie, easy, hard, insane.\n", 15)
- difficultyChooser = input()
- twp("Difficulty " + difficultyChooser + " registered.\n", 10)
- twp("Initializing Strike Zone..........................\n", 5)
- twp("Loading...........................................\n", 10)
- twp("Press Enter to start your quest. \n", 30)
- varEmpty6 = input()
- twp("Please choose your bat: Pine, aluminum, iron, Major League\n", 10)
- bat = input()
- twp("You pick up a " + bat + " bat, and proceed to the stadium.\n", 10)
- strikeZone(theZone)
- twp("BERNARD MARX: 'Let's have some fun. I will be the pitcher and you will be the batter.\n'", 35)
- twp("Here's the strike zone. You see that each part of the Zone has a number on it.\n", 35)
- twp("As batter, you can pick 2 parts of the zone you are aiming at hitting.\n", 35)
- twp("You also have the choice of letting the electromagnetic computer decide for you.\n", 35)
- twp("Don't worry. The computer algorithm is purely random.\n", 35)
- twp("Do you want to hit for yourself or let the computer hit for you?\n", 20)
- twp("Choose A if you want to hit the ball yourself. Choose B for automatic control.\n", 35)
- howToHit = input()
- while howToHit == 'B':
- twp("The game is currently under testing. This function is not yet available.\n", 35)
- howToHit = input("Press A please.")
- else:
- strikeCount = 0
- while strikeCount < 3:
- twp("\nPlease select your first number between 1 and 9:\t", 30)
- firstChoice = input()
- twp("\nPlease select your second number between 1 and 9:\t", 30)
- secondChoice = input()
- pitcherNumber = random.randint(1, 9)
- ballBank = ['75 mph curveball', '50 mph eephus', '99 mph 4 seamer fastball', '88 mph backdoor slider', '62 mph knuckleball', '105 mph flameball!!', '30 mph little league pitch']
- ballType = random.choice(ballBank)
- twp("Bernard Marx winds up on the mound...\n", 27)
- time.sleep(0.75)
- twp("he stretches...\n", 23)
- time.sleep(0.85)
- twp("and pitches a " + ballType + " that flies toward...\n", 15)
- time.sleep(1)
- twp(str(pitcherNumber) + " part of the strike zone!", 10)
- if firstChoice == str(pitcherNumber):
- twp("And you aim carefully, and swing the bat with all your might!\n",15)
- twp("IT'S A HOMERUN!\n", 5)
- happyEnding()
- break
- elif secondChoice == str(pitcherNumber):
- twp("And you aim carefully, and swing the bat with all your might!\n",15)
- twp("IT'S A HOMERUN!\n", 5)
- happyEnding()
- break
- else:
- strikeCount = strikeCount + 1
- if strikeCount == 3:
- twp("\nThat is a really nasty pitch. It's impossible to locate. You miss terribly again.\n", 15)
- twp("That's the 3rd strike, and you are out. YOU LOSE.\n", 10)
- sadEnding()
- break
- else:
- twp("\nYou try to locate the tricky pitch, but you miss it by inches. STRIKE!\n", 15)
- twp("Strike count: " + str(strikeCount), 19)
- def replayAgain():
- twp("\nWould you like to play again?", 20)
- playAgain = input()
- if playAgain == 'Yes' or playAgain == 'yes':
- baseballLegit()
- else:
- twp("\nThank you for playing!", 20)
- varEmpty3 = input('Press Enter Key to Continue.\n \n \n \n')
- baseballLegit()
- replayAgain()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement