Opening the book…
The map data structure is simply a 2D list of lists where the two indexes used represent the X and Y coordinates of the map. The value at each index in the list of lists is a single-character string that represents the title that is on that map at each space:
'#'– A wooden wall.'x'– A corner wall.'@'– The starting space for the player on this level.'.'– A goal space.'$'– A space where a star is at the start of the level.'+'– A space with a goal and the starting player’s space.'*'– A space with a goal and a star at the start of the level.' '– A grassy outdoor space.'o'– An inside floor space. (This is a lowercase letter O, not a zero.)'1'– A rock on grass.'2'– A short tree on grass.'3'– A tall tree on grass.'4'– An ugly tree on grass.
This page titled 10.6: The “Map” Data Structure was last modified on Mon, 11 Nov 2019 01:40:38 GMT and is shared under a CC BY-NC-SA 3.0 license and was authored, remixed, and/or curated by Al Sweigart via source content that was edited to the style and standards of the LibreTexts platform.
The book could not be loaded just now.