Browse Source

rename arround in around

Bastien Sevajol 9 years ago
parent
commit
3bf41994aa

+ 2 - 2
TODO View File

4
    * Changement de mode (explo;go home)
4
    * Changement de mode (explo;go home)
5
  * Pheromones: Mettre en place un systeme objet qui permet de donner aux Obj leur comportement pheromone. Au lieu de le deduire a la mano (aujourd'hui un MoveAction le fait pour tous, or cela doit dependre de l'obj)
5
  * Pheromones: Mettre en place un systeme objet qui permet de donner aux Obj leur comportement pheromone. Au lieu de le deduire a la mano (aujourd'hui un MoveAction le fait pour tous, or cela doit dependre de l'obj)
6
  * Nettoyer le code des pheromones: Refactoriser
6
  * Nettoyer le code des pheromones: Refactoriser
7
- * Mechanisme qui donne les pheromones arround
7
+ * Mechanisme qui donne les pheromones around
8
  * Mettre au propre la logique qui dit que l'objet peut etre pose (meme type si larve; zone de depot si Food, etc)
8
  * Mettre au propre la logique qui dit que l'objet peut etre pose (meme type si larve; zone de depot si Food, etc)
9
  * Appliquer la disparition des pheromones
9
  * Appliquer la disparition des pheromones
10
 
10
 
11
 
11
 
12
 Future:
12
 Future:
13
  * Chambres
13
  * Chambres
14
-
14
+ *
15
 
15
 
16
 Warning:
16
 Warning:
17
  * Lorsque une f trp un objet, le PutableEvent observe chaque tours. C parce que la fourmis rentre dans la COL
17
  * Lorsque une f trp un objet, le PutableEvent observe chaque tours. C parce que la fourmis rentre dans la COL

+ 1 - 1
intelligine/simulation/object/brain/part/AntMoveBrainPart.py View File

33
 
33
 
34
     @staticmethod
34
     @staticmethod
35
     def _get_direction_of_pheromone(context, point, pheromone_type):
35
     def _get_direction_of_pheromone(context, point, pheromone_type):
36
-        search_pheromone_in_points = context.get_arround_points_of(point, distance=1)
36
+        search_pheromone_in_points = context.get_around_points_of(point, distance=1)
37
         try:
37
         try:
38
             best_pheromone_direction = DirectionPheromone.get_best_pheromone_direction_in(context,
38
             best_pheromone_direction = DirectionPheromone.get_best_pheromone_direction_in(context,
39
                                                                                           point,
39
                                                                                           point,

+ 25 - 25
intelligine/simulation/pheromone/DirectionPheromone.py View File

26
 
26
 
27
         point_intensity = pheromone_info[1]
27
         point_intensity = pheromone_info[1]
28
         point_distance = pheromone_info[0]
28
         point_distance = pheromone_info[0]
29
-        arround_points = context.get_arround_points_of(point)
29
+        around_points = context.get_around_points_of(point)
30
 
30
 
31
-        arround_pheromones_points = []
32
-        for arround_point in arround_points:
33
-            arround_pheromone_info = context.pheromones().get_info(arround_point,
31
+        around_pheromones_points = []
32
+        for around_point in around_points:
33
+            around_pheromone_info = context.pheromones().get_info(around_point,
34
                                                                    [PHEROMON_DIRECTION, pheromone_type],
34
                                                                    [PHEROMON_DIRECTION, pheromone_type],
35
                                                                    allow_empty=True,
35
                                                                    allow_empty=True,
36
                                                                    empty_value={})
36
                                                                    empty_value={})
37
-            if arround_pheromone_info and arround_pheromone_info[0] < point_distance:
38
-                arround_pheromones_points.append((arround_point, arround_pheromone_info))
37
+            if around_pheromone_info and around_pheromone_info[0] < point_distance:
38
+                around_pheromones_points.append((around_point, around_pheromone_info))
39
 
39
 
40
-        if not arround_pheromones_points:
40
+        if not around_pheromones_points:
41
             raise NoPheromone()
41
             raise NoPheromone()
42
 
42
 
43
-        shuffle(arround_pheromones_points)
44
-        arround_pheromones_sorted = sorted(arround_pheromones_points, key=lambda x: x[1][1], reverse=True)
45
-        max_intensity = arround_pheromones_sorted[0][1][1]
43
+        shuffle(around_pheromones_points)
44
+        around_pheromones_sorted = sorted(around_pheromones_points, key=lambda x: x[1][1], reverse=True)
45
+        max_intensity = around_pheromones_sorted[0][1][1]
46
 
46
 
47
-        arround_pheromones_max = []
48
-        for arround_pheromone_sorted in arround_pheromones_sorted:
49
-            if arround_pheromone_sorted[1][1] == max_intensity:
50
-                arround_pheromones_max.append(arround_pheromone_sorted)
47
+        around_pheromones_max = []
48
+        for around_pheromone_sorted in around_pheromones_sorted:
49
+            if around_pheromone_sorted[1][1] == max_intensity:
50
+                around_pheromones_max.append(around_pheromone_sorted)
51
 
51
 
52
-        arround_pheromones_sorted_by_distance = sorted(arround_pheromones_max, key=lambda x: x[1][0], reverse=False)
52
+        around_pheromones_sorted_by_distance = sorted(around_pheromones_max, key=lambda x: x[1][0], reverse=False)
53
 
53
 
54
-        go_to_point = arround_pheromones_sorted_by_distance[0][0]
54
+        go_to_point = around_pheromones_sorted_by_distance[0][0]
55
 
55
 
56
         direction_degrees = get_degree_from_north(point, go_to_point)
56
         direction_degrees = get_degree_from_north(point, go_to_point)
57
         direction = get_direction_for_degrees(direction_degrees)
57
         direction = get_direction_for_degrees(direction_degrees)
74
 
74
 
75
     @staticmethod
75
     @staticmethod
76
     def get_best_pheromone_direction_in(context, reference_point, points, pheromone_type):
76
     def get_best_pheromone_direction_in(context, reference_point, points, pheromone_type):
77
-        arround_pheromones_points = []
78
-        for arround_point in points:
79
-            arround_pheromone_info = context.pheromones().get_info(arround_point,
77
+        around_pheromones_points = []
78
+        for around_point in points:
79
+            around_pheromone_info = context.pheromones().get_info(around_point,
80
                                                                    [PHEROMON_DIRECTION, pheromone_type],
80
                                                                    [PHEROMON_DIRECTION, pheromone_type],
81
                                                                    allow_empty=True,
81
                                                                    allow_empty=True,
82
                                                                    empty_value={})
82
                                                                    empty_value={})
83
-            if arround_pheromone_info:
84
-                arround_pheromones_points.append((arround_point, arround_pheromone_info))
83
+            if around_pheromone_info:
84
+                around_pheromones_points.append((around_point, around_pheromone_info))
85
 
85
 
86
-        if not arround_pheromones_points:
86
+        if not around_pheromones_points:
87
             raise NoPheromone()
87
             raise NoPheromone()
88
 
88
 
89
-        shuffle(arround_pheromones_points)
90
-        arround_pheromones_sorted = sorted(arround_pheromones_points, key=lambda x: x[1][1], reverse=True)
91
-        go_to_point = arround_pheromones_sorted[0][0]
89
+        shuffle(around_pheromones_points)
90
+        around_pheromones_sorted = sorted(around_pheromones_points, key=lambda x: x[1][1], reverse=True)
91
+        go_to_point = around_pheromones_sorted[0][0]
92
 
92
 
93
         direction_degrees = get_degree_from_north(reference_point, go_to_point)
93
         direction_degrees = get_degree_from_north(reference_point, go_to_point)
94
         direction = get_direction_for_degrees(direction_degrees)
94
         direction = get_direction_for_degrees(direction_degrees)

+ 6 - 6
intelligine/synergy/event/transport/PutableAction.py View File

31
         obj_transportable_pos = obj_transportable.get_position()
31
         obj_transportable_pos = obj_transportable.get_position()
32
         if self._is_available_position(context, obj_transportable_pos):
32
         if self._is_available_position(context, obj_transportable_pos):
33
             return obj_transportable_pos
33
             return obj_transportable_pos
34
-        poss_arround_target = context.get_arround_points_of_point(obj_transportable_pos)
35
-        poss_arround_obj = context.get_arround_points_of_point(obj.get_position())
34
+        poss_around_target = context.get_around_points_of_point(obj_transportable_pos)
35
+        poss_around_obj = context.get_around_points_of_point(obj.get_position())
36
         # For each position between target and current transporter
36
         # For each position between target and current transporter
37
-        for pos_arround_target in poss_arround_target:
38
-            if pos_arround_target in poss_arround_obj:
39
-                if self._is_available_position(context, pos_arround_target):
40
-                    return pos_arround_target
37
+        for pos_around_target in poss_around_target:
38
+            if pos_around_target in poss_around_obj:
39
+                if self._is_available_position(context, pos_around_target):
40
+                    return pos_around_target
41
         raise ActionAborted()
41
         raise ActionAborted()
42
 
42
 
43
     def _is_available_position(self, context, position):
43
     def _is_available_position(self, context, position):

+ 1 - 1
intelligine/tests/simulation/pheromone/TestDirection.py View File

53
         :return:
53
         :return:
54
         """
54
         """
55
         self._set_up_pheromones(pheromones, re_init=re_init)
55
         self._set_up_pheromones(pheromones, re_init=re_init)
56
-        around_points = self._context.get_arround_points_of(reference_point)
56
+        around_points = self._context.get_around_points_of(reference_point)
57
         direction_tested = DirectionPheromone.get_best_pheromone_direction_in(self._context,
57
         direction_tested = DirectionPheromone.get_best_pheromone_direction_in(self._context,
58
                                                                               reference_point,
58
                                                                               reference_point,
59
                                                                               around_points,
59
                                                                               around_points,