<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import items , enemies , actions , world <EOL> class MapTile : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , x , y ) : <EOL> """<STR_LIT>""" <EOL> self . x = x <EOL> self . y = y <EOL> def intro_text ( self ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def modify_player ( self , the_player ) : <EOL> """<STR_LIT>""" <EOL> raise NotImplementedError ( ) <EOL> def adjacent_moves ( self ) : <EOL> """<STR_LIT>""" <EOL> moves = [ ] <EOL> if world . tile_exists ( self . x + <NUM_LIT:1> , self . y ) : <EOL> moves . append ( actions . MoveEast ( ) ) <EOL> if world . tile_exists ( self . x - <NUM_LIT:1> , self . y ) : <EOL> moves . append ( actions . MoveWest ( ) ) <EOL> if world . tile_exists ( self . x , self . y - <NUM_LIT:1> ) : <EOL> moves . append ( actions . MoveNorth ( ) ) <EOL> if world . tile_exists ( self . x , self . y + <NUM_LIT:1> ) : <EOL> moves . append ( actions . MoveSouth ( ) ) <EOL> return moves <EOL> def available_actions ( self ) : <EOL> """<STR_LIT>""" <EOL> moves = self . adjacent_moves ( ) <EOL> moves . append ( actions . ViewInventory ( ) ) <EOL> return moves <EOL> class StartingRoom ( MapTile ) : <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> def modify_player ( self , the_player ) : <EOL> pass <EOL> class EmptyCavePath ( MapTile ) : <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> def modify_player ( self , the_player ) : <EOL> pass <EOL> class LootRoom ( MapTile ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , x , y , item ) : <EOL> self . item = item <EOL> super ( ) . __init__ ( x , y ) <EOL> def add_loot ( self , the_player ) : <EOL> the_player . inventory . append ( self . item ) <EOL> def modify_player ( self , the_player ) : <EOL> self . add_loot ( the_player ) <EOL> class FindDaggerRoom ( LootRoom ) : <EOL> def __init__ ( self , x , y ) : <EOL> super ( ) . __init__ ( x , y , items . Dagger ( ) ) <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> class Find5GoldRoom ( LootRoom ) : <EOL> def __init__ ( self , x , y ) : <EOL> super ( ) . __init__ ( x , y , items . Gold ( <NUM_LIT:5> ) ) <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> class EnemyRoom ( MapTile ) : <EOL> def __init__ ( self , x , y , enemy ) : <EOL> self . enemy = enemy <EOL> super ( ) . __init__ ( x , y ) <EOL> def modify_player ( self , the_player ) : <EOL> if self . enemy . is_alive ( ) : <EOL> the_player . hp = the_player . hp - self . enemy . damage <EOL> print ( "<STR_LIT>" . format ( self . enemy . damage , the_player . hp ) ) <EOL> def available_actions ( self ) : <EOL> if self . enemy . is_alive ( ) : <EOL> return [ actions . Flee ( tile = self ) , actions . Attack ( enemy = self . enemy ) ] <EOL> else : <EOL> return self . adjacent_moves ( ) <EOL> class GiantSpiderRoom ( EnemyRoom ) : <EOL> def __init__ ( self , x , y ) : <EOL> super ( ) . __init__ ( x , y , enemies . GiantSpider ( ) ) <EOL> def intro_text ( self ) : <EOL> if self . enemy . is_alive ( ) : <EOL> return """<STR_LIT>""" <EOL> else : <EOL> return """<STR_LIT>""" <EOL> class OgreRoom ( EnemyRoom ) : <EOL> def __init__ ( self , x , y ) : <EOL> super ( ) . __init__ ( x , y , enemies . Ogre ( ) ) <EOL> def intro_text ( self ) : <EOL> if self . enemy . is_alive ( ) : <EOL> return """<STR_LIT>""" <EOL> else : <EOL> return """<STR_LIT>""" <EOL> class SnakePitRoom ( MapTile ) : <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> def modify_player ( self , player ) : <EOL> player . hp = <NUM_LIT:0> <EOL> class LeaveCaveRoom ( MapTile ) : <EOL> def intro_text ( self ) : <EOL> return """<STR_LIT>""" <EOL> def modify_player ( self , player ) : <EOL> player . victory = True </s>
