Please place your programs in seperate files named as described in the problem. Improperly named programs will not count. Turn in your files by placing them in the dropbox. Please be mindful of the late policy.
Correct | 80% |
Commented | 10% |
Attempted | 10% |
Make a bomb squad simulation program called bomb.py
NOTHING_YET
, WIN
, LOSE
Wire
, TriggerWire
,
and TimerWire
Wire
is the base class for the two others. It has two
methods:
SetColor(self, color)
: sets the colorCut(self)
: Cuts the wire, prints a message, and returns
NOTHING_YET
TriggerWire
and TimerWire
override
Cut
. TriggerWire
prints a message of
destruction and returns LOSE
and TimerWire
prints a happy message and returns WIN
.colors = ['red', 'green',
'blue', 'yellow', 'brown', 'pink']
TriggerWire
, one
TimerWire
, and the rest should be plain
Wire
s.Below are two example runs of the program.
Pick a wire to cut:
1) red
2) green
3) blue
4) yellow
5) brown
6) pink
? 1
Cut the red wire. Nothing happened.
Pick a wire to cut:
1) green
2) blue
3) yellow
4) brown
5) pink
? 6
Not a valid choice!
Pick a wire to cut:
1) green
2) blue
3) yellow
4) brown
5) pink
? 5
Cut the pink wire. Nothing happened.
Pick a wire to cut:
1) green
2) blue
3) yellow
4) brown
? 3
Cut the yellow wire... BOOOOOOOOOOOOOOOOM!
Pick a wire to cut:
1) red
2) green
3) blue
4) yellow
5) brown
6) pink
? 3
Cut the blue wire. Nothing happened.
Pick a wire to cut:
1) red
2) green
3) yellow
4) brown
5) pink
? 4
Cut the brown wire. Nothing happened.
Pick a wire to cut:
1) red
2) green
3) yellow
4) pink
? 3
Cut the yellow wire. Nothing happened.
Pick a wire to cut:
1) red
2) green
3) pink
? 1
Cut the red wire. Nothing happened.
Pick a wire to cut:
1) green
2) pink
? 1
Cut the green wire... You saved the day!