def moveAgentOn(self, agent, x, y): prev_x = agent.x prev_y = agent.y self.matrix[y,x] = agent self.matrix[prev_y, prev_x] = None action = agent.moveOn(x,y) return action
def addAgent(self, agent, x, y): if not self.hasAgentOn(x, y): self.matrix[y,x] = agent agent.moveOn(x, y) return True return False