-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcatphones.py
75 lines (56 loc) · 2.9 KB
/
catphones.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
class CatPhones():
#array of songs
songList = ["Blitzkreig Bop by the Ramones","Animal I have become by three days grace","Wake me up by Goofy","All star by Shrek","Happy by Ferrel William","Stressed Out by Twentyone Pilots", "Spooky moosic by the ghosts"]
def __init__(self,color,song,music,musicOff):
self.color = color
self.music = music #0 or 1
self.musicOff = musicOff #true false
self.musicOff = True #Why do you take a parameter and then force it to true?
self.isOn = False
self.song = song #0 through 6
def get_interface(self, heldItems,current_room):
if self.isOn and not self.musicOff:
print("The "+self.color+" cat headphones are swithced on, and glowing neon "+self.color.upper()+" you hear some music so you put the headphones on. You can TURN MUSIC OFF")
else:
print("The "+self.color+" cat headphones are swithced off. You can PRESS THE ON BUTTON") #PRESS THE ON BUTTON isn't included in check_input
if self.music == 0 and "charger" in heldItems:
print("You can PRESS THE PLAY BUTTON.")
if self.music > 0:
print("you can TURN MUSIC OFF.")
def check_input(self,command,heldItems,current_room):
if command == "PRESS THE PLAY BUTTON":
self.turn_on()
self.get_song() #This method does not exist- and what are you doing with the song name?
if command == "TURN MUSIC OFF":
self.turn_off()
if command == "TURN THE MUSIC ON":
#Accessors
def change_song(self):
self.song += 1
if self.song == len(CatPhones.songList):
self.color = 0
def get_song(self):
#return songList(self.song)
return CatPhones.songList[self.song] #fixed
#Mutators
def turn_on(self):
if not self.isOn: #This doesn't do anything
if self.music == 1 and not self.musicOff:
self.isOn = True
print("You click the play button and music starts playing. You are listenting to "+self.getNextColor() ) #self.getNextColor() does not exist
else:
print("You click the play button but nothing happens. Maybe you need some music?")
def turn_off(self):
if self.isOn:
self.isOn=False
print("You click the power button. The headphones stop playing music.")
def add_music(self,heldItems):
if self.music < 1 and "music" in heldItems:
self.music += 1
print("You put the music in the "+self.color+" Cat headphones.")
heldItems.remove("music")
self.musicOff = False
elif self.music > 0:
print("The "+self.color+" Cat Headphones already have music.")
elif not "music" in heldItems:
print("You aren't holding any music")