@PYer/

NEW PROGRAM

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
'''
Indent line 86, so that it is part of the function. I have no idea what you are trying to do with the else statement on line 87. Either add an if statement, or just remove the else statement. Next, indent lines 88 and 89, and realign line 90. 
'''

import sys, time

def write(string):
  for char in string:
    sys.stdout.write(char)
    sys.stdout.flush()
    time.sleep(0.05)
write("Is this text typing to fast for you?")
    

import sys, random, time
from replit import clear as c
class Room():
  def __init__(self): pass
  def play(self):
    print('This room hasnt been initialized yet.')

class Game_Over(Room):
  def play(self):
    time.sleep(5)
    a = [
      'My dog could do better than you.',
      'Wow. That was amazing.',
      'Hah! You are so bad.',
      'Your worse than your dad\'s jokes.',
      'You stink worse that a smelly goat.'
    ]
    print(random.choice(a))
    time.sleep(3)
    print('Game Over!')
    sys.exit()

class Win(Room):
  def play(self):
    time.sleep(5)
    a = [
      'Absolutely amazing!',
      'Your friends would be so proud.',
      'Terrific!',
      'Congrats!'
    ]
    print(random.choice(a))
    time.sleep(3)
    print('Game Over!')
    sys.exit()

class Intro(Room):
  def play(self):
    c()
    print('Welcome!\nObjective: \n\tFind the hidden treasure in the mystical forest, \n\tReturn safely,and let you village thrive\n\tbefore the village runs out of food and starves to death.')
    if not input('Ready? [y/n]: ') == 'y': sys.exit()
    c()
    print('Today is sunday and the date is 1/1/40. You just woke up from bed and you get ready for the day. After a nice breakfast, you go for a jog and freaqently find homless people out with no protection from the sun becquse you live in the desert. You return and grt in your car to go to church. You find the minister praying and stare for a moment.  \nYour options are:\n\t1. Shoot the minister and then yourself\n\t2. Sit next to him and pray with him\n\t3. Have a heart attack ')
    o = input('Move? [1, 2, 3]: ')
    c()
    if o == '1':
      print('You pull out an AK-47 and shoot the minister 3 times in the head. He falls over and the floor went from a light brown to a dark red color. It reminds you of roses which you saw when you were traveling in 2026. Then you shoot yourself and you walk towards the light.')
      return 'game over'
    elif o == '2':
      print('You slowly walk towards the minister and sit next to him. He just finished praying and towards his head toward you. You both silently pray for 10 seconds atleast. When you both are done, a mysterious figure appears and tells you that they recognized your military work and past private operations in china. He wants to hire you to save the village. \n\t You think of the homless people you saw on the street paths before and how the village is in poverty. You say yes to his offer. \nThe mysterious figure says “Good, your work will start tody.” You follow him. “Your mission is to go into the hidden temple in the forest and recieve it‘s treasure to save the people of our village.” ')
      return 'corridor'
    elif o == '3':
      print('All the dark things in the world slowly mix in your head and your heart beat starts racing. You start to have a heart attack and the minister calls for the medical team, but they were busy with loads of damaged and bruised up children.')
      return 'game over'

class Corridor(Room):
  def play(self):
    print('You are summoned at the edge of the forest. You go forward into the unknown with a dagnerous path ahead of you. You have a machete, and a hat for the sun. Will you cut the trees using your machete, or climb a tree to scout out the area?\nYou can choose between clearing your path snd scouting the area!\n\t1. Clear Path\n\t2. Scout Area')
    o = input(' [1, 2]: ')
    c()
    if o == '1':
      print('You use your machete to clear your path. Out of nowhere, a poison dark frog appears. It kills you.')
      return 'game over'
    elif o == '2':
      return 'bomb hold'

class Bomb_Hold(Room):
  def play(self):
    print('You climb up a tall tree. Good thing they made you so tough im military training. When tou reach the top, there is a magical monkey with magicalness radiating off his body. He seems to want to come with you and provide help with your adventure. *He will come in use later.* ')
    c()
    print('Bing! The airtight container opens and you hear a hissing sound. The bomb is visible inside submerged in water. You pick it up and then exit back in the corridor, and run across to the other end of the corrdior, where you see the bridge. Hopefully, you manage to place the bomb in the bridge and escape. You notice the timer for the bomb has already started, it reads [9:35]. 9 minutes, to escape.')
    return 'bridge'
    c()
    print('BEEEEEEEEEEEP. "Incorrect!" is displayed on the screen.')
    print('The airtight container shoots lasers out of all sides, and kill you. So close, yet so far.')
    return 'game over'

class Bridge(Room):
  def play(self):
    print('You enter the bridge. There are three aliens waiting with their blasters pulled out, aimed at you. You glance at the timer again [6:12]. You need to act fast. \nYour options are to:\n\t1. Place the bomb and run\n\t2. Run\n\t3. Place the bomb slowly.')
    o = input('Move? [1, 2, 3]: ')
    if o == '1':
      c()
      print('You place the bomb down, slow enough so that it doesnt explode, and turn around. You attempt to run back into the corridor to the main room when two aliens drop to there feet and enter a password to disabalize the bomb. The other aims his blaster and shoots you down! Running never works when the enemies have blasters.')
      return 'game over'
    elif o == '2':
      c()
      print('You keep a firm grip on the bomb and turn around. You attempt to escape the way you come in, but one of them shoots you with his blaster. In a few minutes they probably will have disarmed the bomb. Running never works when then enemies have blasters.')
      return 'game over'
    elif o == '3':
      c()
      print('You aim your blaster at the bomb, and the aliens raise their hands above their heads. You pause to think, and glance at the keypad. [6:00]. You blast the keypad in case it can be disabled, which is probable. There is no going back now. You set the bomb down slowly, keeping your gun trained on it. You slowly cross the room to the escape pods, where you hope to finally escape this dangerous spaceship. You remember something and take a second to blow up their blasters. The aliens begin to try and disarm the bomb. No need to worry. Hopefully. You exit into the escape pod room.')
      return 'escape room'

class EscapeRoom(Room):
  def play(self):
    print('You walk up to 4 escape pods, you know the clock is ticking and do not have time to check if any are damaged. Which pod do you choose.')
    p = input('Pod? [1, 2, 3, 4]: ')
    if int(p) == random.randint(1, 2) or int(p) == random.randint(3,4):
      c()
      print('You board pod number ' + p + '. You close the door behind you and hear a hissing sound. You press the eject button and shoot to Earth. You are ejected to Earth and thinking happy thoughts. Your own spaceship will probably come and retrieve you on Earth. The alien spaceship blows up behind you, making a beutiful sight in the sky. You have suceeded and will live to thwart the aliens another day.')
      return 'win'
    else:
      c()
      print('You board pod number ' + p +'. You are thinking happy thoughts, when the hull ruptures squishing your now dead body. Sooooooooooooooooooooo close, yet sooooooooooooooooooooooooooooooooooooo far.')
      return 'game over'

engine = {
  'game over': Game_Over(),
  'intro': Intro(),
  'corridor': Corridor(),
  'bomb hold': Bomb_Hold(),
  'bridge': Bridge(),
  'escape room': EscapeRoom(),
  'win': Win()
}

room = engine['intro'].play()
while True:
  room = engine[room]
  room = room.play()