def pastewalldict(srcwalldictdstwalldictlefttop) """copy the wall representation dictionary in srcwalldict on top of the one in dstwalldictoffset to the position given by lefttop "" dstwalldict copy copy(dstwalldict for in range(srcwalldict['width']) for in range(srcwalldict['height']) dstwalldict[( lefty top)srcwalldict[(xy) return dstwalldict def makewalldict(mazeplayerxplayeryplayerdirectionexitxexity) """from the player' position and direction in the maze (which has an exit at exitxexity)create the wall representation dictionary by pasting wall dictionaries on top of all_openthen return it "" the - "sections(which are relative to the player' direction determine which walls in the maze we check to see if we need to paste them over the wall representation dictionary we're creating if playerdirection =north map of the sectionsrelative to the player @bcd (player facing north @ offsets ((' ' - )(' '- - )(' ' - ) (' ' - )(' '- )(' ' ) if playerdirection =south map of the sectionsrelative @ to the player @dcb (player facing south offsets ((' ' )(' ' )(' ' ) (' '- )(' ' )(' '- ) if playerdirection =east map of the sectionsrelative eb to the player @@ca (player facing east fd offsets ((' ' )(' ' - )(' ' ) (' ' )(' ' - )(' ' ) if playerdirection =west map of the sectionsrelative df to the player @ac(player facing west be offsets ((' '- )(' '- )(' '- ) (' '- - )(' ' )(' ' - ) section { for secxoffyoff in offsets section[secmaze get((playerx xoffplayery yoff)wall if (playerx xoffplayery yoff=(exitxexity) section[secexit walldict copy copy(all_open paste_closed_to {' '( )' '( )' '( ) ' '( )' '( )' '( ) project #