New code:ย show_cheats()
You'll also notice that a stand alone function calledย show_cheats
ย has
been added. Hunt the Wumpus isย very time-consuming to debug efficiently
unless you know where the hazards are so you can go straight to them and
see if your program handles them properly.ย show_cheats
ย has been
included to give you that information. It tells you where the wumpus,
bats, and pits are so you can head toward (or away!) from them during
testing.
def show_cheats():
'''Shows information about the cave system to ease debugging.
Should be disabled in the final version.'''
print 'Psst!'
for room in cave_system.rooms:
if room.has_bat(): print ' There\'s a bat in room', room.number
if room.has_pit(): print ' There\'s a pit in room', room.number
if room.has_wumpus(): print ' There\'s a wumpus in room', room.number