Hi there, So I am running over some coding ideas in my head for creating a map for a game.
This map would expand based on how far the user explores. I figure there are two ways to do this: 1: the list method: map=[] for x in range(3): temp=[] for y in range(3): temp.append(default_grid_format) map.append(temp) then when ever the user explores a square not on the current map, it would do this: for x in range(len(map)): map[x].append(default_grid_format) temp=[] for x in range(len(map[0])): temp.append(default_grid_format) map.append(temp) Obviously, though, this creates a lot of data for squares that are still ultimately unexplored. So here was my other idea: 2. the dictionary method: map={} for x in range(3): for y in range(3): key=str(x)+":"+str(y) map[key]=default_grid_format Then when user explores new square do: key=str(player_x)+":"+str(player_y) map[key]=default_grid_format Is this an efficient method compared to 1? Is it, code wise, sound logic? I guess I'm just looking for a second opinion from experienced peoples. thanks everyone. Nathan _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor