import pygame H=50 W=50 GridSize=10 def getColor(obj): if obj == 'ant': return 0x0000FF return 0 def drawWorld(): for cellNdx in range(W): for rowNdx in range(H): pygame.draw.rect(screen, getColor(world[cellNdx][rowNdx]), (cellNdx*GridSize, rowNdx*GridSize, GridSize-1, GridSize-1)) pygame.display.flip() world = [] for i in range(W): world.append([None] * H) screen = pygame.display.set_mode((W*GridSize, H*GridSize)) world[5][5] = 'ant' drawWorld()