mettagrid 0.1.4__py3-none-any.whl → 0.1.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mettagrid might be problematic. Click here for more details.

@@ -40,5 +40,7 @@ cdef class Swap(MettaActionHandler):
40
40
  if not target.swappable():
41
41
  return False
42
42
 
43
+ actor.stats.incr(b"swap", self._stats.target[target._type_id])
44
+
43
45
  self.env._grid.swap_objects(actor.id, target.id)
44
46
  return True
mettagrid/grid.hpp CHANGED
@@ -80,20 +80,23 @@ class Grid {
80
80
 
81
81
  inline void swap_objects(GridObjectId id1, GridObjectId id2) {
82
82
  GridObject* obj1 = objects[id1];
83
- GridObject* obj2 = objects[id2];
84
83
  GridLocation loc1 = obj1->location;
84
+ Layer layer1 = loc1.layer;
85
+ grid[loc1.r][loc1.c][loc1.layer] = 0;
86
+
87
+ GridObject* obj2 = objects[id2];
85
88
  GridLocation loc2 = obj2->location;
86
- Layer layer1 = obj1->location.layer;
87
- Layer layer2 = obj2->location.layer;
89
+ Layer layer2 = loc2.layer;
90
+ grid[loc2.r][loc2.c][loc2.layer] = 0;
88
91
 
92
+ // Keep the layer the same
89
93
  obj1->location = loc2;
94
+ obj1->location.layer = layer1;
90
95
  obj2->location = loc1;
91
- // Keep the layer the same
92
- obj1->location.layer = layer2;
93
- obj2->location.layer = layer1;
96
+ obj2->location.layer = layer2;
94
97
 
95
- grid[loc1.r][loc1.c][loc1.layer] = id2;
96
- grid[loc2.r][loc2.c][loc2.layer] = id1;
98
+ grid[obj1->location.r][obj1->location.c][obj1->location.layer] = id1;
99
+ grid[obj2->location.r][obj2->location.c][obj2->location.layer] = id2;
97
100
  }
98
101
 
99
102
  inline GridObject* object(GridObjectId obj_id) {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mettagrid
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: A fast grid-based open-ended MARL environment
5
5
  Home-page: https://daveey.github.io
6
6
  License: MIT
@@ -182,7 +182,7 @@ mettagrid/actions/rotate.pyx,sha256=nadrMuSdkzi4BsSXTum3uwX_uJ9jpeifnI4bQSDR26c,
182
182
  mettagrid/actions/shield.cpython-311-darwin.so,sha256=nvbYYpK-TW0O98b_ihd98z9aJtTpG1rd7_xUS7SHcUo,216640
183
183
  mettagrid/actions/swap.cpython-311-darwin.so,sha256=HuBd7XRQ787jaA7yhb6TNE9tOJaFCan5VHsUEqzteBU,185288
184
184
  mettagrid/actions/swap.pxd,sha256=mS-fT6rY9ug0c5lXkWeaLOkX9la0ZHSr3ffGz-aZBDY,105
185
- mettagrid/actions/swap.pyx,sha256=SXgn5mCUFBt4P3BOe61bSBn4zdBRHxBGc6ePekpWQnM,1429
185
+ mettagrid/actions/swap.pyx,sha256=IE3uZHgFTid0mq4t5_2so-xmc0QSZcuf3cfgOHCH0pU,1501
186
186
  mettagrid/actions/use.cpython-311-darwin.so,sha256=jrGpfVPqU-LROL6a-6-C7_94B_ADYCcrgEneXFpbZ10,186760
187
187
  mettagrid/base_encoder.cpython-311-darwin.so,sha256=5YeHMdKCIGaxm71xEf_zB5shdgMQs_dC45nzJ399LjY,188064
188
188
  mettagrid/config/room/ascii.py,sha256=bahuAvBmP71C_ypMdmGgeORGyxNtOHACWyUVROoUask,810
@@ -206,7 +206,7 @@ mettagrid/event.pxd,sha256=-NTNGBu2ESVihtvp5CvmOICtvEZHKU8_d89-9mZ9isw,1110
206
206
  mettagrid/event.pyx,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
207
207
  mettagrid/grid.cpp,sha256=7iYUHvvcBnu2EMkb8yiqxwIdKOPpRcYXLQ-D4cu8HrY,20
208
208
  mettagrid/grid.cpython-311-darwin.so,sha256=7G4qtvzw8b_rcrLYNyRkkfsdq5JnDbyWTYGL9T_Ulqw,16744
209
- mettagrid/grid.hpp,sha256=GRiUM5-82bJcBozR6wDqWSbgmoO86twwZnjiMnSxAVc,6514
209
+ mettagrid/grid.hpp,sha256=0HeF7VmODKmCOANGKPAu8vyUe5pC0MZ5L_bKdf_lXQ8,6655
210
210
  mettagrid/grid.pxd,sha256=wKNHILQsToB1eqGp42pmSuVG-hQrANYjSD4RbNYoV1w,1794
211
211
  mettagrid/grid_agent.pxd,sha256=JRPk0TAJabTdxV4wlUoP3PeOnVkXNcAlMWqPnnXfwTE,134
212
212
  mettagrid/grid_agent.pyx,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -319,7 +319,7 @@ tests/regen_track_last_action_trace.py,sha256=a1QdBRkvvBC7C0ZANQiwknb3QFQa6iHkNm
319
319
  tests/test_basic.py,sha256=moICNw_9L_lfSQRT2k7LWdEIEC9x2kwK1o46ClVvz2Q,4861
320
320
  tests/test_kinship.py,sha256=TvyPBbVazgYMGP-KbkWqKoo1QO1d3iT2uPwccyKypss,2406
321
321
  tests/test_leaks.py,sha256=Uo-L5h68knTDVcnSUZ8rNXeb-rcMTOqZNOB0SYTC5_I,570
322
- mettagrid-0.1.4.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
323
- mettagrid-0.1.4.dist-info/METADATA,sha256=nkDgfNsFwyu7hhzg_OtLV4dkjhxl9-zZJc6TUYWUkJU,7166
324
- mettagrid-0.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
325
- mettagrid-0.1.4.dist-info/RECORD,,
322
+ mettagrid-0.1.5.dist-info/LICENSE,sha256=_0ZygdDOImEUQjXap6LgAetwhuvlOfOqcMDmNlAdjLo,1070
323
+ mettagrid-0.1.5.dist-info/METADATA,sha256=gwDQZ7RHEovefi-WP-Liteb9wnP1Gg6-mruJ9bRWiZg,7166
324
+ mettagrid-0.1.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
325
+ mettagrid-0.1.5.dist-info/RECORD,,