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.
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/move.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/swap.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/grid_env.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/agent.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/altar.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/armory.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/constants.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/converter.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/factory.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/generator.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/lab.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/lasery.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/mine.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/wall.cpython-311-darwin.so +0 -0
- build/lib.macosx-11.0-arm64-cpython-311/mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
- build/mettagrid/actions/swap.cpp +85 -48
- build/mettagrid/grid_env.cpp +899 -768
- build/mettagrid/mettagrid.cpp +709 -468
- build/mettagrid/objects/agent.hpp +4 -0
- build/mettagrid/objects/constants.hpp +19 -10
- build/mettagrid/objects/converter.hpp +5 -1
- build/mettagrid/objects/generator.hpp +4 -0
- build/mettagrid/objects/metta_object.hpp +5 -1
- build/mettagrid/objects/mine.hpp +6 -0
- build/mettagrid/objects/wall.hpp +10 -0
- mettagrid/actions/actions.cpython-311-darwin.so +0 -0
- mettagrid/actions/attack.cpython-311-darwin.so +0 -0
- mettagrid/actions/attack_nearest.cpython-311-darwin.so +0 -0
- mettagrid/actions/change_color.cpython-311-darwin.so +0 -0
- mettagrid/actions/get_output.cpython-311-darwin.so +0 -0
- mettagrid/actions/move.cpython-311-darwin.so +0 -0
- mettagrid/actions/noop.cpython-311-darwin.so +0 -0
- mettagrid/actions/put_recipe_items.cpython-311-darwin.so +0 -0
- mettagrid/actions/rotate.cpython-311-darwin.so +0 -0
- mettagrid/actions/swap.cpython-311-darwin.so +0 -0
- mettagrid/actions/swap.pyx +9 -3
- mettagrid/config/config.py +14 -48
- mettagrid/grid_env.cpython-311-darwin.so +0 -0
- mettagrid/grid_env.pyx +4 -0
- mettagrid/mettagrid.pyx +14 -5
- mettagrid/mettagrid_c.cpython-311-darwin.so +0 -0
- mettagrid/mettagrid_env.py +57 -8
- mettagrid/objects/agent.cpython-311-darwin.so +0 -0
- mettagrid/objects/agent.hpp +4 -0
- mettagrid/objects/altar.cpython-311-darwin.so +0 -0
- mettagrid/objects/armory.cpython-311-darwin.so +0 -0
- mettagrid/objects/constants.cpython-311-darwin.so +0 -0
- mettagrid/objects/constants.hpp +19 -10
- mettagrid/objects/converter.cpython-311-darwin.so +0 -0
- mettagrid/objects/converter.hpp +5 -1
- mettagrid/objects/factory.cpython-311-darwin.so +0 -0
- mettagrid/objects/generator.cpython-311-darwin.so +0 -0
- mettagrid/objects/generator.hpp +4 -0
- mettagrid/objects/lab.cpython-311-darwin.so +0 -0
- mettagrid/objects/lasery.cpython-311-darwin.so +0 -0
- mettagrid/objects/metta_object.cpython-311-darwin.so +0 -0
- mettagrid/objects/metta_object.hpp +5 -1
- mettagrid/objects/metta_object.pxd +1 -0
- mettagrid/objects/mine.cpython-311-darwin.so +0 -0
- mettagrid/objects/mine.hpp +6 -0
- mettagrid/objects/production_handler.cpython-311-darwin.so +0 -0
- mettagrid/objects/wall.cpython-311-darwin.so +0 -0
- mettagrid/objects/wall.hpp +10 -0
- mettagrid/observation_encoder.cpython-311-darwin.so +0 -0
- mettagrid/renderer/raylib/object_render.py +2 -2
- mettagrid/renderer/raylib/raylib_renderer.py +1 -3
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/METADATA +1 -1
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/RECORD +83 -83
- tests/benchmark_env_perf.py +0 -3
- tests/test_basic.py +3 -0
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/LICENSE +0 -0
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.1.dist-info}/WHEEL +0 -0
|
Binary file
|
|
Binary file
|
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/attack_nearest.cpython-311-darwin.so
CHANGED
|
Binary file
|
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/change_color.cpython-311-darwin.so
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/actions/put_recipe_items.cpython-311-darwin.so
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/metta_object.cpython-311-darwin.so
CHANGED
|
Binary file
|
|
Binary file
|
build/lib.macosx-11.0-arm64-cpython-311/mettagrid/objects/production_handler.cpython-311-darwin.so
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
build/mettagrid/actions/swap.cpp
CHANGED
|
@@ -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":
|
|
2326
|
-
* from mettagrid.
|
|
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":
|
|
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,
|
|
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,
|
|
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,
|
|
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":
|
|
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,
|
|
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,
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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":
|
|
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
|
-
|
|
19801
|
+
MettaObject *__pyx_v_target;
|
|
19802
19802
|
int __pyx_r;
|
|
19803
19803
|
int __pyx_t_1;
|
|
19804
19804
|
|
|
19805
|
-
/* "mettagrid/actions/swap.pyx":
|
|
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
|
-
*
|
|
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":
|
|
19815
|
-
* <Orientation>actor.orientation
|
|
19814
|
+
/* "mettagrid/actions/swap.pyx":33
|
|
19816
19815
|
* )
|
|
19817
|
-
* cdef
|
|
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
|
-
|
|
19849
|
+
__pyx_v_target = ((MettaObject *)__pyx_v_self->__pyx_base.__pyx_base.env->_grid->object_at(__pyx_v_target_loc));
|
|
19822
19850
|
|
|
19823
|
-
|
|
19824
|
-
*
|
|
19825
|
-
*
|
|
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":
|
|
19834
|
-
*
|
|
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.
|
|
19875
|
+
* if not target.swappable():
|
|
19839
19876
|
*/
|
|
19840
19877
|
__pyx_r = 0;
|
|
19841
19878
|
goto __pyx_L0;
|
|
19842
19879
|
|
|
19843
|
-
/* "mettagrid/actions/swap.pyx":
|
|
19844
|
-
*
|
|
19845
|
-
*
|
|
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":
|
|
19889
|
+
/* "mettagrid/actions/swap.pyx":40
|
|
19853
19890
|
* return False
|
|
19854
19891
|
*
|
|
19855
|
-
* if not target.
|
|
19892
|
+
* if not target.swappable(): # <<<<<<<<<<<<<<
|
|
19856
19893
|
* return False
|
|
19857
19894
|
*
|
|
19858
19895
|
*/
|
|
19859
|
-
__pyx_t_1 = (!
|
|
19896
|
+
__pyx_t_1 = (!__pyx_v_target->swappable());
|
|
19860
19897
|
if (__pyx_t_1) {
|
|
19861
19898
|
|
|
19862
|
-
/* "mettagrid/actions/swap.pyx":
|
|
19899
|
+
/* "mettagrid/actions/swap.pyx":41
|
|
19863
19900
|
*
|
|
19864
|
-
* if not target.
|
|
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":
|
|
19909
|
+
/* "mettagrid/actions/swap.pyx":40
|
|
19873
19910
|
* return False
|
|
19874
19911
|
*
|
|
19875
|
-
* if not target.
|
|
19912
|
+
* if not target.swappable(): # <<<<<<<<<<<<<<
|
|
19876
19913
|
* return False
|
|
19877
19914
|
*
|
|
19878
19915
|
*/
|
|
19879
19916
|
}
|
|
19880
19917
|
|
|
19881
|
-
/* "mettagrid/actions/swap.pyx":
|
|
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":
|
|
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":
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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;
|