import pygame import random import core.view from model import SAgent class A1Sprite(core.view.AgentSprite): def draw(self): self.image.fill((0, 255, 128)) pygame.draw.circle(self.image, (random.randint(0, 255), random.randint(0, 100), 255), (5*self.zoom, 5*self.zoom), 4*self.zoom, 0) class A2Sprite(core.view.AgentSprite): def draw(self): self.image.fill((255, random.randint(0, 100), random.randint(0, 100))) class SchellingView(core.view.SDLView): def show_agent(self, agent): if agent.type == "A": A1Sprite(agent, self.agent_sprites, self.zoom) elif agent.type == "B": A2Sprite(agent, self.agent_sprites, self.zoom) def render(self): self.update_agents() core.view.SDLView.render(self)