|
@@ -2,8 +2,9 @@ from xyworld.display.object.pygame.PygameImage import PygameImage
|
2
|
2
|
from xyworld.display.object.pygame.DirectionnedImage import DirectionnedImage
|
3
|
3
|
from intelligine.synergy.object.Bug import Bug
|
4
|
4
|
from intelligine.synergy.object.ant.Ant import Ant
|
5
|
|
-from intelligine.sandbox.redblue.BlueAnt import BlueAnt
|
6
|
|
-from intelligine.sandbox.redblue.RedAnt import RedAnt
|
|
5
|
+from intelligine.sandbox.colored.BlueAnt import BlueAnt
|
|
6
|
+from intelligine.sandbox.colored.RedAnt import RedAnt
|
|
7
|
+from intelligine.sandbox.colored.GreenAnt import GreenAnt
|
7
|
8
|
from intelligine.synergy.object.Rock import Rock
|
8
|
9
|
from os import getcwd
|
9
|
10
|
from synergine.metas import metas
|
|
@@ -14,8 +15,10 @@ from intelligine.cst import PREVIOUS_DIRECTION
|
14
|
15
|
ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/ant.png')
|
15
|
16
|
dead_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_ant.png')
|
16
|
17
|
red_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/red_ant.png')
|
|
18
|
+green_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/green_ant.png')
|
17
|
19
|
blue_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/blue_ant.png')
|
18
|
20
|
dead_red_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_red_ant.png')
|
|
21
|
+dead_green_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_green_ant.png')
|
19
|
22
|
dead_blue_ant = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/dead_blue_ant.png')
|
20
|
23
|
bug = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/ant.png')
|
21
|
24
|
rock = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/rock.png')
|
|
@@ -23,6 +26,7 @@ rock = PygameImage.from_filepath(getcwd()+'/intelligine/display/pygame/image/roc
|
23
|
26
|
directions_ant = DirectionnedImage(ant)
|
24
|
27
|
directions_red_ant = DirectionnedImage(red_ant)
|
25
|
28
|
directions_blue_ant = DirectionnedImage(blue_ant)
|
|
29
|
+directions_green_ant = DirectionnedImage(green_ant)
|
26
|
30
|
|
27
|
31
|
def bug_direction(bug):
|
28
|
32
|
if bug.get_life_points() <= 0:
|
|
@@ -51,6 +55,15 @@ def blue_ant_direction(bug):
|
51
|
55
|
previous_direction = 14
|
52
|
56
|
return directions_blue_ant.get_for_direction(previous_direction)
|
53
|
57
|
|
|
58
|
+def green_ant_direction(bug):
|
|
59
|
+ if bug.get_life_points() <= 0:
|
|
60
|
+ return dead_green_ant
|
|
61
|
+ try:
|
|
62
|
+ previous_direction = metas.value.get(PREVIOUS_DIRECTION, bug.get_id())
|
|
63
|
+ except KeyError:
|
|
64
|
+ previous_direction = 14
|
|
65
|
+ return directions_green_ant.get_for_direction(previous_direction)
|
|
66
|
+
|
54
|
67
|
visualisation = {
|
55
|
68
|
'window': {},
|
56
|
69
|
'objects': {
|
|
@@ -62,6 +75,10 @@ visualisation = {
|
62
|
75
|
'default': blue_ant,
|
63
|
76
|
'callbacks': [blue_ant_direction]
|
64
|
77
|
},
|
|
78
|
+ GreenAnt: {
|
|
79
|
+ 'default': green_ant,
|
|
80
|
+ 'callbacks': [green_ant_direction]
|
|
81
|
+ },
|
65
|
82
|
Ant: {
|
66
|
83
|
'default': ant,
|
67
|
84
|
'callbacks': [bug_direction]
|