Skip to content
Snippets Groups Projects
Commit 7bec58fb authored by shinedday's avatar shinedday
Browse files

Merge branch 'master' of https://gitlab.com/be-pyamak/example

parents 9ebd7c5b c9bab5c4
No related branches found
No related tags found
No related merge requests found
...@@ -8,6 +8,8 @@ class ControleurPhilosophersExample(Controleur): ...@@ -8,6 +8,8 @@ class ControleurPhilosophersExample(Controleur):
def __init__(self, fenetre, amas): def __init__(self, fenetre, amas):
super().__init__(fenetre, amas) super().__init__(fenetre, amas)
self.__philosophers = [] self.__philosophers = []
self.__left = []
self.__right = []
self.__numberPhilosopher = 10 self.__numberPhilosopher = 10
self.__barChart = [] self.__barChart = []
self.__barChart.append(self.addBarChart('Eaten Pastas')) self.__barChart.append(self.addBarChart('Eaten Pastas'))
...@@ -49,9 +51,12 @@ class ControleurPhilosophersExample(Controleur): ...@@ -49,9 +51,12 @@ class ControleurPhilosophersExample(Controleur):
y = 100 * sin(2 * pi * i / self.__numberPhilosopher) + (heightCanvas / 2) y = 100 * sin(2 * pi * i / self.__numberPhilosopher) + (heightCanvas / 2)
carre = self.draw_rectangle(x, y, 20, 20, 'green') carre = self.draw_rectangle(x, y, 20, 20, 'green')
self.draw_rectangle(x - 15, y, 20, 7, 'black') left = self.draw_rectangle(x - 15, y, 20, 7, 'black')
right = self.draw_rectangle(x + 15, y, 20, 7, 'white')
self.__philosophers.append(carre) self.__philosophers.append(carre)
self.__left.append(left)
self.__right.append(right)
nom = 'Mr ' + str(i) nom = 'Mr ' + str(i)
...@@ -77,11 +82,11 @@ class ControleurPhilosophersExample(Controleur): ...@@ -77,11 +82,11 @@ class ControleurPhilosophersExample(Controleur):
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]):
self.draw_rectangle(coords[0] - 15, coords[1], 20, 7, 'black') self.change_color(self.__left[i],'black')
else: else:
self.draw_rectangle(coords[0] - 15, coords[1], 20, 7, 'white') self.change_color(self.__left[i],'white')
if agents[i].get_Right_Fork().owned(agents[i]): if agents[i].get_Right_Fork().owned(agents[i]):
self.draw_rectangle(coords[0] + 15, coords[1], 20, 7, 'black') self.change_color(self.__right[i],'black')
else: else:
self.draw_rectangle(coords[0] + 15, coords[1], 20, 7, 'white') self.change_color(self.__right[i],'white')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment