view this code at tagslargeartistic"" import shutilsys set up the constants for line characters up_down_char chr( character is '| left_right_char chr( character is '- down_right_char chr( character is '+ down_left_char chr( character is '+ up_right_char chr( character is '+ up_left_char chr( character is '+ up_down_right_char chr( character is '+ up_down_left_char chr( character is '+ down_left_right_char chr( character is '+ up_left_right_char chr( character is '+ cross_char chr( character is '+ list of chr(codes is at get the size of the terminal window canvas_widthcanvas_height shutil get_terminal_size( we can' print to the last column on windows without it adding newline automaticallyso reduce the width by one canvas_width - leave room at the bottom few rows for the command info lines canvas_height - """the keys for canvas will be (xyinteger tuples for the coordinate and the value is set of letters wasd that tell what kind of line should be drawn "" canvas { cursorx cursory def getcanvasstring(canvasdatacxcy) """returns multiline string of the line drawn in canvasdata "" canvasstr ' """canvasdata is dictionary with (xytuple keys and values that are sets of ' '' '' 'and/or 'dstrings to show which directions the lines are drawn at each xy point "" for rownum in range(canvas_height) for columnnum in range(canvas_width) if columnnum =cx and rownum =cy canvasstr +'# continue add the line character for this point to canvasstr cell canvasdata get((columnnumrownum) if cell in (set([' '' '])set([' '])set([' '])) canvasstr +up_down_char elif cell in (set([' '' '])set([' '])set([' '])) canvasstr +left_right_char project #