Apr-10-2017, 02:17 PM
Hello, I have to do a model of a disease spreading in a population. As a beginner in python, my teacher gave us most of the code. I can't understand the full code but I could get some keys, their are mobile agents that can be "infectious" or "sane". They are created by a class named 'Agent' , and put in a list called 'agents'. Their are displayed in an area of 500 of height and 800 of width.
So even if I could (harshly) make them move, I am blocked as I have to make one sane agent infected by one of its neighbour. As each change in their state is coded in the 'agent' class, I can' understand how I could change the state of a neighbour. Here are a piece of what I tried, just for a neighbour at the right. If anyone have an piece of advice, I would be very grateful !
So even if I could (harshly) make them move, I am blocked as I have to make one sane agent infected by one of its neighbour. As each change in their state is coded in the 'agent' class, I can' understand how I could change the state of a neighbour. Here are a piece of what I tried, just for a neighbour at the right. If anyone have an piece of advice, I would be very grateful !

elif self.state == 'I':# infectious for x in range(len(agents)): if agents[x]== Agent(self.x+1,self.y,'S'): agents[x].state='I'