|
@@ -1,3 +1,4 @@
|
|
1
|
+from intelligine.shorcut.brain import get_brain_class
|
1
|
2
|
from intelligine.simulation.object.brain.part.move.AntStar.ByPass import ByPass
|
2
|
3
|
from intelligine.simulation.object.brain.part.move.AntStar.Host import Host
|
3
|
4
|
from intelligine.simulation.object.brain.part.move.MoveBrainPart import MoveBrainPart
|
|
@@ -5,7 +6,7 @@ from intelligine.synergy.event.move.direction import directions_modifiers, get_p
|
5
|
6
|
from synergine_xyz.cst import POSITION
|
6
|
7
|
from intelligine.core.exceptions import NoMolecule
|
7
|
8
|
from intelligine.cst import MOLECULE_SEARCHING, MOVE_MODE_EXPLO, MOVE_MODE_HOME, MOVE_MODE, MOVE_MODE_GOHOME, \
|
8
|
|
- EXPLORATION_VECTOR, MOLECULES_DIRECTION, SMELL_FOOD, SMELL_EGG
|
|
9
|
+ EXPLORATION_VECTOR, MOLECULES_DIRECTION, SMELL_FOOD, SMELL_EGG, BRAIN_SCHEMA, BRAIN
|
9
|
10
|
from intelligine.simulation.molecule.DirectionMolecule import DirectionMolecule
|
10
|
11
|
|
11
|
12
|
|
|
@@ -123,17 +124,19 @@ class AntMoveBrainPart(MoveBrainPart):
|
123
|
124
|
def _on_home_smell(cls, context, object_id):
|
124
|
125
|
current_position = context.metas.value.get(POSITION, object_id)
|
125
|
126
|
flavour = context.molecules().get_flavour(current_position)
|
126
|
|
- # TODO: Idem, liste de smell_type ...
|
127
|
|
- for smell_type in (SMELL_FOOD, SMELL_EGG):
|
128
|
|
- try:
|
129
|
|
- molecule = flavour.get_molecule(category=MOLECULES_DIRECTION, type=smell_type)
|
|
127
|
+ molecules = flavour.get_molecules(MOLECULES_DIRECTION)
|
|
128
|
+
|
|
129
|
+ if not molecules:
|
|
130
|
+ return False
|
|
131
|
+
|
|
132
|
+ brain_class = get_brain_class(context, object_id)
|
|
133
|
+ for smell_type in brain_class.get_home_smells():
|
|
134
|
+ if smell_type in molecules:
|
130
|
135
|
return True
|
131
|
|
- except NoMolecule:
|
132
|
|
- pass # C'est qu'elle y est pas ^^
|
|
136
|
+
|
133
|
137
|
return False
|
134
|
138
|
|
135
|
139
|
def _update_exploration_vector(self):
|
136
|
|
- # TODO: add tuple as vectors ?
|
137
|
140
|
just_move_vector = directions_modifiers[self._host_brain.get_host().get_previous_direction()]
|
138
|
141
|
self._set_exploration_vector((self._exploration_vector[0] + just_move_vector[1],
|
139
|
142
|
self._exploration_vector[1] + just_move_vector[2]))
|