Browse Source

Update for AntStar new brain

Bastien Sevajol 8 years ago
parent
commit
0a471ba173
2 changed files with 19 additions and 18 deletions
  1. 1 1
      intelligine/cst.py
  2. 18 17
      intelligine/simulation/object/brain/part/move/AntStar/ByPass.py

+ 1 - 1
intelligine/cst.py View File

32
 MOVE_BYBASS_DISTANCE = IncrementedNamedInt.get('intelligine.basebug.move.bypass.distance')
32
 MOVE_BYBASS_DISTANCE = IncrementedNamedInt.get('intelligine.basebug.move.bypass.distance')
33
 MOVE_BYBASS_MEMORY = IncrementedNamedInt.get('intelligine.basebug.move.bypass.memory')
33
 MOVE_BYBASS_MEMORY = IncrementedNamedInt.get('intelligine.basebug.move.bypass.memory')
34
 MOVE_BYBASS_WALL = IncrementedNamedInt.get('intelligine.basebug.move.bypass.wall')
34
 MOVE_BYBASS_WALL = IncrementedNamedInt.get('intelligine.basebug.move.bypass.wall')
35
-MOVE_BYBASS_RE_WALKING = IncrementedNamedInt.get('intelligine.basebug.move.bypass.re_walking')
35
+MOVE_BYBASS_PREV_WALL = IncrementedNamedInt.get('intelligine.basebug.move.bypass.prev_wall')
36
 
36
 
37
 TYPE = IncrementedNamedInt.get('intelligine.object.type')
37
 TYPE = IncrementedNamedInt.get('intelligine.object.type')
38
 TYPE_RESOURCE_EXPLOITABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')
38
 TYPE_RESOURCE_EXPLOITABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')

+ 18 - 17
intelligine/simulation/object/brain/part/move/AntStar/ByPass.py View File

1
-from antstar.GlueWallAntBrain import GlueWallAntBrain
2
-from intelligine.cst import EXPLORATION_VECTOR, MOVE_BYBASS, MOVE_BYBASS_DISTANCE, MOVE_BYBASS_MEMORY, MOVE_BYBASS_WALL, MOVE_BYBASS_RE_WALKING
1
+from antstar.StickWallAntBrain import StickWallAntBrain
2
+from intelligine.cst import EXPLORATION_VECTOR, MOVE_BYBASS, MOVE_BYBASS_DISTANCE, MOVE_BYBASS_MEMORY, MOVE_BYBASS_WALL,\
3
+    MOVE_BYBASS_PREV_WALL
3
 
4
 
4
 
5
 
5
-class ByPass(GlueWallAntBrain):
6
+class ByPass(StickWallAntBrain):
6
 
7
 
7
     def __init__(self, host, home_vector, context, object_id):
8
     def __init__(self, host, home_vector, context, object_id):
8
         """
9
         """
30
                                                               object_id,
31
                                                               object_id,
31
                                                               allow_empty=True,
32
                                                               allow_empty=True,
32
                                                               empty_value=None)
33
                                                               empty_value=None)
33
-        self._current_wall_square_position = context.metas.value.get(MOVE_BYBASS_WALL,
34
-                                                                     object_id,
35
-                                                                     allow_empty=True,
36
-                                                                     empty_value=None)
37
-        self._is_re_walking = context.metas.value.get(MOVE_BYBASS_RE_WALKING,
38
-                                                      object_id,
39
-                                                      allow_empty=True,
40
-                                                      empty_value=False)
34
+        self._current_wall_position = context.metas.value.get(MOVE_BYBASS_WALL,
35
+                                                              object_id,
36
+                                                              allow_empty=True,
37
+                                                              empty_value=None)
38
+        self._previous_wall_position = context.metas.value.get(MOVE_BYBASS_PREV_WALL,
39
+                                                               object_id,
40
+                                                               allow_empty=True,
41
+                                                               empty_value=None)
41
 
42
 
42
     def _set_home_vector(self, home_vector):
43
     def _set_home_vector(self, home_vector):
43
         super()._set_home_vector(home_vector)
44
         super()._set_home_vector(home_vector)
55
         super()._set_distance_when_blocked(distance)
56
         super()._set_distance_when_blocked(distance)
56
         self._context.metas.value.set(MOVE_BYBASS_DISTANCE, self._object_id, distance)
57
         self._context.metas.value.set(MOVE_BYBASS_DISTANCE, self._object_id, distance)
57
 
58
 
58
-    def _set_current_wall_square(self, position_of_square):
59
-        super()._set_current_wall_square(position_of_square)
60
-        self._context.metas.value.set(MOVE_BYBASS_WALL, self._object_id, position_of_square)
59
+    def _set_current_wall_position(self, position):
60
+        super()._set_current_wall_position(position)
61
+        self._context.metas.value.set(MOVE_BYBASS_WALL, self._object_id, position)
61
 
62
 
62
-    def _set_is_re_walking(self, is_re_walking):
63
-        super()._set_is_re_walking(is_re_walking)
64
-        self._context.metas.value.set(MOVE_BYBASS_RE_WALKING, self._object_id, is_re_walking)
63
+    def _set_previous_wall_position(self, position):
64
+        super()._set_previous_wall_position(position)
65
+        self._context.metas.value.set(MOVE_BYBASS_PREV_WALL, self._object_id, position)