5
5
Trajectory )
6
6
7
7
8
- @PlaygroundRegister .register ('foraging' , 'candy_collect ' )
9
- class CandyCollectEnv (SingleRoom ):
8
+ @PlaygroundRegister .register ('foraging' , 'candy_poison ' )
9
+ class CandyPoisonEnv (SingleRoom ):
10
10
def __init__ (self ):
11
11
super ().__init__ (size = (200 , 200 ))
12
12
@@ -17,6 +17,7 @@ def __init__(self):
17
17
width_length = (100 , 100 ))
18
18
self .agent_starting_area = area_start
19
19
20
+ additional_types = set ()
20
21
for loc in ["down-left" , "up-right" ]:
21
22
area_center , size_area = self .get_area ((0 , 0 ), loc )
22
23
area = CoordinateSampler (center = area_center ,
@@ -27,16 +28,20 @@ def __init__(self):
27
28
probability = 0.01 ,
28
29
limit = 2 )
29
30
self .add_scene_element (field )
31
+ additional_types .add (field .entity_produced )
30
32
31
33
field = scene_elements .Field (entity_produced = scene_elements .Poison ,
32
34
production_area = area ,
33
35
probability = 0.01 ,
34
36
limit = 2 )
35
37
self .add_scene_element (field )
38
+ additional_types .add (field .entity_produced )
36
39
37
40
self .time_limit = 2000
38
41
self .time_limit_reached_reward = - 1
39
42
43
+ self .create_entity_types_map (additional_types )
44
+
40
45
41
46
@PlaygroundRegister .register ('foraging' , 'candy_fireballs' )
42
47
class CandyFireballs (SingleRoom ):
@@ -49,6 +54,8 @@ def __init__(self, time_limit=100, probability_production=0.4):
49
54
'size_tiles' : 4
50
55
}
51
56
57
+ additional_types = set ()
58
+
52
59
# First Fireball
53
60
text_1 = {'color_min' : [220 , 0 , 200 ], 'color_max' : [255 , 100 , 220 ]}
54
61
trajectory = Trajectory ('waypoints' ,
@@ -60,6 +67,7 @@ def __init__(self, time_limit=100, probability_production=0.4):
60
67
** text_1
61
68
})
62
69
self .add_scene_element (fireball , trajectory )
70
+ additional_types .add (type (fireball ))
63
71
64
72
# Second Fireball
65
73
text_2 = {'color_min' : [180 , 0 , 0 ], 'color_max' : [220 , 100 , 0 ]}
@@ -92,5 +100,8 @@ def __init__(self, time_limit=100, probability_production=0.4):
92
100
production_area = area_prod ,
93
101
probability = probability_production )
94
102
self .add_scene_element (field )
103
+ additional_types .add (field .entity_produced )
95
104
96
105
self .time_limit = time_limit
106
+
107
+ self .create_entity_types_map (additional_types )
0 commit comments