Python Python Collections (2016, retired 2019) Dungeon Game Cartographer

Brandon Hoffman
Brandon Hoffman
3,642 Points

Questions concerning draw_map() in the Cartographer video...

I am 75% lost on the draw_map() function and how it draws out the game map for the game. Can someone please explain to me on each important line what is happening?? Thank you for your time.

 ```  python def draw_map(player):
print(" _"*5)
tile = "|{}"

for cell in CELLS:
    x, y = cell
    if x < 4:
        line_end = ""
        if cell == player:
            output = tile.format("X")
        else:
            output = tile.format("_")
    else:
        line_end = "\n"
        if cell == player:
            output = tile.format("X|")
        else:
            output = tile.format("_|")
    print(output, end = line_end)
      ```
Steven Parker
Steven Parker
182,492 Points

That's kind of a big ask! If you don't get a response soon, you might try asking about just the line(s) that are not clear to you.