-
Notifications
You must be signed in to change notification settings - Fork 0
/
room.py
37 lines (25 loc) · 848 Bytes
/
room.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
__author__ = 'Liam'
from random import random
from enemy import Dog
class Room:
def __init__(self, name, interior, contents):
self.name = name
self.interior = interior
self.contents = contents
# self.exits = randrange(1, 5)
def add(self, item):
self.contents.append(item)
def remove(self, item):
self.contents.remove(item)
class LivingRoom(Room):
def __init__(self):
super().__init__('Living Room', True, ['Arm-chair', 'dog biscuit'])
self.exits = [Kitchen, Backyard]
class Kitchen(Room):
def __init__(self):
super().__init__('Kitchen', True, ['crumbs', 'water bowl'])
if random() <= .5:
self.contents.append(Dog)
class Backyard(Room):
def __init__(self):
super().__init__('Backyard', False, ['dirt', 'flowers'])