Skip to main content
Engineering LibreTexts

10.6: The “Map” Data Structure

  • Page ID
    13623
  • 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.