소스 검색

Remove old molecule (replaced by vector integration)

Bastien Sevajol 10 년 전
부모
커밋
e1241b6232

+ 0 - 1
intelligine/cst.py 파일 보기

40
 MOLECULES_DIRECTION = IncrementedNamedInt.get('intelligine.phero.direction')
40
 MOLECULES_DIRECTION = IncrementedNamedInt.get('intelligine.phero.direction')
41
 PHEROMON_DIR_NONE = IncrementedNamedInt.get('intelligine.phero.direction.none')
41
 PHEROMON_DIR_NONE = IncrementedNamedInt.get('intelligine.phero.direction.none')
42
 PHEROMON_DIR_EXPLO = IncrementedNamedInt.get('intelligine.phero.direction.explo')
42
 PHEROMON_DIR_EXPLO = IncrementedNamedInt.get('intelligine.phero.direction.explo')
43
-PHEROMON_DIR_HOME = IncrementedNamedInt.get('intelligine.phero.direction.home')
44
 EXPLORATION_VECTOR = IncrementedNamedInt.get('intelligine.exploration_vector')
43
 EXPLORATION_VECTOR = IncrementedNamedInt.get('intelligine.exploration_vector')
45
 
44
 
46
 #SMELL = IncrementedNamedInt.get('intelligine.smell')
45
 #SMELL = IncrementedNamedInt.get('intelligine.smell')

+ 1 - 8
intelligine/display/Pygame.py 파일 보기

2
 from intelligine.synergy.object.ant.Ant import Ant
2
 from intelligine.synergy.object.ant.Ant import Ant
3
 from synergine_xyz.display.Pygame import Pygame as XyzPygame
3
 from synergine_xyz.display.Pygame import Pygame as XyzPygame
4
 import pygame
4
 import pygame
5
-from intelligine.cst import PHEROMON_DIR_HOME, PHEROMON_DIR_EXPLO, MOLECULES, \
6
-    SMELL_EGG, SMELL_FOOD, MOLECULES_DIRECTION
5
+from intelligine.cst import PHEROMON_DIR_EXPLO, MOLECULES, SMELL_EGG, SMELL_FOOD, MOLECULES_DIRECTION
7
 from intelligine.display.pygame.visualisation import SURFACE_PHEROMONE_EXPLORATION, SURFACE_PHEROMONE_HOME, \
6
 from intelligine.display.pygame.visualisation import SURFACE_PHEROMONE_EXPLORATION, SURFACE_PHEROMONE_HOME, \
8
     SURFACE_SMELL_EGG, SURFACE_SMELL_FOOD
7
     SURFACE_SMELL_EGG, SURFACE_SMELL_FOOD
9
 
8
 
34
         for point in molecules_positions:
33
         for point in molecules_positions:
35
             point_flavour = context.molecules().get_flavour(point)
34
             point_flavour = context.molecules().get_flavour(point)
36
             try:
35
             try:
37
-                point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=PHEROMON_DIR_HOME)
38
-                self.draw_surface(point, molecule_home_surface)
39
-            except NoMolecule:
40
-                pass # No molecule here
41
-
42
-            try:
43
                 molecule = point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=PHEROMON_DIR_EXPLO)
36
                 molecule = point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=PHEROMON_DIR_EXPLO)
44
                 self.draw_surface(point, molecule_exploration_surface)
37
                 self.draw_surface(point, molecule_exploration_surface)
45
 
38
 

+ 3 - 4
intelligine/simulation/object/brain/AntBrain.py 파일 보기

1
 from intelligine.simulation.object.brain.Brain import Brain
1
 from intelligine.simulation.object.brain.Brain import Brain
2
 from intelligine.simulation.object.brain.part.attack.AttackBrainPart import AttackBrainPart
2
 from intelligine.simulation.object.brain.part.attack.AttackBrainPart import AttackBrainPart
3
 from intelligine.simulation.object.brain.part.move.AntMoveBrainPart import AntMoveBrainPart
3
 from intelligine.simulation.object.brain.part.move.AntMoveBrainPart import AntMoveBrainPart
4
-from intelligine.cst import MOVE_MODE, MOVE_MODE_EXPLO, MOVE_MODE_GOHOME, PHEROMON_DIR_HOME, PHEROMON_DIR_EXPLO, \
4
+from intelligine.cst import MOVE_MODE, MOVE_MODE_EXPLO, MOVE_MODE_GOHOME, PHEROMON_DIR_EXPLO, \
5
     BRAIN_PART_TAKE, BRAIN_PART_PUT, MOVE_MODE_NURSE, PHEROMON_DIR_NONE, BRAIN_PART_ATTACK, MOVE_MODE_HOME, SMELL_FOOD
5
     BRAIN_PART_TAKE, BRAIN_PART_PUT, MOVE_MODE_NURSE, PHEROMON_DIR_NONE, BRAIN_PART_ATTACK, MOVE_MODE_HOME, SMELL_FOOD
6
 from intelligine.cst import MOLECULE_SEARCHING
6
 from intelligine.cst import MOLECULE_SEARCHING
7
 from intelligine.cst import BRAIN_PART_MOVE
7
 from intelligine.cst import BRAIN_PART_MOVE
41
 
41
 
42
     def _update_molecule_gland(self, mode):
42
     def _update_molecule_gland(self, mode):
43
         if mode == MOVE_MODE_EXPLO:
43
         if mode == MOVE_MODE_EXPLO:
44
-            molecule_direction_type = PHEROMON_DIR_HOME
44
+            molecule_direction_type = None
45
         elif mode == MOVE_MODE_GOHOME:
45
         elif mode == MOVE_MODE_GOHOME:
46
             molecule_direction_type = PHEROMON_DIR_EXPLO
46
             molecule_direction_type = PHEROMON_DIR_EXPLO
47
             self._distance_from_objective = 0
47
             self._distance_from_objective = 0
62
         if mode == MOVE_MODE_EXPLO:
62
         if mode == MOVE_MODE_EXPLO:
63
             molecule_searching = PHEROMON_DIR_EXPLO
63
             molecule_searching = PHEROMON_DIR_EXPLO
64
         elif mode == MOVE_MODE_GOHOME:
64
         elif mode == MOVE_MODE_GOHOME:
65
-            # TODO: Plus rien ici (path integration)
66
-            molecule_searching = PHEROMON_DIR_HOME
65
+            molecule_searching = PHEROMON_DIR_NONE
67
         elif mode == MOVE_MODE_NURSE:
66
         elif mode == MOVE_MODE_NURSE:
68
             molecule_searching = PHEROMON_DIR_NONE
67
             molecule_searching = PHEROMON_DIR_NONE
69
         elif mode == MOVE_MODE_HOME:
68
         elif mode == MOVE_MODE_HOME:

+ 1 - 1
intelligine/simulation/object/brain/part/move/AntMoveBrainPart.py 파일 보기

131
             try:
131
             try:
132
                 molecule = flavour.get_molecule(category=MOLECULES_DIRECTION, type=smell_type)
132
                 molecule = flavour.get_molecule(category=MOLECULES_DIRECTION, type=smell_type)
133
                 return True
133
                 return True
134
-            except NoTypeInMolecule:
134
+            except NoMolecule:
135
                 pass  # C'est qu'elle y est pas ^^
135
                 pass  # C'est qu'elle y est pas ^^
136
         return False
136
         return False
137
 
137
 

+ 3 - 3
intelligine/tests/simulation/mode/TestChangeMode.py 파일 보기

15
 from synergine.synergy.collection.SynergyCollection import SynergyCollection
15
 from synergine.synergy.collection.SynergyCollection import SynergyCollection
16
 from synergine.synergy.collection.Configuration import Configuration
16
 from synergine.synergy.collection.Configuration import Configuration
17
 from intelligine.core.Context import Context
17
 from intelligine.core.Context import Context
18
-from intelligine.cst import MOVE_MODE_EXPLO, MOVE_MODE_GOHOME, MOVE_MODE, MOVE_MODE_HOME
19
-from intelligine.cst import PHEROMON_DIR_HOME, PHEROMON_DIR_EXPLO
18
+from intelligine.cst import MOVE_MODE_EXPLO, MOVE_MODE_GOHOME, MOVE_MODE, MOVE_MODE_HOME, PHEROMON_DIR_NONE
19
+from intelligine.cst import PHEROMON_DIR_EXPLO
20
 
20
 
21
 
21
 
22
 class TestChangeMode(Base):
22
 class TestChangeMode(Base):
129
         # Ant has put his food piece
129
         # Ant has put his food piece
130
         self.assertFalse(self.ant.is_carrying())
130
         self.assertFalse(self.ant.is_carrying())
131
         self.assertEquals(MOVE_MODE_EXPLO, self.ant.get_brain().get_movement_mode())
131
         self.assertEquals(MOVE_MODE_EXPLO, self.ant.get_brain().get_movement_mode())
132
-        self.assertEquals(PHEROMON_DIR_HOME, self.ant.get_movement_molecule_gland().get_molecule_type())
132
+        self.assertEquals(PHEROMON_DIR_NONE, self.ant.get_movement_molecule_gland().get_molecule_type())

+ 1 - 1
intelligine/tests/simulation/molecule/TestDirection.py 파일 보기

9
 from intelligine.tests.simulation.molecule.Base import Base
9
 from intelligine.tests.simulation.molecule.Base import Base
10
 from intelligine.simulation.molecule.DirectionMolecule import DirectionMolecule
10
 from intelligine.simulation.molecule.DirectionMolecule import DirectionMolecule
11
 from intelligine.core.Context import Context
11
 from intelligine.core.Context import Context
12
-from intelligine.cst import MOLECULES_DIRECTION, PHEROMON_DIR_EXPLO, PHEROMON_DIR_HOME
12
+from intelligine.cst import MOLECULES_DIRECTION, PHEROMON_DIR_EXPLO
13
 from intelligine.synergy.event.move.direction import NORTH, NORTH_EST, EST, SOUTH_EST, SOUTH, SOUTH_WEST, WEST, \
13
 from intelligine.synergy.event.move.direction import NORTH, NORTH_EST, EST, SOUTH_EST, SOUTH, SOUTH_WEST, WEST, \
14
     NORTH_WEST, CENTER
14
     NORTH_WEST, CENTER
15
 from intelligine.synergy.event.move.direction import get_position_with_direction_decal as _p
15
 from intelligine.synergy.event.move.direction import get_position_with_direction_decal as _p