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

Fix conflict

parent 566d6e38
Branches
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ToOverrideWarning.enable_warning(False) ...@@ -32,6 +32,7 @@ ToOverrideWarning.enable_warning(False)
fenetre = Fenetre("Prototype Ants") fenetre = Fenetre("Prototype Ants")
"""
env = WorldExample(0, fenetre.get_canvas_width(), 0, fenetre.get_canvas_height(), 5, 7) env = WorldExample(0, fenetre.get_canvas_width(), 0, fenetre.get_canvas_height(), 5, 7)
# amas = AntHillExample(env, ExecutionPolicy.ONE_PHASE) # amas = AntHillExample(env, ExecutionPolicy.ONE_PHASE)
amas = AntHillExample(env, ExecutionPolicy.TWO_PHASES) amas = AntHillExample(env, ExecutionPolicy.TWO_PHASES)
...@@ -39,7 +40,6 @@ amas = AntHillExample(env, ExecutionPolicy.TWO_PHASES) ...@@ -39,7 +40,6 @@ amas = AntHillExample(env, ExecutionPolicy.TWO_PHASES)
scheduler = SimpleScheduler(amas) scheduler = SimpleScheduler(amas)
""" """
scheduler = SimpleScheduler.load() scheduler = SimpleScheduler.load()
"""
controleur = ControleurAntsExample(fenetre, scheduler) controleur = ControleurAntsExample(fenetre, scheduler)
def main(): def main():
......
...@@ -21,6 +21,9 @@ class ControleurAntsExample(Controleur): ...@@ -21,6 +21,9 @@ class ControleurAntsExample(Controleur):
def __init__(self, fenetre, amas): def __init__(self, fenetre, amas):
super().__init__(fenetre, amas) super().__init__(fenetre, amas)
self.__ants = [] self.__ants = []
self.__chart = []
self.__chart.append(self.addPlotChart('Ants Position'))
def add_ant(self, ant): def add_ant(self, ant):
ant_ihm = AntIHM(ant.get_id(), ant.get_color()) ant_ihm = AntIHM(ant.get_id(), ant.get_color())
...@@ -28,6 +31,11 @@ class ControleurAntsExample(Controleur): ...@@ -28,6 +31,11 @@ class ControleurAntsExample(Controleur):
self.__ants.append(ant_ihm) self.__ants.append(ant_ihm)
def initialisation(self): def initialisation(self):
self.setTitle(self.__chart[0], 'Ants Position')
self.setXLabel(self.__chart[0], 'x')
self.setYLabel(self.__chart[0], 'y')
self.setPolicy(self.__chart[0], 0, 'go')
for ant in self.get_amas().get_agents(): for ant in self.get_amas().get_agents():
self.add_ant(ant) self.add_ant(ant)
...@@ -37,6 +45,7 @@ class ControleurAntsExample(Controleur): ...@@ -37,6 +45,7 @@ class ControleurAntsExample(Controleur):
# update ant # update ant
for ant in self.get_amas().get_agents(): for ant in self.get_amas().get_agents():
seen = False seen = False
self.addPoint(self.__chart[0], 0, ant.get_dx(), ant.get_dy())
for ant_ihm in self.__ants: for ant_ihm in self.__ants:
if ant.get_id() == ant_ihm.agent_id: if ant.get_id() == ant_ihm.agent_id:
seen = True seen = True
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment