Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBrandon Hoffman
3,642 PointsQuestions 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
231,275 PointsSteven Parker
231,275 PointsThat'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.