Skip to content
Snippets Groups Projects
Commit 66a59a1d authored by Jdrezen's avatar Jdrezen
Browse files

Ajout d'un autre plot chart pour montrer les possibilités

parent f557b3d8
Branches add_plot
No related tags found
No related merge requests found
...@@ -11,8 +11,11 @@ class ControleurPhilosophersExample(Controleur): ...@@ -11,8 +11,11 @@ class ControleurPhilosophersExample(Controleur):
self.__numberPhilosopher = 10 self.__numberPhilosopher = 10
self.__barChart = [] self.__barChart = []
self.__barChart.append(self.addBarChart('Eaten Pastas')) 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.__barChart.append(self.addPlotChart('Hours of hunger'))
self.addCurve(self.__barChart[2],'g+-')
def initialisation(self): def initialisation(self):
...@@ -53,10 +56,9 @@ class ControleurPhilosophersExample(Controleur): ...@@ -53,10 +56,9 @@ class ControleurPhilosophersExample(Controleur):
nom = 'Mr ' + str(i) nom = 'Mr ' + str(i)
self.addColumn(self.__barChart[0],nom) self.addColumn(self.__barChart[0],nom)
self.addColumn(self.__barChart[1],nom) self.addPoint(self.__barChart[1],0,x-10,y-10)
self.addPoint(self.__barChart[2],0,x,y) self.addPoint(self.__barChart[2],0,i*50,y)
self.addCurve(self.__barChart[2],'go') self.addPoint(self.__barChart[2],1,i*50,y-50)
self.addPoint(self.__barChart[2],1,x-10,y-10)
def updateCycle(self, env, amas): def updateCycle(self, env, amas):
agents = amas.get_Agents_Sorted() agents = amas.get_Agents_Sorted()
...@@ -69,11 +71,9 @@ class ControleurPhilosophersExample(Controleur): ...@@ -69,11 +71,9 @@ class ControleurPhilosophersExample(Controleur):
elif state == State.HUNGRY: elif state == State.HUNGRY:
self.change_color(self.__philosophers[i], 'red') self.change_color(self.__philosophers[i], 'red')
self.increaseValue(self.__barChart[2],i, 1)
else: else:
self.change_color(self.__philosophers[i], 'blue') self.change_color(self.__philosophers[i], 'blue')
self.increaseValue(self.__barChart[1],i, 1)
coords = self.get_coords_element(self.__philosophers[i]) coords = self.get_coords_element(self.__philosophers[i])
if agents[i].get_Left_Fork().owned(agents[i]): if agents[i].get_Left_Fork().owned(agents[i]):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment