Checking if a location has an x coordinate or y coordinate of a number

so how would you ask your algo to check
if location has x coordinate less than 5:

All locations are just lists, which look like this: [ _ , _ ] where the dashes have values. To get an element from a list you simple use the index for that list (starting from zero). So to get the first element of a list testList I would call testList[0]. Thus, you can do the same for your game_map. Here would be the code to print out all points with x < 5.

for location in self.game_state.game_map:
	if location[0] < 5:
		gamelib.debug_write(location)

Or alternatively:

for location in self.game_state.game_map:
	x,y = location
	if x < 5:
		gamelib.debug_write(location)
2 Likes