color = white if grid[row][column] == 1: color = black if grid[row][column] > 1: color = red pygame.draw.rect(screen,color,[(margin+side)*column+margin,(margin+side)*row+margin,side,side]) # draw room labels for row in range(cells): for col in range(cells): if grid[row][col] > 1: text = font.render(chr(65+grid[row][col]-2),True,black) screen.blit(text, [col*side,row*side]) # helper things for bot bx,by = bot.getLoc() flatgrid = [i for l in grid for i in l] gridpts = [(x,y) for y in range(cells) for x in range(cells)] flatgrid = zip(gridpts,flatgrid) # make array of (loc, val) tuples for all goals in grid goals = [(l,v) for (l,v) in flatgrid if v > 1] bot.setGoals(goals) # make array of bot surroundings...'lasers' in cardinal directions botRange = 4 surr = [] #consider drawing botrange? (showing horizontal, vertical, etc. 'beams') # Generate points to analyze in surroundings for i in range(botRange):