repl.it
@superpeter/

CLEAN DAT ROOM

Python

A room cleaning simulator (just like real life)

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
import random

class Room:
  """The room that you clean."""
  def __init__(self, messy_things = [], is_messy = True):
    """Creates room, stores what's messy in the room."""
    self.messy_things = messy_things
    self.is_messy = is_messy
    self.suplementaryNouns = ["President Obama", "Area 51 (but miniaturized)", "Spider-Man", "Portal to the Pig Dimension", "brand spankin' new memes", "Waluigi", "zombie virus", "ninja", "sword (with note that reads: It's dangerous to go alone, take this!)", "alien", "T.A.R.D.I.S.", "ninja turtle"]
  
  def clean (self, item):
    """Removes an item from messy things, may initiate a scene."""
    print("You picked up a(n) " + item+".")
    self.messy_things.remove(item)

    if(random.randint(1,2) == 1):
      self.create_scene(item)

    if (self.messy_things == []):
      self.is_messy = False
  
  def create_scene (self, item):
    """Generates a string to describe what happens when an item is cleaned up."""
    string_format_chooser = random.randint(1,2)
    if (string_format_chooser == 1):
      print("Beneath the "+item+" you find (a/an) "+self.suplementaryNouns[random.randint(0, len(self.suplementaryNouns)-1)]+".")
    else:
      print("It explodes.")

#initiate the room

#note: possible messy stuff should only include singular nouns (possibly w/ adjetives)
possible_messy_stuff = ["shrek doll", "nuclear button", "lost child", "professional hitman", "terrifying hyperealistic charizard pokemon card", "chainsaw", "quilt", "posssibly demented smurf", "battle axe", "Mother Russia", "pile of long thought lost ball-point pens", "eggs", "beans","super computer (still can't run Crysis)", "dragon", "T-Rex"]

#Chooses the three messy things in the room
messything1 = possible_messy_stuff[random.randint(0, len(possible_messy_stuff)-1)]

messything2 = possible_messy_stuff[random.randint(0, len(possible_messy_stuff)-1)]

messything3 = possible_messy_stuff[random.randint(0, (len(possible_messy_stuff)-1))]

gameroom = Room([messything1, messything2, messything3])

#gameloop
print("You find yourself in a messy room! The urge to clean destroys all rational thinking! You must clean at any cost!")

i = 0

valid_options = ['1', '2', '3']

while(gameroom.is_messy):
  print("Which item would you like to pick up?")
  if(i < 3):
    print("[1]"+gameroom.messy_things[0])
  if(i < 2):
    print("[2]"+gameroom.messy_things[1])
  if(i < 1):
    print("[3]"+gameroom.messy_things[2])
  answer = input("")
  
  if (answer in valid_options):
    answer = int(answer)
    answer -= 1
    gameroom.clean(gameroom.messy_things[answer])
    i += 1
    valid_options.remove(str((3-i)+1))
  else:
    print("That's not an option!")

print("Mission accomplished! Room clean!")