Bläddra i källkod

Remove old molecule (replaced by vector integration)

Bastien Sevajol 9 år sedan
förälder
incheckning
e1241b6232

+ 0 - 1
intelligine/cst.py Visa fil

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

+ 1 - 8
intelligine/display/Pygame.py Visa fil

@@ -2,8 +2,7 @@ from intelligine.core.exceptions import NoMolecule
2 2
 from intelligine.synergy.object.ant.Ant import Ant
3 3
 from synergine_xyz.display.Pygame import Pygame as XyzPygame
4 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 6
 from intelligine.display.pygame.visualisation import SURFACE_PHEROMONE_EXPLORATION, SURFACE_PHEROMONE_HOME, \
8 7
     SURFACE_SMELL_EGG, SURFACE_SMELL_FOOD
9 8
 
@@ -34,12 +33,6 @@ class Pygame(XyzPygame):
34 33
         for point in molecules_positions:
35 34
             point_flavour = context.molecules().get_flavour(point)
36 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 36
                 molecule = point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=PHEROMON_DIR_EXPLO)
44 37
                 self.draw_surface(point, molecule_exploration_surface)
45 38
 

+ 3 - 4
intelligine/simulation/object/brain/AntBrain.py Visa fil

@@ -1,7 +1,7 @@
1 1
 from intelligine.simulation.object.brain.Brain import Brain
2 2
 from intelligine.simulation.object.brain.part.attack.AttackBrainPart import AttackBrainPart
3 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 5
     BRAIN_PART_TAKE, BRAIN_PART_PUT, MOVE_MODE_NURSE, PHEROMON_DIR_NONE, BRAIN_PART_ATTACK, MOVE_MODE_HOME, SMELL_FOOD
6 6
 from intelligine.cst import MOLECULE_SEARCHING
7 7
 from intelligine.cst import BRAIN_PART_MOVE
@@ -41,7 +41,7 @@ class AntBrain(Brain):
41 41
 
42 42
     def _update_molecule_gland(self, mode):
43 43
         if mode == MOVE_MODE_EXPLO:
44
-            molecule_direction_type = PHEROMON_DIR_HOME
44
+            molecule_direction_type = None
45 45
         elif mode == MOVE_MODE_GOHOME:
46 46
             molecule_direction_type = PHEROMON_DIR_EXPLO
47 47
             self._distance_from_objective = 0
@@ -62,8 +62,7 @@ class AntBrain(Brain):
62 62
         if mode == MOVE_MODE_EXPLO:
63 63
             molecule_searching = PHEROMON_DIR_EXPLO
64 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 66
         elif mode == MOVE_MODE_NURSE:
68 67
             molecule_searching = PHEROMON_DIR_NONE
69 68
         elif mode == MOVE_MODE_HOME:

+ 1 - 1
intelligine/simulation/object/brain/part/move/AntMoveBrainPart.py Visa fil

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

+ 3 - 3
intelligine/tests/simulation/mode/TestChangeMode.py Visa fil

@@ -15,8 +15,8 @@ from intelligine.tests.src.event.MoveAction import MoveAction as TestMoveAction
15 15
 from synergine.synergy.collection.SynergyCollection import SynergyCollection
16 16
 from synergine.synergy.collection.Configuration import Configuration
17 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 22
 class TestChangeMode(Base):
@@ -129,4 +129,4 @@ class TestChangeMode(Base):
129 129
         # Ant has put his food piece
130 130
         self.assertFalse(self.ant.is_carrying())
131 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 Visa fil

@@ -9,7 +9,7 @@ ppath.insert(1,getcwd()+'/modules')
9 9
 from intelligine.tests.simulation.molecule.Base import Base
10 10
 from intelligine.simulation.molecule.DirectionMolecule import DirectionMolecule
11 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 13
 from intelligine.synergy.event.move.direction import NORTH, NORTH_EST, EST, SOUTH_EST, SOUTH, SOUTH_WEST, WEST, \
14 14
     NORTH_WEST, CENTER
15 15
 from intelligine.synergy.event.move.direction import get_position_with_direction_decal as _p