mettagrid 0.1.0__py3-none-any.whl → 0.1.1__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.

Files changed (83) hide show
  1. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so +0 -0
  2. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
  3. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
  4. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
  5. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
  6. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so +0 -0
  7. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/noop.cpython-311-darwin.so +0 -0
  8. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
  9. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
  10. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/swap.cpython-311-darwin.so +0 -0
  11. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/grid_env.cpython-311-darwin.so +0 -0
  12. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
  13. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/agent.cpython-311-darwin.so +0 -0
  14. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/altar.cpython-311-darwin.so +0 -0
  15. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/armory.cpython-311-darwin.so +0 -0
  16. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/constants.cpython-311-darwin.so +0 -0
  17. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/converter.cpython-311-darwin.so +0 -0
  18. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/factory.cpython-311-darwin.so +0 -0
  19. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/generator.cpython-311-darwin.so +0 -0
  20. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/lab.cpython-311-darwin.so +0 -0
  21. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/lasery.cpython-311-darwin.so +0 -0
  22. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
  23. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/mine.cpython-311-darwin.so +0 -0
  24. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
  25. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/wall.cpython-311-darwin.so +0 -0
  26. build/lib.macosx-11.0-arm64-cpython-311/mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
  27. build/mettagrid/actions/swap.cpp +85 -48
  28. build/mettagrid/grid_env.cpp +899 -768
  29. build/mettagrid/mettagrid.cpp +709 -468
  30. build/mettagrid/objects/agent.hpp +4 -0
  31. build/mettagrid/objects/constants.hpp +19 -10
  32. build/mettagrid/objects/converter.hpp +5 -1
  33. build/mettagrid/objects/generator.hpp +4 -0
  34. build/mettagrid/objects/metta_object.hpp +5 -1
  35. build/mettagrid/objects/mine.hpp +6 -0
  36. build/mettagrid/objects/wall.hpp +10 -0
  37. mettagrid/actions/actions.cpython-311-darwin.so +0 -0
  38. mettagrid/actions/attack.cpython-311-darwin.so +0 -0
  39. mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
  40. mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
  41. mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
  42. mettagrid/actions/move.cpython-311-darwin.so +0 -0
  43. mettagrid/actions/noop.cpython-311-darwin.so +0 -0
  44. mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
  45. mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
  46. mettagrid/actions/swap.cpython-311-darwin.so +0 -0
  47. mettagrid/actions/swap.pyx +9 -3
  48. mettagrid/config/config.py +14 -48
  49. mettagrid/grid_env.cpython-311-darwin.so +0 -0
  50. mettagrid/grid_env.pyx +4 -0
  51. mettagrid/mettagrid.pyx +14 -5
  52. mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
  53. mettagrid/mettagrid_env.py +57 -8
  54. mettagrid/objects/agent.cpython-311-darwin.so +0 -0
  55. mettagrid/objects/agent.hpp +4 -0
  56. mettagrid/objects/altar.cpython-311-darwin.so +0 -0
  57. mettagrid/objects/armory.cpython-311-darwin.so +0 -0
  58. mettagrid/objects/constants.cpython-311-darwin.so +0 -0
  59. mettagrid/objects/constants.hpp +19 -10
  60. mettagrid/objects/converter.cpython-311-darwin.so +0 -0
  61. mettagrid/objects/converter.hpp +5 -1
  62. mettagrid/objects/factory.cpython-311-darwin.so +0 -0
  63. mettagrid/objects/generator.cpython-311-darwin.so +0 -0
  64. mettagrid/objects/generator.hpp +4 -0
  65. mettagrid/objects/lab.cpython-311-darwin.so +0 -0
  66. mettagrid/objects/lasery.cpython-311-darwin.so +0 -0
  67. mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
  68. mettagrid/objects/metta_object.hpp +5 -1
  69. mettagrid/objects/metta_object.pxd +1 -0
  70. mettagrid/objects/mine.cpython-311-darwin.so +0 -0
  71. mettagrid/objects/mine.hpp +6 -0
  72. mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
  73. mettagrid/objects/wall.cpython-311-darwin.so +0 -0
  74. mettagrid/objects/wall.hpp +10 -0
  75. mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
  76. mettagrid/renderer/raylib/object_render.py +2 -2
  77. mettagrid/renderer/raylib/raylib_renderer.py +1 -3
  78. {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/METADATA +1 -1
  79. {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/RECORD +83 -83
  80. tests/benchmark_env_perf.py +0 -3
  81. tests/test_basic.py +3 -0
  82. {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/LICENSE +0 -0
  83. {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/WHEEL +0 -0
@@ -2322,8 +2322,8 @@ struct __pyx_vtabstruct_9mettagrid_7actions_7actions_MettaActionHandler {
2322
2322
  static struct __pyx_vtabstruct_9mettagrid_7actions_7actions_MettaActionHandler *__pyx_vtabptr_9mettagrid_7actions_7actions_MettaActionHandler;
2323
2323
 
2324
2324
 
2325
- /* "mettagrid/actions/swap.pyx":13
2326
- * from mettagrid.actions.actions cimport MettaActionHandler
2325
+ /* "mettagrid/actions/swap.pyx":15
2326
+ * from mettagrid.objects.constants cimport GridLayer
2327
2327
  *
2328
2328
  * cdef class Swap(MettaActionHandler): # <<<<<<<<<<<<<<
2329
2329
  * def __init__(self, cfg: OmegaConf):
@@ -19600,7 +19600,7 @@ static CYTHON_INLINE NPY_DATETIMEUNIT __pyx_f_5numpy_get_datetime64_unit(PyObjec
19600
19600
  return __pyx_r;
19601
19601
  }
19602
19602
 
19603
- /* "mettagrid/actions/swap.pyx":14
19603
+ /* "mettagrid/actions/swap.pyx":16
19604
19604
  *
19605
19605
  * cdef class Swap(MettaActionHandler):
19606
19606
  * def __init__(self, cfg: OmegaConf): # <<<<<<<<<<<<<<
@@ -19644,12 +19644,12 @@ static int __pyx_pw_9mettagrid_7actions_4swap_4Swap_1__init__(PyObject *__pyx_v_
19644
19644
  (void)__Pyx_Arg_NewRef_VARARGS(values[0]);
19645
19645
  kw_args--;
19646
19646
  }
19647
- else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 14, __pyx_L3_error)
19647
+ else if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 16, __pyx_L3_error)
19648
19648
  else goto __pyx_L5_argtuple_error;
19649
19649
  }
19650
19650
  if (unlikely(kw_args > 0)) {
19651
19651
  const Py_ssize_t kwd_pos_args = __pyx_nargs;
19652
- if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 14, __pyx_L3_error)
19652
+ if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "__init__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error)
19653
19653
  }
19654
19654
  } else if (unlikely(__pyx_nargs != 1)) {
19655
19655
  goto __pyx_L5_argtuple_error;
@@ -19660,7 +19660,7 @@ static int __pyx_pw_9mettagrid_7actions_4swap_4Swap_1__init__(PyObject *__pyx_v_
19660
19660
  }
19661
19661
  goto __pyx_L6_skip;
19662
19662
  __pyx_L5_argtuple_error:;
19663
- __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 14, __pyx_L3_error)
19663
+ __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, __pyx_nargs); __PYX_ERR(1, 16, __pyx_L3_error)
19664
19664
  __pyx_L6_skip:;
19665
19665
  goto __pyx_L4_argument_unpacking_done;
19666
19666
  __pyx_L3_error:;
@@ -19699,14 +19699,14 @@ static int __pyx_pf_9mettagrid_7actions_4swap_4Swap___init__(struct __pyx_obj_9m
19699
19699
  int __pyx_clineno = 0;
19700
19700
  __Pyx_RefNannySetupContext("__init__", 1);
19701
19701
 
19702
- /* "mettagrid/actions/swap.pyx":15
19702
+ /* "mettagrid/actions/swap.pyx":17
19703
19703
  * cdef class Swap(MettaActionHandler):
19704
19704
  * def __init__(self, cfg: OmegaConf):
19705
19705
  * MettaActionHandler.__init__(self, cfg, "swap") # <<<<<<<<<<<<<<
19706
19706
  *
19707
19707
  * cdef unsigned char max_arg(self):
19708
19708
  */
19709
- __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_9mettagrid_7actions_7actions_MettaActionHandler), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
19709
+ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype_9mettagrid_7actions_7actions_MettaActionHandler), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error)
19710
19710
  __Pyx_GOTREF(__pyx_t_2);
19711
19711
  __pyx_t_3 = NULL;
19712
19712
  __pyx_t_4 = 0;
@@ -19726,13 +19726,13 @@ static int __pyx_pf_9mettagrid_7actions_4swap_4Swap___init__(struct __pyx_obj_9m
19726
19726
  PyObject *__pyx_callargs[4] = {__pyx_t_3, ((PyObject *)__pyx_v_self), __pyx_v_cfg, __pyx_n_u_swap};
19727
19727
  __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_4, 3+__pyx_t_4);
19728
19728
  __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
19729
- if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error)
19729
+ if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error)
19730
19730
  __Pyx_GOTREF(__pyx_t_1);
19731
19731
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
19732
19732
  }
19733
19733
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
19734
19734
 
19735
- /* "mettagrid/actions/swap.pyx":14
19735
+ /* "mettagrid/actions/swap.pyx":16
19736
19736
  *
19737
19737
  * cdef class Swap(MettaActionHandler):
19738
19738
  * def __init__(self, cfg: OmegaConf): # <<<<<<<<<<<<<<
@@ -19754,7 +19754,7 @@ static int __pyx_pf_9mettagrid_7actions_4swap_4Swap___init__(struct __pyx_obj_9m
19754
19754
  return __pyx_r;
19755
19755
  }
19756
19756
 
19757
- /* "mettagrid/actions/swap.pyx":17
19757
+ /* "mettagrid/actions/swap.pyx":19
19758
19758
  * MettaActionHandler.__init__(self, cfg, "swap")
19759
19759
  *
19760
19760
  * cdef unsigned char max_arg(self): # <<<<<<<<<<<<<<
@@ -19765,7 +19765,7 @@ static int __pyx_pf_9mettagrid_7actions_4swap_4Swap___init__(struct __pyx_obj_9m
19765
19765
  static unsigned char __pyx_f_9mettagrid_7actions_4swap_4Swap_max_arg(CYTHON_UNUSED struct __pyx_obj_9mettagrid_7actions_4swap_Swap *__pyx_v_self) {
19766
19766
  unsigned char __pyx_r;
19767
19767
 
19768
- /* "mettagrid/actions/swap.pyx":18
19768
+ /* "mettagrid/actions/swap.pyx":20
19769
19769
  *
19770
19770
  * cdef unsigned char max_arg(self):
19771
19771
  * return 0 # <<<<<<<<<<<<<<
@@ -19775,7 +19775,7 @@ static unsigned char __pyx_f_9mettagrid_7actions_4swap_4Swap_max_arg(CYTHON_UNUS
19775
19775
  __pyx_r = 0;
19776
19776
  goto __pyx_L0;
19777
19777
 
19778
- /* "mettagrid/actions/swap.pyx":17
19778
+ /* "mettagrid/actions/swap.pyx":19
19779
19779
  * MettaActionHandler.__init__(self, cfg, "swap")
19780
19780
  *
19781
19781
  * cdef unsigned char max_arg(self): # <<<<<<<<<<<<<<
@@ -19788,7 +19788,7 @@ static unsigned char __pyx_f_9mettagrid_7actions_4swap_4Swap_max_arg(CYTHON_UNUS
19788
19788
  return __pyx_r;
19789
19789
  }
19790
19790
 
19791
- /* "mettagrid/actions/swap.pyx":20
19791
+ /* "mettagrid/actions/swap.pyx":22
19792
19792
  * return 0
19793
19793
  *
19794
19794
  * cdef bint _handle_action( # <<<<<<<<<<<<<<
@@ -19798,31 +19798,68 @@ static unsigned char __pyx_f_9mettagrid_7actions_4swap_4Swap_max_arg(CYTHON_UNUS
19798
19798
 
19799
19799
  static int __pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action(struct __pyx_obj_9mettagrid_7actions_4swap_Swap *__pyx_v_self, CYTHON_UNUSED unsigned int __pyx_v_actor_id, Agent *__pyx_v_actor, CYTHON_UNUSED __pyx_t_9mettagrid_6action_ActionArg __pyx_v_arg) {
19800
19800
  GridLocation __pyx_v_target_loc;
19801
- Agent *__pyx_v_target;
19801
+ MettaObject *__pyx_v_target;
19802
19802
  int __pyx_r;
19803
19803
  int __pyx_t_1;
19804
19804
 
19805
- /* "mettagrid/actions/swap.pyx":26
19805
+ /* "mettagrid/actions/swap.pyx":28
19806
19806
  * ActionArg arg):
19807
19807
  *
19808
19808
  * cdef GridLocation target_loc = self.env._grid.relative_location( # <<<<<<<<<<<<<<
19809
19809
  * actor.location,
19810
- * <Orientation>actor.orientation
19810
+ * <Orientation>actor.orientation
19811
19811
  */
19812
19812
  __pyx_v_target_loc = __pyx_v_self->__pyx_base.__pyx_base.env->_grid->relative_location(__pyx_v_actor->location, ((Orientation)__pyx_v_actor->orientation));
19813
19813
 
19814
- /* "mettagrid/actions/swap.pyx":30
19815
- * <Orientation>actor.orientation
19814
+ /* "mettagrid/actions/swap.pyx":33
19816
19815
  * )
19817
- * cdef Agent *target = <Agent*>self.env._grid.object_at(target_loc) # <<<<<<<<<<<<<<
19816
+ * cdef MettaObject *target
19817
+ * target = <MettaObject*>self.env._grid.object_at(target_loc) # <<<<<<<<<<<<<<
19818
+ * if target == NULL:
19819
+ * target_loc.layer = GridLayer.Object_Layer
19820
+ */
19821
+ __pyx_v_target = ((MettaObject *)__pyx_v_self->__pyx_base.__pyx_base.env->_grid->object_at(__pyx_v_target_loc));
19822
+
19823
+ /* "mettagrid/actions/swap.pyx":34
19824
+ * cdef MettaObject *target
19825
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19826
+ * if target == NULL: # <<<<<<<<<<<<<<
19827
+ * target_loc.layer = GridLayer.Object_Layer
19828
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19829
+ */
19830
+ __pyx_t_1 = (__pyx_v_target == NULL);
19831
+ if (__pyx_t_1) {
19832
+
19833
+ /* "mettagrid/actions/swap.pyx":35
19834
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19835
+ * if target == NULL:
19836
+ * target_loc.layer = GridLayer.Object_Layer # <<<<<<<<<<<<<<
19837
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19838
+ * if target == NULL:
19839
+ */
19840
+ __pyx_v_target_loc.layer = Object_Layer;
19841
+
19842
+ /* "mettagrid/actions/swap.pyx":36
19843
+ * if target == NULL:
19844
+ * target_loc.layer = GridLayer.Object_Layer
19845
+ * target = <MettaObject*>self.env._grid.object_at(target_loc) # <<<<<<<<<<<<<<
19818
19846
  * if target == NULL:
19819
19847
  * return False
19820
19848
  */
19821
- __pyx_v_target = ((Agent *)__pyx_v_self->__pyx_base.__pyx_base.env->_grid->object_at(__pyx_v_target_loc));
19849
+ __pyx_v_target = ((MettaObject *)__pyx_v_self->__pyx_base.__pyx_base.env->_grid->object_at(__pyx_v_target_loc));
19822
19850
 
19823
- /* "mettagrid/actions/swap.pyx":31
19824
- * )
19825
- * cdef Agent *target = <Agent*>self.env._grid.object_at(target_loc)
19851
+ /* "mettagrid/actions/swap.pyx":34
19852
+ * cdef MettaObject *target
19853
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19854
+ * if target == NULL: # <<<<<<<<<<<<<<
19855
+ * target_loc.layer = GridLayer.Object_Layer
19856
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19857
+ */
19858
+ }
19859
+
19860
+ /* "mettagrid/actions/swap.pyx":37
19861
+ * target_loc.layer = GridLayer.Object_Layer
19862
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19826
19863
  * if target == NULL: # <<<<<<<<<<<<<<
19827
19864
  * return False
19828
19865
  *
@@ -19830,38 +19867,38 @@ static int __pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action(struct __pyx_o
19830
19867
  __pyx_t_1 = (__pyx_v_target == NULL);
19831
19868
  if (__pyx_t_1) {
19832
19869
 
19833
- /* "mettagrid/actions/swap.pyx":32
19834
- * cdef Agent *target = <Agent*>self.env._grid.object_at(target_loc)
19870
+ /* "mettagrid/actions/swap.pyx":38
19871
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19835
19872
  * if target == NULL:
19836
19873
  * return False # <<<<<<<<<<<<<<
19837
19874
  *
19838
- * if not target.frozen:
19875
+ * if not target.swappable():
19839
19876
  */
19840
19877
  __pyx_r = 0;
19841
19878
  goto __pyx_L0;
19842
19879
 
19843
- /* "mettagrid/actions/swap.pyx":31
19844
- * )
19845
- * cdef Agent *target = <Agent*>self.env._grid.object_at(target_loc)
19880
+ /* "mettagrid/actions/swap.pyx":37
19881
+ * target_loc.layer = GridLayer.Object_Layer
19882
+ * target = <MettaObject*>self.env._grid.object_at(target_loc)
19846
19883
  * if target == NULL: # <<<<<<<<<<<<<<
19847
19884
  * return False
19848
19885
  *
19849
19886
  */
19850
19887
  }
19851
19888
 
19852
- /* "mettagrid/actions/swap.pyx":34
19889
+ /* "mettagrid/actions/swap.pyx":40
19853
19890
  * return False
19854
19891
  *
19855
- * if not target.frozen: # <<<<<<<<<<<<<<
19892
+ * if not target.swappable(): # <<<<<<<<<<<<<<
19856
19893
  * return False
19857
19894
  *
19858
19895
  */
19859
- __pyx_t_1 = (!(__pyx_v_target->frozen != 0));
19896
+ __pyx_t_1 = (!__pyx_v_target->swappable());
19860
19897
  if (__pyx_t_1) {
19861
19898
 
19862
- /* "mettagrid/actions/swap.pyx":35
19899
+ /* "mettagrid/actions/swap.pyx":41
19863
19900
  *
19864
- * if not target.frozen:
19901
+ * if not target.swappable():
19865
19902
  * return False # <<<<<<<<<<<<<<
19866
19903
  *
19867
19904
  * self.env._grid.swap_objects(actor.id, target.id)
@@ -19869,16 +19906,16 @@ static int __pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action(struct __pyx_o
19869
19906
  __pyx_r = 0;
19870
19907
  goto __pyx_L0;
19871
19908
 
19872
- /* "mettagrid/actions/swap.pyx":34
19909
+ /* "mettagrid/actions/swap.pyx":40
19873
19910
  * return False
19874
19911
  *
19875
- * if not target.frozen: # <<<<<<<<<<<<<<
19912
+ * if not target.swappable(): # <<<<<<<<<<<<<<
19876
19913
  * return False
19877
19914
  *
19878
19915
  */
19879
19916
  }
19880
19917
 
19881
- /* "mettagrid/actions/swap.pyx":37
19918
+ /* "mettagrid/actions/swap.pyx":43
19882
19919
  * return False
19883
19920
  *
19884
19921
  * self.env._grid.swap_objects(actor.id, target.id) # <<<<<<<<<<<<<<
@@ -19886,7 +19923,7 @@ static int __pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action(struct __pyx_o
19886
19923
  */
19887
19924
  __pyx_v_self->__pyx_base.__pyx_base.env->_grid->swap_objects(__pyx_v_actor->id, __pyx_v_target->id);
19888
19925
 
19889
- /* "mettagrid/actions/swap.pyx":38
19926
+ /* "mettagrid/actions/swap.pyx":44
19890
19927
  *
19891
19928
  * self.env._grid.swap_objects(actor.id, target.id)
19892
19929
  * return True # <<<<<<<<<<<<<<
@@ -19894,7 +19931,7 @@ static int __pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action(struct __pyx_o
19894
19931
  __pyx_r = 1;
19895
19932
  goto __pyx_L0;
19896
19933
 
19897
- /* "mettagrid/actions/swap.pyx":20
19934
+ /* "mettagrid/actions/swap.pyx":22
19898
19935
  * return 0
19899
19936
  *
19900
19937
  * cdef bint _handle_action( # <<<<<<<<<<<<<<
@@ -21648,12 +21685,12 @@ static int __Pyx_modinit_type_init_code(void) {
21648
21685
  __pyx_vtable_9mettagrid_7actions_4swap_Swap.__pyx_base.__pyx_base.max_arg = (unsigned char (*)(struct __pyx_obj_9mettagrid_6action_ActionHandler *))__pyx_f_9mettagrid_7actions_4swap_4Swap_max_arg;
21649
21686
  __pyx_vtable_9mettagrid_7actions_4swap_Swap.__pyx_base._handle_action = (int (*)(struct __pyx_obj_9mettagrid_7actions_7actions_MettaActionHandler *, unsigned int, Agent *, __pyx_t_9mettagrid_6action_ActionArg))__pyx_f_9mettagrid_7actions_4swap_4Swap__handle_action;
21650
21687
  #if CYTHON_USE_TYPE_SPECS
21651
- __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_9mettagrid_7actions_7actions_MettaActionHandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 13, __pyx_L1_error)
21688
+ __pyx_t_2 = PyTuple_Pack(1, (PyObject *)__pyx_ptype_9mettagrid_7actions_7actions_MettaActionHandler); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 15, __pyx_L1_error)
21652
21689
  __Pyx_GOTREF(__pyx_t_2);
21653
21690
  __pyx_ptype_9mettagrid_7actions_4swap_Swap = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9mettagrid_7actions_4swap_Swap_spec, __pyx_t_2);
21654
21691
  __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
21655
- if (unlikely(!__pyx_ptype_9mettagrid_7actions_4swap_Swap)) __PYX_ERR(1, 13, __pyx_L1_error)
21656
- if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9mettagrid_7actions_4swap_Swap_spec, __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21692
+ if (unlikely(!__pyx_ptype_9mettagrid_7actions_4swap_Swap)) __PYX_ERR(1, 15, __pyx_L1_error)
21693
+ if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9mettagrid_7actions_4swap_Swap_spec, __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21657
21694
  #else
21658
21695
  __pyx_ptype_9mettagrid_7actions_4swap_Swap = &__pyx_type_9mettagrid_7actions_4swap_Swap;
21659
21696
  #endif
@@ -21662,7 +21699,7 @@ static int __Pyx_modinit_type_init_code(void) {
21662
21699
  __pyx_ptype_9mettagrid_7actions_4swap_Swap->tp_base = __pyx_ptype_9mettagrid_7actions_7actions_MettaActionHandler;
21663
21700
  #endif
21664
21701
  #if !CYTHON_USE_TYPE_SPECS
21665
- if (__Pyx_PyType_Ready(__pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21702
+ if (__Pyx_PyType_Ready(__pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21666
21703
  #endif
21667
21704
  #if PY_MAJOR_VERSION < 3
21668
21705
  __pyx_ptype_9mettagrid_7actions_4swap_Swap->tp_print = 0;
@@ -21672,13 +21709,13 @@ static int __Pyx_modinit_type_init_code(void) {
21672
21709
  __pyx_ptype_9mettagrid_7actions_4swap_Swap->tp_getattro = __Pyx_PyObject_GenericGetAttr;
21673
21710
  }
21674
21711
  #endif
21675
- if (__Pyx_SetVtable(__pyx_ptype_9mettagrid_7actions_4swap_Swap, __pyx_vtabptr_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21712
+ if (__Pyx_SetVtable(__pyx_ptype_9mettagrid_7actions_4swap_Swap, __pyx_vtabptr_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21676
21713
  #if !CYTHON_COMPILING_IN_LIMITED_API
21677
- if (__Pyx_MergeVtables(__pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21714
+ if (__Pyx_MergeVtables(__pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21678
21715
  #endif
21679
- if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Swap, (PyObject *) __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21716
+ if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Swap, (PyObject *) __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21680
21717
  #if !CYTHON_COMPILING_IN_LIMITED_API
21681
- if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 13, __pyx_L1_error)
21718
+ if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_9mettagrid_7actions_4swap_Swap) < 0) __PYX_ERR(1, 15, __pyx_L1_error)
21682
21719
  #endif
21683
21720
  __pyx_vtabptr_array = &__pyx_vtable_array;
21684
21721
  __pyx_vtable_array.get_memview = (PyObject *(*)(struct __pyx_array_obj *))__pyx_array_get_memview;