diff --git a/philosopher_example/controleurPhilosophersExample.py b/philosopher_example/controleurPhilosophersExample.py index 46757e8d75bf2403ef82a1b8abd70cfdb9293f14..c1be8552430e042ed995b9e1af19af8a0f3af30e 100644 --- a/philosopher_example/controleurPhilosophersExample.py +++ b/philosopher_example/controleurPhilosophersExample.py @@ -11,8 +11,11 @@ class ControleurPhilosophersExample(Controleur): self.__numberPhilosopher = 10 self.__barChart = [] self.__barChart.append(self.addBarChart('Eaten Pastas')) - self.__barChart.append(self.addBarChart('Hours of tkinking')) + self.__barChart.append(self.addPlotChart('Hours of tkinking')) + self.setPolicy(self.__barChart[1],0,"ro") + self.__barChart.append(self.addPlotChart('Hours of hunger')) + self.addCurve(self.__barChart[2],'g+-') def initialisation(self): @@ -53,10 +56,9 @@ class ControleurPhilosophersExample(Controleur): nom = 'Mr ' + str(i) self.addColumn(self.__barChart[0],nom) - self.addColumn(self.__barChart[1],nom) - self.addPoint(self.__barChart[2],0,x,y) - self.addCurve(self.__barChart[2],'go') - self.addPoint(self.__barChart[2],1,x-10,y-10) + self.addPoint(self.__barChart[1],0,x-10,y-10) + self.addPoint(self.__barChart[2],0,i*50,y) + self.addPoint(self.__barChart[2],1,i*50,y-50) def updateCycle(self, env, amas): agents = amas.get_Agents_Sorted() @@ -69,11 +71,9 @@ class ControleurPhilosophersExample(Controleur): elif state == State.HUNGRY: self.change_color(self.__philosophers[i], 'red') - self.increaseValue(self.__barChart[2],i, 1) else: self.change_color(self.__philosophers[i], 'blue') - self.increaseValue(self.__barChart[1],i, 1) coords = self.get_coords_element(self.__philosophers[i]) if agents[i].get_Left_Fork().owned(agents[i]):