mettagrid 0.1.0__py3-none-any.whl → 0.1.2__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.
- 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/change_color.cpp +2 -2
- 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/config/room/ascii.py +3 -1
- mettagrid/grid.hpp +4 -2
- 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.2.dist-info}/METADATA +1 -1
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.2.dist-info}/RECORD +86 -86
- tests/benchmark_env_perf.py +0 -3
- tests/test_basic.py +3 -0
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.2.dist-info}/LICENSE +0 -0
- {mettagrid-0.1.0.dist-info → mettagrid-0.1.2.dist-info}/WHEEL +0 -0
build/mettagrid/mettagrid.cpp
CHANGED
|
@@ -3860,6 +3860,7 @@ static const char __pyx_k_wall[] = "wall";
|
|
|
3860
3860
|
static const char __pyx_k_ASCII[] = "ASCII";
|
|
3861
3861
|
static const char __pyx_k_agent[] = "agent.";
|
|
3862
3862
|
static const char __pyx_k_altar[] = "altar";
|
|
3863
|
+
static const char __pyx_k_block[] = "block";
|
|
3863
3864
|
static const char __pyx_k_class[] = "__class__";
|
|
3864
3865
|
static const char __pyx_k_count[] = "count";
|
|
3865
3866
|
static const char __pyx_k_dtype[] = "dtype";
|
|
@@ -3915,6 +3916,7 @@ static const char __pyx_k_Sequence[] = "Sequence";
|
|
|
3915
3916
|
static const char __pyx_k_agent_id[] = "agent_id";
|
|
3916
3917
|
static const char __pyx_k_getstate[] = "__getstate__";
|
|
3917
3918
|
static const char __pyx_k_itemsize[] = "itemsize";
|
|
3919
|
+
static const char __pyx_k_mine_red[] = "mine.red";
|
|
3918
3920
|
static const char __pyx_k_pyx_type[] = "__pyx_type";
|
|
3919
3921
|
static const char __pyx_k_register[] = "register";
|
|
3920
3922
|
static const char __pyx_k_setstate[] = "__setstate__";
|
|
@@ -3957,7 +3959,9 @@ static const char __pyx_k_to_container[] = "to_container";
|
|
|
3957
3959
|
static const char __pyx_k_version_info[] = "version_info";
|
|
3958
3960
|
static const char __pyx_k_AttackNearest[] = "AttackNearest";
|
|
3959
3961
|
static const char __pyx_k_class_getitem[] = "__class_getitem__";
|
|
3962
|
+
static const char __pyx_k_generator_red[] = "generator.red";
|
|
3960
3963
|
static const char __pyx_k_grid_features[] = "grid_features";
|
|
3964
|
+
static const char __pyx_k_objects_block[] = "objects.block";
|
|
3961
3965
|
static const char __pyx_k_reduce_cython[] = "__reduce_cython__";
|
|
3962
3966
|
static const char __pyx_k_AssertionError[] = "AssertionError";
|
|
3963
3967
|
static const char __pyx_k_MettaGrid_step[] = "MettaGrid.step";
|
|
@@ -4288,6 +4292,8 @@ typedef struct {
|
|
|
4288
4292
|
PyObject *__pyx_n_s_asyncio_coroutines;
|
|
4289
4293
|
PyObject *__pyx_n_s_attack;
|
|
4290
4294
|
PyObject *__pyx_n_s_base;
|
|
4295
|
+
PyObject *__pyx_n_s_block;
|
|
4296
|
+
PyObject *__pyx_n_u_block;
|
|
4291
4297
|
PyObject *__pyx_n_s_c;
|
|
4292
4298
|
PyObject *__pyx_n_u_c;
|
|
4293
4299
|
PyObject *__pyx_n_s_change_color;
|
|
@@ -4320,8 +4326,8 @@ typedef struct {
|
|
|
4320
4326
|
PyObject *__pyx_n_s_game;
|
|
4321
4327
|
PyObject *__pyx_n_u_game;
|
|
4322
4328
|
PyObject *__pyx_kp_u_gc;
|
|
4323
|
-
PyObject *__pyx_n_s_generator;
|
|
4324
4329
|
PyObject *__pyx_n_u_generator;
|
|
4330
|
+
PyObject *__pyx_kp_u_generator_red;
|
|
4325
4331
|
PyObject *__pyx_n_s_get;
|
|
4326
4332
|
PyObject *__pyx_n_s_get_episode_stats;
|
|
4327
4333
|
PyObject *__pyx_n_s_get_items;
|
|
@@ -4369,8 +4375,8 @@ typedef struct {
|
|
|
4369
4375
|
PyObject *__pyx_n_s_mettagrid_actions_swap;
|
|
4370
4376
|
PyObject *__pyx_n_s_mettagrid_mettagrid_c;
|
|
4371
4377
|
PyObject *__pyx_kp_s_mettagrid_mettagrid_pyx;
|
|
4372
|
-
PyObject *__pyx_n_s_mine;
|
|
4373
4378
|
PyObject *__pyx_n_u_mine;
|
|
4379
|
+
PyObject *__pyx_kp_u_mine_red;
|
|
4374
4380
|
PyObject *__pyx_n_s_mode;
|
|
4375
4381
|
PyObject *__pyx_n_s_move;
|
|
4376
4382
|
PyObject *__pyx_n_s_name;
|
|
@@ -4632,6 +4638,8 @@ static int __pyx_m_clear(PyObject *m) {
|
|
|
4632
4638
|
Py_CLEAR(clear_module_state->__pyx_n_s_asyncio_coroutines);
|
|
4633
4639
|
Py_CLEAR(clear_module_state->__pyx_n_s_attack);
|
|
4634
4640
|
Py_CLEAR(clear_module_state->__pyx_n_s_base);
|
|
4641
|
+
Py_CLEAR(clear_module_state->__pyx_n_s_block);
|
|
4642
|
+
Py_CLEAR(clear_module_state->__pyx_n_u_block);
|
|
4635
4643
|
Py_CLEAR(clear_module_state->__pyx_n_s_c);
|
|
4636
4644
|
Py_CLEAR(clear_module_state->__pyx_n_u_c);
|
|
4637
4645
|
Py_CLEAR(clear_module_state->__pyx_n_s_change_color);
|
|
@@ -4664,8 +4672,8 @@ static int __pyx_m_clear(PyObject *m) {
|
|
|
4664
4672
|
Py_CLEAR(clear_module_state->__pyx_n_s_game);
|
|
4665
4673
|
Py_CLEAR(clear_module_state->__pyx_n_u_game);
|
|
4666
4674
|
Py_CLEAR(clear_module_state->__pyx_kp_u_gc);
|
|
4667
|
-
Py_CLEAR(clear_module_state->__pyx_n_s_generator);
|
|
4668
4675
|
Py_CLEAR(clear_module_state->__pyx_n_u_generator);
|
|
4676
|
+
Py_CLEAR(clear_module_state->__pyx_kp_u_generator_red);
|
|
4669
4677
|
Py_CLEAR(clear_module_state->__pyx_n_s_get);
|
|
4670
4678
|
Py_CLEAR(clear_module_state->__pyx_n_s_get_episode_stats);
|
|
4671
4679
|
Py_CLEAR(clear_module_state->__pyx_n_s_get_items);
|
|
@@ -4713,8 +4721,8 @@ static int __pyx_m_clear(PyObject *m) {
|
|
|
4713
4721
|
Py_CLEAR(clear_module_state->__pyx_n_s_mettagrid_actions_swap);
|
|
4714
4722
|
Py_CLEAR(clear_module_state->__pyx_n_s_mettagrid_mettagrid_c);
|
|
4715
4723
|
Py_CLEAR(clear_module_state->__pyx_kp_s_mettagrid_mettagrid_pyx);
|
|
4716
|
-
Py_CLEAR(clear_module_state->__pyx_n_s_mine);
|
|
4717
4724
|
Py_CLEAR(clear_module_state->__pyx_n_u_mine);
|
|
4725
|
+
Py_CLEAR(clear_module_state->__pyx_kp_u_mine_red);
|
|
4718
4726
|
Py_CLEAR(clear_module_state->__pyx_n_s_mode);
|
|
4719
4727
|
Py_CLEAR(clear_module_state->__pyx_n_s_move);
|
|
4720
4728
|
Py_CLEAR(clear_module_state->__pyx_n_s_name);
|
|
@@ -4954,6 +4962,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
4954
4962
|
Py_VISIT(traverse_module_state->__pyx_n_s_asyncio_coroutines);
|
|
4955
4963
|
Py_VISIT(traverse_module_state->__pyx_n_s_attack);
|
|
4956
4964
|
Py_VISIT(traverse_module_state->__pyx_n_s_base);
|
|
4965
|
+
Py_VISIT(traverse_module_state->__pyx_n_s_block);
|
|
4966
|
+
Py_VISIT(traverse_module_state->__pyx_n_u_block);
|
|
4957
4967
|
Py_VISIT(traverse_module_state->__pyx_n_s_c);
|
|
4958
4968
|
Py_VISIT(traverse_module_state->__pyx_n_u_c);
|
|
4959
4969
|
Py_VISIT(traverse_module_state->__pyx_n_s_change_color);
|
|
@@ -4986,8 +4996,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
4986
4996
|
Py_VISIT(traverse_module_state->__pyx_n_s_game);
|
|
4987
4997
|
Py_VISIT(traverse_module_state->__pyx_n_u_game);
|
|
4988
4998
|
Py_VISIT(traverse_module_state->__pyx_kp_u_gc);
|
|
4989
|
-
Py_VISIT(traverse_module_state->__pyx_n_s_generator);
|
|
4990
4999
|
Py_VISIT(traverse_module_state->__pyx_n_u_generator);
|
|
5000
|
+
Py_VISIT(traverse_module_state->__pyx_kp_u_generator_red);
|
|
4991
5001
|
Py_VISIT(traverse_module_state->__pyx_n_s_get);
|
|
4992
5002
|
Py_VISIT(traverse_module_state->__pyx_n_s_get_episode_stats);
|
|
4993
5003
|
Py_VISIT(traverse_module_state->__pyx_n_s_get_items);
|
|
@@ -5035,8 +5045,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
5035
5045
|
Py_VISIT(traverse_module_state->__pyx_n_s_mettagrid_actions_swap);
|
|
5036
5046
|
Py_VISIT(traverse_module_state->__pyx_n_s_mettagrid_mettagrid_c);
|
|
5037
5047
|
Py_VISIT(traverse_module_state->__pyx_kp_s_mettagrid_mettagrid_pyx);
|
|
5038
|
-
Py_VISIT(traverse_module_state->__pyx_n_s_mine);
|
|
5039
5048
|
Py_VISIT(traverse_module_state->__pyx_n_u_mine);
|
|
5049
|
+
Py_VISIT(traverse_module_state->__pyx_kp_u_mine_red);
|
|
5040
5050
|
Py_VISIT(traverse_module_state->__pyx_n_s_mode);
|
|
5041
5051
|
Py_VISIT(traverse_module_state->__pyx_n_s_move);
|
|
5042
5052
|
Py_VISIT(traverse_module_state->__pyx_n_s_name);
|
|
@@ -5358,6 +5368,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
5358
5368
|
#define __pyx_n_s_asyncio_coroutines __pyx_mstate_global->__pyx_n_s_asyncio_coroutines
|
|
5359
5369
|
#define __pyx_n_s_attack __pyx_mstate_global->__pyx_n_s_attack
|
|
5360
5370
|
#define __pyx_n_s_base __pyx_mstate_global->__pyx_n_s_base
|
|
5371
|
+
#define __pyx_n_s_block __pyx_mstate_global->__pyx_n_s_block
|
|
5372
|
+
#define __pyx_n_u_block __pyx_mstate_global->__pyx_n_u_block
|
|
5361
5373
|
#define __pyx_n_s_c __pyx_mstate_global->__pyx_n_s_c
|
|
5362
5374
|
#define __pyx_n_u_c __pyx_mstate_global->__pyx_n_u_c
|
|
5363
5375
|
#define __pyx_n_s_change_color __pyx_mstate_global->__pyx_n_s_change_color
|
|
@@ -5390,8 +5402,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
5390
5402
|
#define __pyx_n_s_game __pyx_mstate_global->__pyx_n_s_game
|
|
5391
5403
|
#define __pyx_n_u_game __pyx_mstate_global->__pyx_n_u_game
|
|
5392
5404
|
#define __pyx_kp_u_gc __pyx_mstate_global->__pyx_kp_u_gc
|
|
5393
|
-
#define __pyx_n_s_generator __pyx_mstate_global->__pyx_n_s_generator
|
|
5394
5405
|
#define __pyx_n_u_generator __pyx_mstate_global->__pyx_n_u_generator
|
|
5406
|
+
#define __pyx_kp_u_generator_red __pyx_mstate_global->__pyx_kp_u_generator_red
|
|
5395
5407
|
#define __pyx_n_s_get __pyx_mstate_global->__pyx_n_s_get
|
|
5396
5408
|
#define __pyx_n_s_get_episode_stats __pyx_mstate_global->__pyx_n_s_get_episode_stats
|
|
5397
5409
|
#define __pyx_n_s_get_items __pyx_mstate_global->__pyx_n_s_get_items
|
|
@@ -5439,8 +5451,8 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) {
|
|
|
5439
5451
|
#define __pyx_n_s_mettagrid_actions_swap __pyx_mstate_global->__pyx_n_s_mettagrid_actions_swap
|
|
5440
5452
|
#define __pyx_n_s_mettagrid_mettagrid_c __pyx_mstate_global->__pyx_n_s_mettagrid_mettagrid_c
|
|
5441
5453
|
#define __pyx_kp_s_mettagrid_mettagrid_pyx __pyx_mstate_global->__pyx_kp_s_mettagrid_mettagrid_pyx
|
|
5442
|
-
#define __pyx_n_s_mine __pyx_mstate_global->__pyx_n_s_mine
|
|
5443
5454
|
#define __pyx_n_u_mine __pyx_mstate_global->__pyx_n_u_mine
|
|
5455
|
+
#define __pyx_kp_u_mine_red __pyx_mstate_global->__pyx_kp_u_mine_red
|
|
5444
5456
|
#define __pyx_n_s_mode __pyx_mstate_global->__pyx_n_s_mode
|
|
5445
5457
|
#define __pyx_n_s_move __pyx_mstate_global->__pyx_n_s_move
|
|
5446
5458
|
#define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name
|
|
@@ -22016,6 +22028,8 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
22016
22028
|
PyObject *__pyx_v_r = NULL;
|
|
22017
22029
|
PyObject *__pyx_v_c = NULL;
|
|
22018
22030
|
Wall *__pyx_v_wall;
|
|
22031
|
+
Wall *__pyx_v_block;
|
|
22032
|
+
PyObject *__pyx_v_m = NULL;
|
|
22019
22033
|
PyObject *__pyx_v_agent_cfg = NULL;
|
|
22020
22034
|
PyObject *__pyx_v_rewards = NULL;
|
|
22021
22035
|
std::string __pyx_v_inv_item;
|
|
@@ -23308,7 +23322,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23308
23322
|
* wall = new Wall(r, c, cfg.objects.wall)
|
|
23309
23323
|
* self._grid.add_object(wall) # <<<<<<<<<<<<<<
|
|
23310
23324
|
* self._stats.incr(b"objects.wall")
|
|
23311
|
-
*
|
|
23325
|
+
* elif map[r,c] == "block":
|
|
23312
23326
|
*/
|
|
23313
23327
|
(void)(__pyx_v_self->__pyx_base._grid->add_object(__pyx_v_wall));
|
|
23314
23328
|
|
|
@@ -23316,8 +23330,8 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23316
23330
|
* wall = new Wall(r, c, cfg.objects.wall)
|
|
23317
23331
|
* self._grid.add_object(wall)
|
|
23318
23332
|
* self._stats.incr(b"objects.wall") # <<<<<<<<<<<<<<
|
|
23319
|
-
*
|
|
23320
|
-
*
|
|
23333
|
+
* elif map[r,c] == "block":
|
|
23334
|
+
* block = new Wall(r, c, cfg.objects.block)
|
|
23321
23335
|
*/
|
|
23322
23336
|
__pyx_v_self->__pyx_base._stats.incr(__pyx_k_objects_wall);
|
|
23323
23337
|
|
|
@@ -23331,161 +23345,385 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23331
23345
|
goto __pyx_L28;
|
|
23332
23346
|
}
|
|
23333
23347
|
|
|
23334
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23348
|
+
/* "mettagrid/mettagrid.pyx":117
|
|
23349
|
+
* self._grid.add_object(wall)
|
|
23335
23350
|
* self._stats.incr(b"objects.wall")
|
|
23336
|
-
*
|
|
23337
|
-
*
|
|
23338
|
-
*
|
|
23339
|
-
* elif map[r,c] == "generator":
|
|
23351
|
+
* elif map[r,c] == "block": # <<<<<<<<<<<<<<
|
|
23352
|
+
* block = new Wall(r, c, cfg.objects.block)
|
|
23353
|
+
* self._grid.add_object(block)
|
|
23340
23354
|
*/
|
|
23341
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23355
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 117, __pyx_L1_error)
|
|
23342
23356
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23343
23357
|
__Pyx_INCREF(__pyx_v_r);
|
|
23344
23358
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23345
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23359
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 117, __pyx_L1_error);
|
|
23346
23360
|
__Pyx_INCREF(__pyx_v_c);
|
|
23347
23361
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23348
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23349
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23362
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 117, __pyx_L1_error);
|
|
23363
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L1_error)
|
|
23350
23364
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23351
23365
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23352
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11,
|
|
23366
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_block, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 117, __pyx_L1_error)
|
|
23353
23367
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23354
23368
|
if (__pyx_t_6) {
|
|
23355
23369
|
|
|
23370
|
+
/* "mettagrid/mettagrid.pyx":118
|
|
23371
|
+
* self._stats.incr(b"objects.wall")
|
|
23372
|
+
* elif map[r,c] == "block":
|
|
23373
|
+
* block = new Wall(r, c, cfg.objects.block) # <<<<<<<<<<<<<<
|
|
23374
|
+
* self._grid.add_object(block)
|
|
23375
|
+
* self._stats.incr(b"objects.block")
|
|
23376
|
+
*/
|
|
23377
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error)
|
|
23378
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error)
|
|
23379
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 118, __pyx_L1_error)
|
|
23380
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23381
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_block); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 118, __pyx_L1_error)
|
|
23382
|
+
__Pyx_GOTREF(__pyx_t_10);
|
|
23383
|
+
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23384
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L1_error)
|
|
23385
|
+
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23386
|
+
try {
|
|
23387
|
+
__pyx_t_25 = new Wall(__pyx_t_23, __pyx_t_22, __pyx_t_24);
|
|
23388
|
+
} catch(...) {
|
|
23389
|
+
__Pyx_CppExn2PyErr();
|
|
23390
|
+
__PYX_ERR(0, 118, __pyx_L1_error)
|
|
23391
|
+
}
|
|
23392
|
+
__pyx_v_block = __pyx_t_25;
|
|
23393
|
+
|
|
23356
23394
|
/* "mettagrid/mettagrid.pyx":119
|
|
23357
|
-
*
|
|
23358
|
-
*
|
|
23359
|
-
*
|
|
23360
|
-
*
|
|
23361
|
-
*
|
|
23395
|
+
* elif map[r,c] == "block":
|
|
23396
|
+
* block = new Wall(r, c, cfg.objects.block)
|
|
23397
|
+
* self._grid.add_object(block) # <<<<<<<<<<<<<<
|
|
23398
|
+
* self._stats.incr(b"objects.block")
|
|
23399
|
+
* elif map[r,c].startswith("mine"):
|
|
23400
|
+
*/
|
|
23401
|
+
(void)(__pyx_v_self->__pyx_base._grid->add_object(__pyx_v_block));
|
|
23402
|
+
|
|
23403
|
+
/* "mettagrid/mettagrid.pyx":120
|
|
23404
|
+
* block = new Wall(r, c, cfg.objects.block)
|
|
23405
|
+
* self._grid.add_object(block)
|
|
23406
|
+
* self._stats.incr(b"objects.block") # <<<<<<<<<<<<<<
|
|
23407
|
+
* elif map[r,c].startswith("mine"):
|
|
23408
|
+
* m = map[r,c]
|
|
23409
|
+
*/
|
|
23410
|
+
__pyx_v_self->__pyx_base._stats.incr(__pyx_k_objects_block);
|
|
23411
|
+
|
|
23412
|
+
/* "mettagrid/mettagrid.pyx":117
|
|
23413
|
+
* self._grid.add_object(wall)
|
|
23414
|
+
* self._stats.incr(b"objects.wall")
|
|
23415
|
+
* elif map[r,c] == "block": # <<<<<<<<<<<<<<
|
|
23416
|
+
* block = new Wall(r, c, cfg.objects.block)
|
|
23417
|
+
* self._grid.add_object(block)
|
|
23362
23418
|
*/
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23419
|
+
goto __pyx_L28;
|
|
23420
|
+
}
|
|
23421
|
+
|
|
23422
|
+
/* "mettagrid/mettagrid.pyx":121
|
|
23423
|
+
* self._grid.add_object(block)
|
|
23424
|
+
* self._stats.incr(b"objects.block")
|
|
23425
|
+
* elif map[r,c].startswith("mine"): # <<<<<<<<<<<<<<
|
|
23426
|
+
* m = map[r,c]
|
|
23427
|
+
* if "." not in m:
|
|
23428
|
+
*/
|
|
23429
|
+
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
23430
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23431
|
+
__Pyx_INCREF(__pyx_v_r);
|
|
23432
|
+
__Pyx_GIVEREF(__pyx_v_r);
|
|
23433
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0, 121, __pyx_L1_error);
|
|
23434
|
+
__Pyx_INCREF(__pyx_v_c);
|
|
23435
|
+
__Pyx_GIVEREF(__pyx_v_c);
|
|
23436
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0, 121, __pyx_L1_error);
|
|
23437
|
+
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
23438
|
+
__Pyx_GOTREF(__pyx_t_1);
|
|
23439
|
+
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23440
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
23441
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23442
|
+
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23443
|
+
__pyx_t_1 = NULL;
|
|
23444
|
+
__pyx_t_5 = 0;
|
|
23445
|
+
#if CYTHON_UNPACK_METHODS
|
|
23446
|
+
if (likely(PyMethod_Check(__pyx_t_11))) {
|
|
23447
|
+
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11);
|
|
23448
|
+
if (likely(__pyx_t_1)) {
|
|
23449
|
+
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
|
|
23450
|
+
__Pyx_INCREF(__pyx_t_1);
|
|
23451
|
+
__Pyx_INCREF(function);
|
|
23452
|
+
__Pyx_DECREF_SET(__pyx_t_11, function);
|
|
23453
|
+
__pyx_t_5 = 1;
|
|
23454
|
+
}
|
|
23455
|
+
}
|
|
23456
|
+
#endif
|
|
23457
|
+
{
|
|
23458
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_n_u_mine};
|
|
23459
|
+
__pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
23460
|
+
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23461
|
+
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
23462
|
+
__Pyx_GOTREF(__pyx_t_10);
|
|
23463
|
+
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23464
|
+
}
|
|
23465
|
+
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 121, __pyx_L1_error)
|
|
23466
|
+
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23467
|
+
if (__pyx_t_6) {
|
|
23468
|
+
|
|
23469
|
+
/* "mettagrid/mettagrid.pyx":122
|
|
23470
|
+
* self._stats.incr(b"objects.block")
|
|
23471
|
+
* elif map[r,c].startswith("mine"):
|
|
23472
|
+
* m = map[r,c] # <<<<<<<<<<<<<<
|
|
23473
|
+
* if "." not in m:
|
|
23474
|
+
* m = "mine.red"
|
|
23475
|
+
*/
|
|
23476
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 122, __pyx_L1_error)
|
|
23477
|
+
__Pyx_GOTREF(__pyx_t_10);
|
|
23478
|
+
__Pyx_INCREF(__pyx_v_r);
|
|
23479
|
+
__Pyx_GIVEREF(__pyx_v_r);
|
|
23480
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 122, __pyx_L1_error);
|
|
23481
|
+
__Pyx_INCREF(__pyx_v_c);
|
|
23482
|
+
__Pyx_GIVEREF(__pyx_v_c);
|
|
23483
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 122, __pyx_L1_error);
|
|
23484
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 122, __pyx_L1_error)
|
|
23485
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23486
|
+
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23487
|
+
__Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_11);
|
|
23488
|
+
__pyx_t_11 = 0;
|
|
23489
|
+
|
|
23490
|
+
/* "mettagrid/mettagrid.pyx":123
|
|
23491
|
+
* elif map[r,c].startswith("mine"):
|
|
23492
|
+
* m = map[r,c]
|
|
23493
|
+
* if "." not in m: # <<<<<<<<<<<<<<
|
|
23494
|
+
* m = "mine.red"
|
|
23495
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23496
|
+
*/
|
|
23497
|
+
__pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__2, __pyx_v_m, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 123, __pyx_L1_error)
|
|
23498
|
+
if (__pyx_t_6) {
|
|
23499
|
+
|
|
23500
|
+
/* "mettagrid/mettagrid.pyx":124
|
|
23501
|
+
* m = map[r,c]
|
|
23502
|
+
* if "." not in m:
|
|
23503
|
+
* m = "mine.red" # <<<<<<<<<<<<<<
|
|
23504
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23505
|
+
* elif map[r,c].startswith("generator"):
|
|
23506
|
+
*/
|
|
23507
|
+
__Pyx_INCREF(__pyx_kp_u_mine_red);
|
|
23508
|
+
__Pyx_DECREF_SET(__pyx_v_m, __pyx_kp_u_mine_red);
|
|
23509
|
+
|
|
23510
|
+
/* "mettagrid/mettagrid.pyx":123
|
|
23511
|
+
* elif map[r,c].startswith("mine"):
|
|
23512
|
+
* m = map[r,c]
|
|
23513
|
+
* if "." not in m: # <<<<<<<<<<<<<<
|
|
23514
|
+
* m = "mine.red"
|
|
23515
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23516
|
+
*/
|
|
23517
|
+
}
|
|
23518
|
+
|
|
23519
|
+
/* "mettagrid/mettagrid.pyx":125
|
|
23520
|
+
* if "." not in m:
|
|
23521
|
+
* m = "mine.red"
|
|
23522
|
+
* converter = new Mine(r, c, cfg.objects[m]) # <<<<<<<<<<<<<<
|
|
23523
|
+
* elif map[r,c].startswith("generator"):
|
|
23524
|
+
* m = map[r,c]
|
|
23525
|
+
*/
|
|
23526
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
23527
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
23528
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
23366
23529
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23367
|
-
__pyx_t_10 =
|
|
23530
|
+
__pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_t_11, __pyx_v_m); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
23368
23531
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23369
23532
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23370
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23533
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L1_error)
|
|
23371
23534
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23372
23535
|
try {
|
|
23373
|
-
__pyx_t_26 = new Mine(
|
|
23536
|
+
__pyx_t_26 = new Mine(__pyx_t_22, __pyx_t_23, __pyx_t_24);
|
|
23374
23537
|
} catch(...) {
|
|
23375
23538
|
__Pyx_CppExn2PyErr();
|
|
23376
|
-
__PYX_ERR(0,
|
|
23539
|
+
__PYX_ERR(0, 125, __pyx_L1_error)
|
|
23377
23540
|
}
|
|
23378
23541
|
__pyx_v_converter = __pyx_t_26;
|
|
23379
23542
|
|
|
23380
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23381
|
-
* self.
|
|
23382
|
-
*
|
|
23383
|
-
* elif map[r,c]
|
|
23384
|
-
*
|
|
23385
|
-
*
|
|
23543
|
+
/* "mettagrid/mettagrid.pyx":121
|
|
23544
|
+
* self._grid.add_object(block)
|
|
23545
|
+
* self._stats.incr(b"objects.block")
|
|
23546
|
+
* elif map[r,c].startswith("mine"): # <<<<<<<<<<<<<<
|
|
23547
|
+
* m = map[r,c]
|
|
23548
|
+
* if "." not in m:
|
|
23386
23549
|
*/
|
|
23387
23550
|
goto __pyx_L28;
|
|
23388
23551
|
}
|
|
23389
23552
|
|
|
23390
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23391
|
-
*
|
|
23392
|
-
* converter = new Mine(r, c, cfg.objects
|
|
23393
|
-
* elif map[r,c]
|
|
23394
|
-
*
|
|
23395
|
-
*
|
|
23553
|
+
/* "mettagrid/mettagrid.pyx":126
|
|
23554
|
+
* m = "mine.red"
|
|
23555
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23556
|
+
* elif map[r,c].startswith("generator"): # <<<<<<<<<<<<<<
|
|
23557
|
+
* m = map[r,c]
|
|
23558
|
+
* if "." not in m:
|
|
23396
23559
|
*/
|
|
23397
|
-
|
|
23398
|
-
__Pyx_GOTREF(
|
|
23560
|
+
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
23561
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23399
23562
|
__Pyx_INCREF(__pyx_v_r);
|
|
23400
23563
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23401
|
-
if (__Pyx_PyTuple_SET_ITEM(
|
|
23564
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0, 126, __pyx_L1_error);
|
|
23402
23565
|
__Pyx_INCREF(__pyx_v_c);
|
|
23403
23566
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23404
|
-
if (__Pyx_PyTuple_SET_ITEM(
|
|
23405
|
-
|
|
23567
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0, 126, __pyx_L1_error);
|
|
23568
|
+
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
23569
|
+
__Pyx_GOTREF(__pyx_t_1);
|
|
23570
|
+
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23571
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
23406
23572
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23573
|
+
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23574
|
+
__pyx_t_1 = NULL;
|
|
23575
|
+
__pyx_t_5 = 0;
|
|
23576
|
+
#if CYTHON_UNPACK_METHODS
|
|
23577
|
+
if (likely(PyMethod_Check(__pyx_t_11))) {
|
|
23578
|
+
__pyx_t_1 = PyMethod_GET_SELF(__pyx_t_11);
|
|
23579
|
+
if (likely(__pyx_t_1)) {
|
|
23580
|
+
PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_11);
|
|
23581
|
+
__Pyx_INCREF(__pyx_t_1);
|
|
23582
|
+
__Pyx_INCREF(function);
|
|
23583
|
+
__Pyx_DECREF_SET(__pyx_t_11, function);
|
|
23584
|
+
__pyx_t_5 = 1;
|
|
23585
|
+
}
|
|
23586
|
+
}
|
|
23587
|
+
#endif
|
|
23588
|
+
{
|
|
23589
|
+
PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_n_u_generator};
|
|
23590
|
+
__pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
23591
|
+
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23592
|
+
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
23593
|
+
__Pyx_GOTREF(__pyx_t_10);
|
|
23594
|
+
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23595
|
+
}
|
|
23596
|
+
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 126, __pyx_L1_error)
|
|
23407
23597
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23408
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_generator, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 120, __pyx_L1_error)
|
|
23409
|
-
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23410
23598
|
if (__pyx_t_6) {
|
|
23411
23599
|
|
|
23412
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23413
|
-
* converter = new Mine(r, c, cfg.objects
|
|
23414
|
-
* elif map[r,c]
|
|
23415
|
-
*
|
|
23600
|
+
/* "mettagrid/mettagrid.pyx":127
|
|
23601
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23602
|
+
* elif map[r,c].startswith("generator"):
|
|
23603
|
+
* m = map[r,c] # <<<<<<<<<<<<<<
|
|
23604
|
+
* if "." not in m:
|
|
23605
|
+
* m = "generator.red"
|
|
23606
|
+
*/
|
|
23607
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 127, __pyx_L1_error)
|
|
23608
|
+
__Pyx_GOTREF(__pyx_t_10);
|
|
23609
|
+
__Pyx_INCREF(__pyx_v_r);
|
|
23610
|
+
__Pyx_GIVEREF(__pyx_v_r);
|
|
23611
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 127, __pyx_L1_error);
|
|
23612
|
+
__Pyx_INCREF(__pyx_v_c);
|
|
23613
|
+
__Pyx_GIVEREF(__pyx_v_c);
|
|
23614
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 127, __pyx_L1_error);
|
|
23615
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 127, __pyx_L1_error)
|
|
23616
|
+
__Pyx_GOTREF(__pyx_t_11);
|
|
23617
|
+
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23618
|
+
__Pyx_XDECREF_SET(__pyx_v_m, __pyx_t_11);
|
|
23619
|
+
__pyx_t_11 = 0;
|
|
23620
|
+
|
|
23621
|
+
/* "mettagrid/mettagrid.pyx":128
|
|
23622
|
+
* elif map[r,c].startswith("generator"):
|
|
23623
|
+
* m = map[r,c]
|
|
23624
|
+
* if "." not in m: # <<<<<<<<<<<<<<
|
|
23625
|
+
* m = "generator.red"
|
|
23626
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23627
|
+
*/
|
|
23628
|
+
__pyx_t_6 = (__Pyx_PySequence_ContainsTF(__pyx_kp_u__2, __pyx_v_m, Py_NE)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 128, __pyx_L1_error)
|
|
23629
|
+
if (__pyx_t_6) {
|
|
23630
|
+
|
|
23631
|
+
/* "mettagrid/mettagrid.pyx":129
|
|
23632
|
+
* m = map[r,c]
|
|
23633
|
+
* if "." not in m:
|
|
23634
|
+
* m = "generator.red" # <<<<<<<<<<<<<<
|
|
23635
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23636
|
+
* elif map[r,c] == "altar":
|
|
23637
|
+
*/
|
|
23638
|
+
__Pyx_INCREF(__pyx_kp_u_generator_red);
|
|
23639
|
+
__Pyx_DECREF_SET(__pyx_v_m, __pyx_kp_u_generator_red);
|
|
23640
|
+
|
|
23641
|
+
/* "mettagrid/mettagrid.pyx":128
|
|
23642
|
+
* elif map[r,c].startswith("generator"):
|
|
23643
|
+
* m = map[r,c]
|
|
23644
|
+
* if "." not in m: # <<<<<<<<<<<<<<
|
|
23645
|
+
* m = "generator.red"
|
|
23646
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23647
|
+
*/
|
|
23648
|
+
}
|
|
23649
|
+
|
|
23650
|
+
/* "mettagrid/mettagrid.pyx":130
|
|
23651
|
+
* if "." not in m:
|
|
23652
|
+
* m = "generator.red"
|
|
23653
|
+
* converter = new Generator(r, c, cfg.objects[m]) # <<<<<<<<<<<<<<
|
|
23416
23654
|
* elif map[r,c] == "altar":
|
|
23417
23655
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23418
23656
|
*/
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23657
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error)
|
|
23658
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error)
|
|
23659
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 130, __pyx_L1_error)
|
|
23422
23660
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23423
|
-
__pyx_t_10 =
|
|
23661
|
+
__pyx_t_10 = __Pyx_PyObject_GetItem(__pyx_t_11, __pyx_v_m); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 130, __pyx_L1_error)
|
|
23424
23662
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23425
23663
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23426
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23664
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 130, __pyx_L1_error)
|
|
23427
23665
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23428
|
-
__pyx_v_converter = new Generator(
|
|
23666
|
+
__pyx_v_converter = new Generator(__pyx_t_23, __pyx_t_22, __pyx_t_24);
|
|
23429
23667
|
|
|
23430
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23431
|
-
*
|
|
23432
|
-
* converter = new Mine(r, c, cfg.objects
|
|
23433
|
-
* elif map[r,c]
|
|
23434
|
-
*
|
|
23435
|
-
*
|
|
23668
|
+
/* "mettagrid/mettagrid.pyx":126
|
|
23669
|
+
* m = "mine.red"
|
|
23670
|
+
* converter = new Mine(r, c, cfg.objects[m])
|
|
23671
|
+
* elif map[r,c].startswith("generator"): # <<<<<<<<<<<<<<
|
|
23672
|
+
* m = map[r,c]
|
|
23673
|
+
* if "." not in m:
|
|
23436
23674
|
*/
|
|
23437
23675
|
goto __pyx_L28;
|
|
23438
23676
|
}
|
|
23439
23677
|
|
|
23440
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23441
|
-
*
|
|
23442
|
-
* converter = new Generator(r, c, cfg.objects
|
|
23678
|
+
/* "mettagrid/mettagrid.pyx":131
|
|
23679
|
+
* m = "generator.red"
|
|
23680
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23443
23681
|
* elif map[r,c] == "altar": # <<<<<<<<<<<<<<
|
|
23444
23682
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23445
23683
|
* elif map[r,c] == "armory":
|
|
23446
23684
|
*/
|
|
23447
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23685
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
23448
23686
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23449
23687
|
__Pyx_INCREF(__pyx_v_r);
|
|
23450
23688
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23451
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23689
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 131, __pyx_L1_error);
|
|
23452
23690
|
__Pyx_INCREF(__pyx_v_c);
|
|
23453
23691
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23454
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23455
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23692
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 131, __pyx_L1_error);
|
|
23693
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
23456
23694
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23457
23695
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23458
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_altar, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23696
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_altar, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 131, __pyx_L1_error)
|
|
23459
23697
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23460
23698
|
if (__pyx_t_6) {
|
|
23461
23699
|
|
|
23462
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23463
|
-
* converter = new Generator(r, c, cfg.objects
|
|
23700
|
+
/* "mettagrid/mettagrid.pyx":132
|
|
23701
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23464
23702
|
* elif map[r,c] == "altar":
|
|
23465
23703
|
* converter = new Altar(r, c, cfg.objects.altar) # <<<<<<<<<<<<<<
|
|
23466
23704
|
* elif map[r,c] == "armory":
|
|
23467
23705
|
* converter = new Armory(r, c, cfg.objects.armory)
|
|
23468
23706
|
*/
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23707
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
23708
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
23709
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
23472
23710
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23473
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_altar); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23711
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_altar); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
23474
23712
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23475
23713
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23476
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23714
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
|
|
23477
23715
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23478
23716
|
try {
|
|
23479
|
-
__pyx_t_27 = new Altar(
|
|
23717
|
+
__pyx_t_27 = new Altar(__pyx_t_22, __pyx_t_23, __pyx_t_24);
|
|
23480
23718
|
} catch(...) {
|
|
23481
23719
|
__Pyx_CppExn2PyErr();
|
|
23482
|
-
__PYX_ERR(0,
|
|
23720
|
+
__PYX_ERR(0, 132, __pyx_L1_error)
|
|
23483
23721
|
}
|
|
23484
23722
|
__pyx_v_converter = __pyx_t_27;
|
|
23485
23723
|
|
|
23486
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23487
|
-
*
|
|
23488
|
-
* converter = new Generator(r, c, cfg.objects
|
|
23724
|
+
/* "mettagrid/mettagrid.pyx":131
|
|
23725
|
+
* m = "generator.red"
|
|
23726
|
+
* converter = new Generator(r, c, cfg.objects[m])
|
|
23489
23727
|
* elif map[r,c] == "altar": # <<<<<<<<<<<<<<
|
|
23490
23728
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23491
23729
|
* elif map[r,c] == "armory":
|
|
@@ -23493,53 +23731,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23493
23731
|
goto __pyx_L28;
|
|
23494
23732
|
}
|
|
23495
23733
|
|
|
23496
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23734
|
+
/* "mettagrid/mettagrid.pyx":133
|
|
23497
23735
|
* elif map[r,c] == "altar":
|
|
23498
23736
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23499
23737
|
* elif map[r,c] == "armory": # <<<<<<<<<<<<<<
|
|
23500
23738
|
* converter = new Armory(r, c, cfg.objects.armory)
|
|
23501
23739
|
* elif map[r,c] == "lasery":
|
|
23502
23740
|
*/
|
|
23503
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23741
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
23504
23742
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23505
23743
|
__Pyx_INCREF(__pyx_v_r);
|
|
23506
23744
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23507
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23745
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 133, __pyx_L1_error);
|
|
23508
23746
|
__Pyx_INCREF(__pyx_v_c);
|
|
23509
23747
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23510
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23511
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23748
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 133, __pyx_L1_error);
|
|
23749
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
23512
23750
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23513
23751
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23514
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_armory, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23752
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_armory, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 133, __pyx_L1_error)
|
|
23515
23753
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23516
23754
|
if (__pyx_t_6) {
|
|
23517
23755
|
|
|
23518
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23756
|
+
/* "mettagrid/mettagrid.pyx":134
|
|
23519
23757
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23520
23758
|
* elif map[r,c] == "armory":
|
|
23521
23759
|
* converter = new Armory(r, c, cfg.objects.armory) # <<<<<<<<<<<<<<
|
|
23522
23760
|
* elif map[r,c] == "lasery":
|
|
23523
23761
|
* converter = new Lasery(r, c, cfg.objects.lasery)
|
|
23524
23762
|
*/
|
|
23525
|
-
|
|
23526
|
-
|
|
23527
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23763
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
23764
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
23765
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
23528
23766
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23529
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_armory); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23767
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_armory); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
23530
23768
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23531
23769
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23532
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23770
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L1_error)
|
|
23533
23771
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23534
23772
|
try {
|
|
23535
|
-
__pyx_t_28 = new Armory(
|
|
23773
|
+
__pyx_t_28 = new Armory(__pyx_t_23, __pyx_t_22, __pyx_t_24);
|
|
23536
23774
|
} catch(...) {
|
|
23537
23775
|
__Pyx_CppExn2PyErr();
|
|
23538
|
-
__PYX_ERR(0,
|
|
23776
|
+
__PYX_ERR(0, 134, __pyx_L1_error)
|
|
23539
23777
|
}
|
|
23540
23778
|
__pyx_v_converter = __pyx_t_28;
|
|
23541
23779
|
|
|
23542
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23780
|
+
/* "mettagrid/mettagrid.pyx":133
|
|
23543
23781
|
* elif map[r,c] == "altar":
|
|
23544
23782
|
* converter = new Altar(r, c, cfg.objects.altar)
|
|
23545
23783
|
* elif map[r,c] == "armory": # <<<<<<<<<<<<<<
|
|
@@ -23549,53 +23787,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23549
23787
|
goto __pyx_L28;
|
|
23550
23788
|
}
|
|
23551
23789
|
|
|
23552
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23790
|
+
/* "mettagrid/mettagrid.pyx":135
|
|
23553
23791
|
* elif map[r,c] == "armory":
|
|
23554
23792
|
* converter = new Armory(r, c, cfg.objects.armory)
|
|
23555
23793
|
* elif map[r,c] == "lasery": # <<<<<<<<<<<<<<
|
|
23556
23794
|
* converter = new Lasery(r, c, cfg.objects.lasery)
|
|
23557
23795
|
* elif map[r,c] == "lab":
|
|
23558
23796
|
*/
|
|
23559
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23797
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 135, __pyx_L1_error)
|
|
23560
23798
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23561
23799
|
__Pyx_INCREF(__pyx_v_r);
|
|
23562
23800
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23563
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23801
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 135, __pyx_L1_error);
|
|
23564
23802
|
__Pyx_INCREF(__pyx_v_c);
|
|
23565
23803
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23566
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23567
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23804
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 135, __pyx_L1_error);
|
|
23805
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 135, __pyx_L1_error)
|
|
23568
23806
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23569
23807
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23570
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_lasery, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23808
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_lasery, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 135, __pyx_L1_error)
|
|
23571
23809
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23572
23810
|
if (__pyx_t_6) {
|
|
23573
23811
|
|
|
23574
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23812
|
+
/* "mettagrid/mettagrid.pyx":136
|
|
23575
23813
|
* converter = new Armory(r, c, cfg.objects.armory)
|
|
23576
23814
|
* elif map[r,c] == "lasery":
|
|
23577
23815
|
* converter = new Lasery(r, c, cfg.objects.lasery) # <<<<<<<<<<<<<<
|
|
23578
23816
|
* elif map[r,c] == "lab":
|
|
23579
23817
|
* converter = new Lab(r, c, cfg.objects.lab)
|
|
23580
23818
|
*/
|
|
23581
|
-
|
|
23582
|
-
|
|
23583
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23819
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
|
|
23820
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
|
|
23821
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 136, __pyx_L1_error)
|
|
23584
23822
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23585
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_lasery); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23823
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_lasery); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 136, __pyx_L1_error)
|
|
23586
23824
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23587
23825
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23588
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23826
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L1_error)
|
|
23589
23827
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23590
23828
|
try {
|
|
23591
|
-
__pyx_t_29 = new Lasery(
|
|
23829
|
+
__pyx_t_29 = new Lasery(__pyx_t_22, __pyx_t_23, __pyx_t_24);
|
|
23592
23830
|
} catch(...) {
|
|
23593
23831
|
__Pyx_CppExn2PyErr();
|
|
23594
|
-
__PYX_ERR(0,
|
|
23832
|
+
__PYX_ERR(0, 136, __pyx_L1_error)
|
|
23595
23833
|
}
|
|
23596
23834
|
__pyx_v_converter = __pyx_t_29;
|
|
23597
23835
|
|
|
23598
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23836
|
+
/* "mettagrid/mettagrid.pyx":135
|
|
23599
23837
|
* elif map[r,c] == "armory":
|
|
23600
23838
|
* converter = new Armory(r, c, cfg.objects.armory)
|
|
23601
23839
|
* elif map[r,c] == "lasery": # <<<<<<<<<<<<<<
|
|
@@ -23605,53 +23843,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23605
23843
|
goto __pyx_L28;
|
|
23606
23844
|
}
|
|
23607
23845
|
|
|
23608
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23846
|
+
/* "mettagrid/mettagrid.pyx":137
|
|
23609
23847
|
* elif map[r,c] == "lasery":
|
|
23610
23848
|
* converter = new Lasery(r, c, cfg.objects.lasery)
|
|
23611
23849
|
* elif map[r,c] == "lab": # <<<<<<<<<<<<<<
|
|
23612
23850
|
* converter = new Lab(r, c, cfg.objects.lab)
|
|
23613
23851
|
* elif map[r,c] == "factory":
|
|
23614
23852
|
*/
|
|
23615
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23853
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 137, __pyx_L1_error)
|
|
23616
23854
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23617
23855
|
__Pyx_INCREF(__pyx_v_r);
|
|
23618
23856
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23619
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23857
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 137, __pyx_L1_error);
|
|
23620
23858
|
__Pyx_INCREF(__pyx_v_c);
|
|
23621
23859
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23622
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23623
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23860
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 137, __pyx_L1_error);
|
|
23861
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 137, __pyx_L1_error)
|
|
23624
23862
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23625
23863
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23626
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_lab, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23864
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_lab, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 137, __pyx_L1_error)
|
|
23627
23865
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23628
23866
|
if (__pyx_t_6) {
|
|
23629
23867
|
|
|
23630
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23868
|
+
/* "mettagrid/mettagrid.pyx":138
|
|
23631
23869
|
* converter = new Lasery(r, c, cfg.objects.lasery)
|
|
23632
23870
|
* elif map[r,c] == "lab":
|
|
23633
23871
|
* converter = new Lab(r, c, cfg.objects.lab) # <<<<<<<<<<<<<<
|
|
23634
23872
|
* elif map[r,c] == "factory":
|
|
23635
23873
|
* converter = new Factory(r, c, cfg.objects.factory)
|
|
23636
23874
|
*/
|
|
23637
|
-
|
|
23638
|
-
|
|
23639
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23875
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
|
|
23876
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
|
|
23877
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 138, __pyx_L1_error)
|
|
23640
23878
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23641
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_lab); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23879
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_lab); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 138, __pyx_L1_error)
|
|
23642
23880
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23643
23881
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23644
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23882
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L1_error)
|
|
23645
23883
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23646
23884
|
try {
|
|
23647
|
-
__pyx_t_30 = new Lab(
|
|
23885
|
+
__pyx_t_30 = new Lab(__pyx_t_23, __pyx_t_22, __pyx_t_24);
|
|
23648
23886
|
} catch(...) {
|
|
23649
23887
|
__Pyx_CppExn2PyErr();
|
|
23650
|
-
__PYX_ERR(0,
|
|
23888
|
+
__PYX_ERR(0, 138, __pyx_L1_error)
|
|
23651
23889
|
}
|
|
23652
23890
|
__pyx_v_converter = __pyx_t_30;
|
|
23653
23891
|
|
|
23654
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23892
|
+
/* "mettagrid/mettagrid.pyx":137
|
|
23655
23893
|
* elif map[r,c] == "lasery":
|
|
23656
23894
|
* converter = new Lasery(r, c, cfg.objects.lasery)
|
|
23657
23895
|
* elif map[r,c] == "lab": # <<<<<<<<<<<<<<
|
|
@@ -23661,53 +23899,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23661
23899
|
goto __pyx_L28;
|
|
23662
23900
|
}
|
|
23663
23901
|
|
|
23664
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23902
|
+
/* "mettagrid/mettagrid.pyx":139
|
|
23665
23903
|
* elif map[r,c] == "lab":
|
|
23666
23904
|
* converter = new Lab(r, c, cfg.objects.lab)
|
|
23667
23905
|
* elif map[r,c] == "factory": # <<<<<<<<<<<<<<
|
|
23668
23906
|
* converter = new Factory(r, c, cfg.objects.factory)
|
|
23669
23907
|
* elif map[r,c] == "temple":
|
|
23670
23908
|
*/
|
|
23671
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23909
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L1_error)
|
|
23672
23910
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23673
23911
|
__Pyx_INCREF(__pyx_v_r);
|
|
23674
23912
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23675
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23913
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 139, __pyx_L1_error);
|
|
23676
23914
|
__Pyx_INCREF(__pyx_v_c);
|
|
23677
23915
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23678
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23679
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23916
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 139, __pyx_L1_error);
|
|
23917
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 139, __pyx_L1_error)
|
|
23680
23918
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23681
23919
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23682
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_factory, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23920
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_factory, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 139, __pyx_L1_error)
|
|
23683
23921
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23684
23922
|
if (__pyx_t_6) {
|
|
23685
23923
|
|
|
23686
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23924
|
+
/* "mettagrid/mettagrid.pyx":140
|
|
23687
23925
|
* converter = new Lab(r, c, cfg.objects.lab)
|
|
23688
23926
|
* elif map[r,c] == "factory":
|
|
23689
23927
|
* converter = new Factory(r, c, cfg.objects.factory) # <<<<<<<<<<<<<<
|
|
23690
23928
|
* elif map[r,c] == "temple":
|
|
23691
23929
|
* converter = new Temple(r, c, cfg.objects.temple)
|
|
23692
23930
|
*/
|
|
23693
|
-
|
|
23694
|
-
|
|
23695
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23931
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
|
|
23932
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
|
|
23933
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 140, __pyx_L1_error)
|
|
23696
23934
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23697
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_factory); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23935
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_factory); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 140, __pyx_L1_error)
|
|
23698
23936
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23699
23937
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23700
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23938
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L1_error)
|
|
23701
23939
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23702
23940
|
try {
|
|
23703
|
-
__pyx_t_31 = new Factory(
|
|
23941
|
+
__pyx_t_31 = new Factory(__pyx_t_22, __pyx_t_23, __pyx_t_24);
|
|
23704
23942
|
} catch(...) {
|
|
23705
23943
|
__Pyx_CppExn2PyErr();
|
|
23706
|
-
__PYX_ERR(0,
|
|
23944
|
+
__PYX_ERR(0, 140, __pyx_L1_error)
|
|
23707
23945
|
}
|
|
23708
23946
|
__pyx_v_converter = __pyx_t_31;
|
|
23709
23947
|
|
|
23710
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23948
|
+
/* "mettagrid/mettagrid.pyx":139
|
|
23711
23949
|
* elif map[r,c] == "lab":
|
|
23712
23950
|
* converter = new Lab(r, c, cfg.objects.lab)
|
|
23713
23951
|
* elif map[r,c] == "factory": # <<<<<<<<<<<<<<
|
|
@@ -23717,53 +23955,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23717
23955
|
goto __pyx_L28;
|
|
23718
23956
|
}
|
|
23719
23957
|
|
|
23720
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23958
|
+
/* "mettagrid/mettagrid.pyx":141
|
|
23721
23959
|
* elif map[r,c] == "factory":
|
|
23722
23960
|
* converter = new Factory(r, c, cfg.objects.factory)
|
|
23723
23961
|
* elif map[r,c] == "temple": # <<<<<<<<<<<<<<
|
|
23724
23962
|
* converter = new Temple(r, c, cfg.objects.temple)
|
|
23725
23963
|
*
|
|
23726
23964
|
*/
|
|
23727
|
-
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23965
|
+
__pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 141, __pyx_L1_error)
|
|
23728
23966
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23729
23967
|
__Pyx_INCREF(__pyx_v_r);
|
|
23730
23968
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23731
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
23969
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_v_r)) __PYX_ERR(0, 141, __pyx_L1_error);
|
|
23732
23970
|
__Pyx_INCREF(__pyx_v_c);
|
|
23733
23971
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23734
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23735
|
-
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23972
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_c)) __PYX_ERR(0, 141, __pyx_L1_error);
|
|
23973
|
+
__pyx_t_11 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 141, __pyx_L1_error)
|
|
23736
23974
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23737
23975
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23738
|
-
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_temple, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
23976
|
+
__pyx_t_6 = (__Pyx_PyUnicode_Equals(__pyx_t_11, __pyx_n_u_temple, Py_EQ)); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 141, __pyx_L1_error)
|
|
23739
23977
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23740
23978
|
if (__pyx_t_6) {
|
|
23741
23979
|
|
|
23742
|
-
/* "mettagrid/mettagrid.pyx":
|
|
23980
|
+
/* "mettagrid/mettagrid.pyx":142
|
|
23743
23981
|
* converter = new Factory(r, c, cfg.objects.factory)
|
|
23744
23982
|
* elif map[r,c] == "temple":
|
|
23745
23983
|
* converter = new Temple(r, c, cfg.objects.temple) # <<<<<<<<<<<<<<
|
|
23746
23984
|
*
|
|
23747
23985
|
* elif map[r,c].startswith("agent."):
|
|
23748
23986
|
*/
|
|
23749
|
-
|
|
23750
|
-
|
|
23751
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
23987
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
|
|
23988
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
|
|
23989
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_objects); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 142, __pyx_L1_error)
|
|
23752
23990
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23753
|
-
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_temple); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
23991
|
+
__pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_temple); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 142, __pyx_L1_error)
|
|
23754
23992
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23755
23993
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23756
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
23994
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_t_10); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L1_error)
|
|
23757
23995
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23758
23996
|
try {
|
|
23759
|
-
__pyx_t_32 = new Temple(
|
|
23997
|
+
__pyx_t_32 = new Temple(__pyx_t_23, __pyx_t_22, __pyx_t_24);
|
|
23760
23998
|
} catch(...) {
|
|
23761
23999
|
__Pyx_CppExn2PyErr();
|
|
23762
|
-
__PYX_ERR(0,
|
|
24000
|
+
__PYX_ERR(0, 142, __pyx_L1_error)
|
|
23763
24001
|
}
|
|
23764
24002
|
__pyx_v_converter = __pyx_t_32;
|
|
23765
24003
|
|
|
23766
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24004
|
+
/* "mettagrid/mettagrid.pyx":141
|
|
23767
24005
|
* elif map[r,c] == "factory":
|
|
23768
24006
|
* converter = new Factory(r, c, cfg.objects.factory)
|
|
23769
24007
|
* elif map[r,c] == "temple": # <<<<<<<<<<<<<<
|
|
@@ -23773,25 +24011,25 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23773
24011
|
goto __pyx_L28;
|
|
23774
24012
|
}
|
|
23775
24013
|
|
|
23776
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24014
|
+
/* "mettagrid/mettagrid.pyx":144
|
|
23777
24015
|
* converter = new Temple(r, c, cfg.objects.temple)
|
|
23778
24016
|
*
|
|
23779
24017
|
* elif map[r,c].startswith("agent."): # <<<<<<<<<<<<<<
|
|
23780
24018
|
* group_name = map[r,c].split(".")[1]
|
|
23781
24019
|
* agent_cfg = OmegaConf.to_container(OmegaConf.merge(
|
|
23782
24020
|
*/
|
|
23783
|
-
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24021
|
+
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
23784
24022
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23785
24023
|
__Pyx_INCREF(__pyx_v_r);
|
|
23786
24024
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23787
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
24025
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0, 144, __pyx_L1_error);
|
|
23788
24026
|
__Pyx_INCREF(__pyx_v_c);
|
|
23789
24027
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23790
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23791
|
-
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24028
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0, 144, __pyx_L1_error);
|
|
24029
|
+
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
23792
24030
|
__Pyx_GOTREF(__pyx_t_1);
|
|
23793
24031
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23794
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24032
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_startswith); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
23795
24033
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23796
24034
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23797
24035
|
__pyx_t_1 = NULL;
|
|
@@ -23812,33 +24050,33 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23812
24050
|
PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u_agent};
|
|
23813
24051
|
__pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
23814
24052
|
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23815
|
-
if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24053
|
+
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
23816
24054
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23817
24055
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23818
24056
|
}
|
|
23819
|
-
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0,
|
|
24057
|
+
__pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely((__pyx_t_6 < 0))) __PYX_ERR(0, 144, __pyx_L1_error)
|
|
23820
24058
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23821
24059
|
if (__pyx_t_6) {
|
|
23822
24060
|
|
|
23823
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24061
|
+
/* "mettagrid/mettagrid.pyx":145
|
|
23824
24062
|
*
|
|
23825
24063
|
* elif map[r,c].startswith("agent."):
|
|
23826
24064
|
* group_name = map[r,c].split(".")[1] # <<<<<<<<<<<<<<
|
|
23827
24065
|
* agent_cfg = OmegaConf.to_container(OmegaConf.merge(
|
|
23828
24066
|
* cfg.agent, cfg.groups[group_name].props))
|
|
23829
24067
|
*/
|
|
23830
|
-
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24068
|
+
__pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23831
24069
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23832
24070
|
__Pyx_INCREF(__pyx_v_r);
|
|
23833
24071
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
23834
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
24072
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_r)) __PYX_ERR(0, 145, __pyx_L1_error);
|
|
23835
24073
|
__Pyx_INCREF(__pyx_v_c);
|
|
23836
24074
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
23837
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
23838
|
-
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24075
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_v_c)) __PYX_ERR(0, 145, __pyx_L1_error);
|
|
24076
|
+
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_11); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23839
24077
|
__Pyx_GOTREF(__pyx_t_1);
|
|
23840
24078
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23841
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24079
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_split); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23842
24080
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23843
24081
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23844
24082
|
__pyx_t_1 = NULL;
|
|
@@ -23859,53 +24097,53 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23859
24097
|
PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_kp_u__2};
|
|
23860
24098
|
__pyx_t_10 = __Pyx_PyObject_FastCall(__pyx_t_11, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
23861
24099
|
__Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23862
|
-
if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24100
|
+
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23863
24101
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23864
24102
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23865
24103
|
}
|
|
23866
|
-
__pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24104
|
+
__pyx_t_11 = __Pyx_GetItemInt(__pyx_t_10, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 0); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23867
24105
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23868
24106
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23869
|
-
__pyx_t_33 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
24107
|
+
__pyx_t_33 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_t_11); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L1_error)
|
|
23870
24108
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
23871
24109
|
__pyx_v_group_name = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_33);
|
|
23872
24110
|
|
|
23873
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24111
|
+
/* "mettagrid/mettagrid.pyx":146
|
|
23874
24112
|
* elif map[r,c].startswith("agent."):
|
|
23875
24113
|
* group_name = map[r,c].split(".")[1]
|
|
23876
24114
|
* agent_cfg = OmegaConf.to_container(OmegaConf.merge( # <<<<<<<<<<<<<<
|
|
23877
24115
|
* cfg.agent, cfg.groups[group_name].props))
|
|
23878
24116
|
* rewards = agent_cfg.get("rewards", {})
|
|
23879
24117
|
*/
|
|
23880
|
-
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_OmegaConf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24118
|
+
__Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_OmegaConf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23881
24119
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23882
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_to_container); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24120
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_to_container); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23883
24121
|
__Pyx_GOTREF(__pyx_t_1);
|
|
23884
24122
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23885
|
-
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_OmegaConf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
24123
|
+
__Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_OmegaConf); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23886
24124
|
__Pyx_GOTREF(__pyx_t_4);
|
|
23887
|
-
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_merge); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24125
|
+
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_merge); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23888
24126
|
__Pyx_GOTREF(__pyx_t_8);
|
|
23889
24127
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
23890
24128
|
|
|
23891
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24129
|
+
/* "mettagrid/mettagrid.pyx":147
|
|
23892
24130
|
* group_name = map[r,c].split(".")[1]
|
|
23893
24131
|
* agent_cfg = OmegaConf.to_container(OmegaConf.merge(
|
|
23894
24132
|
* cfg.agent, cfg.groups[group_name].props)) # <<<<<<<<<<<<<<
|
|
23895
24133
|
* rewards = agent_cfg.get("rewards", {})
|
|
23896
24134
|
* del agent_cfg["rewards"]
|
|
23897
24135
|
*/
|
|
23898
|
-
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_agent_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
24136
|
+
__pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_agent_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 147, __pyx_L1_error)
|
|
23899
24137
|
__Pyx_GOTREF(__pyx_t_4);
|
|
23900
|
-
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_groups); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
24138
|
+
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_groups); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error)
|
|
23901
24139
|
__Pyx_GOTREF(__pyx_t_2);
|
|
23902
|
-
__pyx_t_3 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_group_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
24140
|
+
__pyx_t_3 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_group_name); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
|
|
23903
24141
|
__Pyx_GOTREF(__pyx_t_3);
|
|
23904
|
-
__pyx_t_34 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_34)) __PYX_ERR(0,
|
|
24142
|
+
__pyx_t_34 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_34)) __PYX_ERR(0, 147, __pyx_L1_error)
|
|
23905
24143
|
__Pyx_GOTREF(__pyx_t_34);
|
|
23906
24144
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
23907
24145
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
23908
|
-
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_34, __pyx_n_s_props); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
24146
|
+
__pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_34, __pyx_n_s_props); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 147, __pyx_L1_error)
|
|
23909
24147
|
__Pyx_GOTREF(__pyx_t_3);
|
|
23910
24148
|
__Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0;
|
|
23911
24149
|
__pyx_t_34 = NULL;
|
|
@@ -23928,7 +24166,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23928
24166
|
__Pyx_XDECREF(__pyx_t_34); __pyx_t_34 = 0;
|
|
23929
24167
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
23930
24168
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
23931
|
-
if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24169
|
+
if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23932
24170
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23933
24171
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
23934
24172
|
}
|
|
@@ -23951,23 +24189,23 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23951
24189
|
__pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
23952
24190
|
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
23953
24191
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23954
|
-
if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24192
|
+
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 146, __pyx_L1_error)
|
|
23955
24193
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23956
24194
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23957
24195
|
}
|
|
23958
24196
|
__Pyx_XDECREF_SET(__pyx_v_agent_cfg, __pyx_t_11);
|
|
23959
24197
|
__pyx_t_11 = 0;
|
|
23960
24198
|
|
|
23961
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24199
|
+
/* "mettagrid/mettagrid.pyx":148
|
|
23962
24200
|
* agent_cfg = OmegaConf.to_container(OmegaConf.merge(
|
|
23963
24201
|
* cfg.agent, cfg.groups[group_name].props))
|
|
23964
24202
|
* rewards = agent_cfg.get("rewards", {}) # <<<<<<<<<<<<<<
|
|
23965
24203
|
* del agent_cfg["rewards"]
|
|
23966
24204
|
* for inv_item in InventoryItemNames:
|
|
23967
24205
|
*/
|
|
23968
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_agent_cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24206
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_agent_cfg, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
|
|
23969
24207
|
__Pyx_GOTREF(__pyx_t_1);
|
|
23970
|
-
__pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24208
|
+
__pyx_t_10 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 148, __pyx_L1_error)
|
|
23971
24209
|
__Pyx_GOTREF(__pyx_t_10);
|
|
23972
24210
|
__pyx_t_8 = NULL;
|
|
23973
24211
|
__pyx_t_5 = 0;
|
|
@@ -23988,23 +24226,23 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
23988
24226
|
__pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
|
|
23989
24227
|
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
23990
24228
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
23991
|
-
if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24229
|
+
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 148, __pyx_L1_error)
|
|
23992
24230
|
__Pyx_GOTREF(__pyx_t_11);
|
|
23993
24231
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
23994
24232
|
}
|
|
23995
24233
|
__Pyx_XDECREF_SET(__pyx_v_rewards, __pyx_t_11);
|
|
23996
24234
|
__pyx_t_11 = 0;
|
|
23997
24235
|
|
|
23998
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24236
|
+
/* "mettagrid/mettagrid.pyx":149
|
|
23999
24237
|
* cfg.agent, cfg.groups[group_name].props))
|
|
24000
24238
|
* rewards = agent_cfg.get("rewards", {})
|
|
24001
24239
|
* del agent_cfg["rewards"] # <<<<<<<<<<<<<<
|
|
24002
24240
|
* for inv_item in InventoryItemNames:
|
|
24003
24241
|
* rewards[inv_item] = rewards.get(inv_item, 0)
|
|
24004
24242
|
*/
|
|
24005
|
-
if (unlikely((PyObject_DelItem(__pyx_v_agent_cfg, __pyx_n_u_rewards) < 0))) __PYX_ERR(0,
|
|
24243
|
+
if (unlikely((PyObject_DelItem(__pyx_v_agent_cfg, __pyx_n_u_rewards) < 0))) __PYX_ERR(0, 149, __pyx_L1_error)
|
|
24006
24244
|
|
|
24007
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24245
|
+
/* "mettagrid/mettagrid.pyx":150
|
|
24008
24246
|
* rewards = agent_cfg.get("rewards", {})
|
|
24009
24247
|
* del agent_cfg["rewards"]
|
|
24010
24248
|
* for inv_item in InventoryItemNames: # <<<<<<<<<<<<<<
|
|
@@ -24018,16 +24256,16 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24018
24256
|
++__pyx_t_35;
|
|
24019
24257
|
__pyx_v_inv_item = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_33);
|
|
24020
24258
|
|
|
24021
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24259
|
+
/* "mettagrid/mettagrid.pyx":151
|
|
24022
24260
|
* del agent_cfg["rewards"]
|
|
24023
24261
|
* for inv_item in InventoryItemNames:
|
|
24024
24262
|
* rewards[inv_item] = rewards.get(inv_item, 0) # <<<<<<<<<<<<<<
|
|
24025
24263
|
* rewards[inv_item + "_max"] = rewards.get(inv_item + "_max", 1000)
|
|
24026
24264
|
* group_id = cfg.groups[group_name].id
|
|
24027
24265
|
*/
|
|
24028
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rewards, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24266
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rewards, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
|
|
24029
24267
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24030
|
-
__pyx_t_10 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24268
|
+
__pyx_t_10 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 151, __pyx_L1_error)
|
|
24031
24269
|
__Pyx_GOTREF(__pyx_t_10);
|
|
24032
24270
|
__pyx_t_8 = NULL;
|
|
24033
24271
|
__pyx_t_5 = 0;
|
|
@@ -24048,28 +24286,28 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24048
24286
|
__pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
|
|
24049
24287
|
__Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24050
24288
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
24051
|
-
if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24289
|
+
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error)
|
|
24052
24290
|
__Pyx_GOTREF(__pyx_t_11);
|
|
24053
24291
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24054
24292
|
}
|
|
24055
|
-
__pyx_t_1 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24293
|
+
__pyx_t_1 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 151, __pyx_L1_error)
|
|
24056
24294
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24057
|
-
if (unlikely((PyObject_SetItem(__pyx_v_rewards, __pyx_t_1, __pyx_t_11) < 0))) __PYX_ERR(0,
|
|
24295
|
+
if (unlikely((PyObject_SetItem(__pyx_v_rewards, __pyx_t_1, __pyx_t_11) < 0))) __PYX_ERR(0, 151, __pyx_L1_error)
|
|
24058
24296
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24059
24297
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
24060
24298
|
|
|
24061
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24299
|
+
/* "mettagrid/mettagrid.pyx":152
|
|
24062
24300
|
* for inv_item in InventoryItemNames:
|
|
24063
24301
|
* rewards[inv_item] = rewards.get(inv_item, 0)
|
|
24064
24302
|
* rewards[inv_item + "_max"] = rewards.get(inv_item + "_max", 1000) # <<<<<<<<<<<<<<
|
|
24065
24303
|
* group_id = cfg.groups[group_name].id
|
|
24066
24304
|
* agent = new Agent(
|
|
24067
24305
|
*/
|
|
24068
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rewards, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24306
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_rewards, __pyx_n_s_get); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24069
24307
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24070
|
-
__pyx_t_10 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_10)) __PYX_ERR(0,
|
|
24308
|
+
__pyx_t_10 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24071
24309
|
__Pyx_GOTREF(__pyx_t_10);
|
|
24072
|
-
__pyx_t_8 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_10, __pyx_n_u_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24310
|
+
__pyx_t_8 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_10, __pyx_n_u_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24073
24311
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24074
24312
|
__Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
24075
24313
|
__pyx_t_10 = NULL;
|
|
@@ -24091,20 +24329,20 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24091
24329
|
__pyx_t_11 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_5, 2+__pyx_t_5);
|
|
24092
24330
|
__Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
|
|
24093
24331
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24094
|
-
if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24332
|
+
if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24095
24333
|
__Pyx_GOTREF(__pyx_t_11);
|
|
24096
24334
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24097
24335
|
}
|
|
24098
|
-
__pyx_t_1 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24336
|
+
__pyx_t_1 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_inv_item); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24099
24337
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24100
|
-
__pyx_t_8 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_n_u_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24338
|
+
__pyx_t_8 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_1, __pyx_n_u_max); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24101
24339
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24102
24340
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24103
|
-
if (unlikely((PyObject_SetItem(__pyx_v_rewards, __pyx_t_8, __pyx_t_11) < 0))) __PYX_ERR(0,
|
|
24341
|
+
if (unlikely((PyObject_SetItem(__pyx_v_rewards, __pyx_t_8, __pyx_t_11) < 0))) __PYX_ERR(0, 152, __pyx_L1_error)
|
|
24104
24342
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24105
24343
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
24106
24344
|
|
|
24107
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24345
|
+
/* "mettagrid/mettagrid.pyx":150
|
|
24108
24346
|
* rewards = agent_cfg.get("rewards", {})
|
|
24109
24347
|
* del agent_cfg["rewards"]
|
|
24110
24348
|
* for inv_item in InventoryItemNames: # <<<<<<<<<<<<<<
|
|
@@ -24113,50 +24351,50 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24113
24351
|
*/
|
|
24114
24352
|
}
|
|
24115
24353
|
|
|
24116
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24354
|
+
/* "mettagrid/mettagrid.pyx":153
|
|
24117
24355
|
* rewards[inv_item] = rewards.get(inv_item, 0)
|
|
24118
24356
|
* rewards[inv_item + "_max"] = rewards.get(inv_item + "_max", 1000)
|
|
24119
24357
|
* group_id = cfg.groups[group_name].id # <<<<<<<<<<<<<<
|
|
24120
24358
|
* agent = new Agent(
|
|
24121
24359
|
* r, c, group_name, group_id, agent_cfg, rewards)
|
|
24122
24360
|
*/
|
|
24123
|
-
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_groups); if (unlikely(!__pyx_t_11)) __PYX_ERR(0,
|
|
24361
|
+
__pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_cfg, __pyx_n_s_groups); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 153, __pyx_L1_error)
|
|
24124
24362
|
__Pyx_GOTREF(__pyx_t_11);
|
|
24125
|
-
__pyx_t_8 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_group_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24363
|
+
__pyx_t_8 = __pyx_convert_PyStr_string_to_py_6libcpp_6string_std__in_string(__pyx_v_group_name); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 153, __pyx_L1_error)
|
|
24126
24364
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24127
|
-
__pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24365
|
+
__pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_t_11, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
|
|
24128
24366
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24129
24367
|
__Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
|
|
24130
24368
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24131
|
-
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24369
|
+
__pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 153, __pyx_L1_error)
|
|
24132
24370
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24133
24371
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24134
|
-
__pyx_t_36 = __Pyx_PyInt_As_unsigned_char(__pyx_t_8); if (unlikely((__pyx_t_36 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0,
|
|
24372
|
+
__pyx_t_36 = __Pyx_PyInt_As_unsigned_char(__pyx_t_8); if (unlikely((__pyx_t_36 == (unsigned char)-1) && PyErr_Occurred())) __PYX_ERR(0, 153, __pyx_L1_error)
|
|
24135
24373
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24136
24374
|
__pyx_v_group_id = __pyx_t_36;
|
|
24137
24375
|
|
|
24138
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24376
|
+
/* "mettagrid/mettagrid.pyx":155
|
|
24139
24377
|
* group_id = cfg.groups[group_name].id
|
|
24140
24378
|
* agent = new Agent(
|
|
24141
24379
|
* r, c, group_name, group_id, agent_cfg, rewards) # <<<<<<<<<<<<<<
|
|
24142
24380
|
* self._grid.add_object(agent)
|
|
24143
24381
|
* agent.agent_id = self._agents.size()
|
|
24144
24382
|
*/
|
|
24145
|
-
|
|
24146
|
-
|
|
24147
|
-
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_v_agent_cfg); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
24148
|
-
__pyx_t_37 = __pyx_convert_map_from_py_std_3a__3a_string__and_float(__pyx_v_rewards); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
24383
|
+
__pyx_t_22 = __Pyx_PyInt_As_GridCoord(__pyx_v_r); if (unlikely((__pyx_t_22 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
24384
|
+
__pyx_t_23 = __Pyx_PyInt_As_GridCoord(__pyx_v_c); if (unlikely((__pyx_t_23 == ((GridCoord)-1)) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
24385
|
+
__pyx_t_24 = __pyx_convert_map_from_py_std_3a__3a_string__and_int(__pyx_v_agent_cfg); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
24386
|
+
__pyx_t_37 = __pyx_convert_map_from_py_std_3a__3a_string__and_float(__pyx_v_rewards); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
|
|
24149
24387
|
|
|
24150
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24388
|
+
/* "mettagrid/mettagrid.pyx":154
|
|
24151
24389
|
* rewards[inv_item + "_max"] = rewards.get(inv_item + "_max", 1000)
|
|
24152
24390
|
* group_id = cfg.groups[group_name].id
|
|
24153
24391
|
* agent = new Agent( # <<<<<<<<<<<<<<
|
|
24154
24392
|
* r, c, group_name, group_id, agent_cfg, rewards)
|
|
24155
24393
|
* self._grid.add_object(agent)
|
|
24156
24394
|
*/
|
|
24157
|
-
__pyx_v_agent = new Agent(
|
|
24395
|
+
__pyx_v_agent = new Agent(__pyx_t_22, __pyx_t_23, __pyx_v_group_name, __pyx_v_group_id, __pyx_t_24, __pyx_t_37);
|
|
24158
24396
|
|
|
24159
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24397
|
+
/* "mettagrid/mettagrid.pyx":156
|
|
24160
24398
|
* agent = new Agent(
|
|
24161
24399
|
* r, c, group_name, group_id, agent_cfg, rewards)
|
|
24162
24400
|
* self._grid.add_object(agent) # <<<<<<<<<<<<<<
|
|
@@ -24165,7 +24403,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24165
24403
|
*/
|
|
24166
24404
|
(void)(__pyx_v_self->__pyx_base._grid->add_object(__pyx_v_agent));
|
|
24167
24405
|
|
|
24168
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24406
|
+
/* "mettagrid/mettagrid.pyx":157
|
|
24169
24407
|
* r, c, group_name, group_id, agent_cfg, rewards)
|
|
24170
24408
|
* self._grid.add_object(agent)
|
|
24171
24409
|
* agent.agent_id = self._agents.size() # <<<<<<<<<<<<<<
|
|
@@ -24174,16 +24412,16 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24174
24412
|
*/
|
|
24175
24413
|
__pyx_v_agent->agent_id = __pyx_v_self->__pyx_base._agents.size();
|
|
24176
24414
|
|
|
24177
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24415
|
+
/* "mettagrid/mettagrid.pyx":158
|
|
24178
24416
|
* self._grid.add_object(agent)
|
|
24179
24417
|
* agent.agent_id = self._agents.size()
|
|
24180
24418
|
* self.add_agent(agent) # <<<<<<<<<<<<<<
|
|
24181
24419
|
* self._group_sizes[group_id] += 1
|
|
24182
24420
|
*
|
|
24183
24421
|
*/
|
|
24184
|
-
((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.add_agent(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), __pyx_v_agent); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
24422
|
+
((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.add_agent(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), __pyx_v_agent); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 158, __pyx_L1_error)
|
|
24185
24423
|
|
|
24186
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24424
|
+
/* "mettagrid/mettagrid.pyx":159
|
|
24187
24425
|
* agent.agent_id = self._agents.size()
|
|
24188
24426
|
* self.add_agent(agent)
|
|
24189
24427
|
* self._group_sizes[group_id] += 1 # <<<<<<<<<<<<<<
|
|
@@ -24193,7 +24431,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24193
24431
|
__pyx_t_36 = __pyx_v_group_id;
|
|
24194
24432
|
(__pyx_v_self->_group_sizes[__pyx_t_36]) = ((__pyx_v_self->_group_sizes[__pyx_t_36]) + 1);
|
|
24195
24433
|
|
|
24196
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24434
|
+
/* "mettagrid/mettagrid.pyx":144
|
|
24197
24435
|
* converter = new Temple(r, c, cfg.objects.temple)
|
|
24198
24436
|
*
|
|
24199
24437
|
* elif map[r,c].startswith("agent."): # <<<<<<<<<<<<<<
|
|
@@ -24203,7 +24441,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24203
24441
|
}
|
|
24204
24442
|
__pyx_L28:;
|
|
24205
24443
|
|
|
24206
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24444
|
+
/* "mettagrid/mettagrid.pyx":161
|
|
24207
24445
|
* self._group_sizes[group_id] += 1
|
|
24208
24446
|
*
|
|
24209
24447
|
* if converter != NULL: # <<<<<<<<<<<<<<
|
|
@@ -24213,41 +24451,41 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24213
24451
|
__pyx_t_6 = (__pyx_v_converter != NULL);
|
|
24214
24452
|
if (__pyx_t_6) {
|
|
24215
24453
|
|
|
24216
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24454
|
+
/* "mettagrid/mettagrid.pyx":162
|
|
24217
24455
|
*
|
|
24218
24456
|
* if converter != NULL:
|
|
24219
24457
|
* stat = "objects." + map[r,c] # <<<<<<<<<<<<<<
|
|
24220
24458
|
* self._stats.incr(stat)
|
|
24221
24459
|
* self._grid.add_object(converter)
|
|
24222
24460
|
*/
|
|
24223
|
-
__pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24461
|
+
__pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
24224
24462
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24225
24463
|
__Pyx_INCREF(__pyx_v_r);
|
|
24226
24464
|
__Pyx_GIVEREF(__pyx_v_r);
|
|
24227
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_r)) __PYX_ERR(0,
|
|
24465
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_r)) __PYX_ERR(0, 162, __pyx_L1_error);
|
|
24228
24466
|
__Pyx_INCREF(__pyx_v_c);
|
|
24229
24467
|
__Pyx_GIVEREF(__pyx_v_c);
|
|
24230
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_c)) __PYX_ERR(0,
|
|
24231
|
-
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24468
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_c)) __PYX_ERR(0, 162, __pyx_L1_error);
|
|
24469
|
+
__pyx_t_1 = __Pyx_PyObject_GetItem(__pyx_v_map, __pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
24232
24470
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24233
24471
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
24234
|
-
__pyx_t_8 = PyNumber_Add(__pyx_kp_u_objects_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
24472
|
+
__pyx_t_8 = PyNumber_Add(__pyx_kp_u_objects_2, __pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 162, __pyx_L1_error)
|
|
24235
24473
|
__Pyx_GOTREF(__pyx_t_8);
|
|
24236
24474
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24237
24475
|
__Pyx_XDECREF_SET(__pyx_v_stat, __pyx_t_8);
|
|
24238
24476
|
__pyx_t_8 = 0;
|
|
24239
24477
|
|
|
24240
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24478
|
+
/* "mettagrid/mettagrid.pyx":163
|
|
24241
24479
|
* if converter != NULL:
|
|
24242
24480
|
* stat = "objects." + map[r,c]
|
|
24243
24481
|
* self._stats.incr(stat) # <<<<<<<<<<<<<<
|
|
24244
24482
|
* self._grid.add_object(converter)
|
|
24245
24483
|
* converter.set_event_manager(&self._event_manager)
|
|
24246
24484
|
*/
|
|
24247
|
-
__pyx_t_33 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_stat); if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
24485
|
+
__pyx_t_33 = __pyx_convert_string_from_py_6libcpp_6string_std__in_string(__pyx_v_stat); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 163, __pyx_L1_error)
|
|
24248
24486
|
__pyx_v_self->__pyx_base._stats.incr(__pyx_t_33);
|
|
24249
24487
|
|
|
24250
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24488
|
+
/* "mettagrid/mettagrid.pyx":164
|
|
24251
24489
|
* stat = "objects." + map[r,c]
|
|
24252
24490
|
* self._stats.incr(stat)
|
|
24253
24491
|
* self._grid.add_object(converter) # <<<<<<<<<<<<<<
|
|
@@ -24256,7 +24494,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24256
24494
|
*/
|
|
24257
24495
|
(void)(__pyx_v_self->__pyx_base._grid->add_object(__pyx_v_converter));
|
|
24258
24496
|
|
|
24259
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24497
|
+
/* "mettagrid/mettagrid.pyx":165
|
|
24260
24498
|
* self._stats.incr(stat)
|
|
24261
24499
|
* self._grid.add_object(converter)
|
|
24262
24500
|
* converter.set_event_manager(&self._event_manager) # <<<<<<<<<<<<<<
|
|
@@ -24265,7 +24503,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24265
24503
|
*/
|
|
24266
24504
|
__pyx_v_converter->set_event_manager((&__pyx_v_self->__pyx_base._event_manager));
|
|
24267
24505
|
|
|
24268
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24506
|
+
/* "mettagrid/mettagrid.pyx":166
|
|
24269
24507
|
* self._grid.add_object(converter)
|
|
24270
24508
|
* converter.set_event_manager(&self._event_manager)
|
|
24271
24509
|
* converter = NULL # <<<<<<<<<<<<<<
|
|
@@ -24274,7 +24512,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24274
24512
|
*/
|
|
24275
24513
|
__pyx_v_converter = NULL;
|
|
24276
24514
|
|
|
24277
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24515
|
+
/* "mettagrid/mettagrid.pyx":161
|
|
24278
24516
|
* self._group_sizes[group_id] += 1
|
|
24279
24517
|
*
|
|
24280
24518
|
* if converter != NULL: # <<<<<<<<<<<<<<
|
|
@@ -24334,6 +24572,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24334
24572
|
__Pyx_XDECREF(__pyx_v_actions);
|
|
24335
24573
|
__Pyx_XDECREF(__pyx_v_r);
|
|
24336
24574
|
__Pyx_XDECREF(__pyx_v_c);
|
|
24575
|
+
__Pyx_XDECREF(__pyx_v_m);
|
|
24337
24576
|
__Pyx_XDECREF(__pyx_v_agent_cfg);
|
|
24338
24577
|
__Pyx_XDECREF(__pyx_v_rewards);
|
|
24339
24578
|
__Pyx_XDECREF(__pyx_v_stat);
|
|
@@ -24343,7 +24582,7 @@ static int __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid___init__(struct __pyx_ob
|
|
|
24343
24582
|
return __pyx_r;
|
|
24344
24583
|
}
|
|
24345
24584
|
|
|
24346
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24585
|
+
/* "mettagrid/mettagrid.pyx":170
|
|
24347
24586
|
*
|
|
24348
24587
|
*
|
|
24349
24588
|
* cpdef list[str] grid_features(self): # <<<<<<<<<<<<<<
|
|
@@ -24379,7 +24618,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(struc
|
|
|
24379
24618
|
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
|
|
24380
24619
|
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
|
|
24381
24620
|
#endif
|
|
24382
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_grid_features); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24621
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_grid_features); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
24383
24622
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24384
24623
|
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_9mettagrid_11mettagrid_c_9MettaGrid_3grid_features)) {
|
|
24385
24624
|
__Pyx_XDECREF(__pyx_r);
|
|
@@ -24402,11 +24641,11 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(struc
|
|
|
24402
24641
|
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
|
|
24403
24642
|
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
24404
24643
|
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
24405
|
-
if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
24644
|
+
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
24406
24645
|
__Pyx_GOTREF(__pyx_t_2);
|
|
24407
24646
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
24408
24647
|
}
|
|
24409
|
-
if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(0,
|
|
24648
|
+
if (!(likely(PyList_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_2))) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
24410
24649
|
__pyx_r = ((PyObject*)__pyx_t_2);
|
|
24411
24650
|
__pyx_t_2 = 0;
|
|
24412
24651
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
@@ -24425,7 +24664,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(struc
|
|
|
24425
24664
|
#endif
|
|
24426
24665
|
}
|
|
24427
24666
|
|
|
24428
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24667
|
+
/* "mettagrid/mettagrid.pyx":171
|
|
24429
24668
|
*
|
|
24430
24669
|
* cpdef list[str] grid_features(self):
|
|
24431
24670
|
* return self._grid_features # <<<<<<<<<<<<<<
|
|
@@ -24433,14 +24672,14 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(struc
|
|
|
24433
24672
|
* def render(self):
|
|
24434
24673
|
*/
|
|
24435
24674
|
__Pyx_XDECREF(__pyx_r);
|
|
24436
|
-
__pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_self->__pyx_base._grid_features); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24675
|
+
__pyx_t_1 = __pyx_convert_vector_to_py_std_3a__3a_string(__pyx_v_self->__pyx_base._grid_features); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
|
|
24437
24676
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24438
|
-
if (!(likely(PyList_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0,
|
|
24677
|
+
if (!(likely(PyList_CheckExact(__pyx_t_1)) || __Pyx_RaiseUnexpectedTypeError("list", __pyx_t_1))) __PYX_ERR(0, 171, __pyx_L1_error)
|
|
24439
24678
|
__pyx_r = ((PyObject*)__pyx_t_1);
|
|
24440
24679
|
__pyx_t_1 = 0;
|
|
24441
24680
|
goto __pyx_L0;
|
|
24442
24681
|
|
|
24443
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24682
|
+
/* "mettagrid/mettagrid.pyx":170
|
|
24444
24683
|
*
|
|
24445
24684
|
*
|
|
24446
24685
|
* cpdef list[str] grid_features(self): # <<<<<<<<<<<<<<
|
|
@@ -24512,7 +24751,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_2grid_features(str
|
|
|
24512
24751
|
int __pyx_clineno = 0;
|
|
24513
24752
|
__Pyx_RefNannySetupContext("grid_features", 1);
|
|
24514
24753
|
__Pyx_XDECREF(__pyx_r);
|
|
24515
|
-
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24754
|
+
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_features(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
24516
24755
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24517
24756
|
__pyx_r = __pyx_t_1;
|
|
24518
24757
|
__pyx_t_1 = 0;
|
|
@@ -24529,7 +24768,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_2grid_features(str
|
|
|
24529
24768
|
return __pyx_r;
|
|
24530
24769
|
}
|
|
24531
24770
|
|
|
24532
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24771
|
+
/* "mettagrid/mettagrid.pyx":173
|
|
24533
24772
|
* return self._grid_features
|
|
24534
24773
|
*
|
|
24535
24774
|
* def render(self): # <<<<<<<<<<<<<<
|
|
@@ -24593,37 +24832,37 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24593
24832
|
int __pyx_clineno = 0;
|
|
24594
24833
|
__Pyx_RefNannySetupContext("render", 1);
|
|
24595
24834
|
|
|
24596
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24835
|
+
/* "mettagrid/mettagrid.pyx":174
|
|
24597
24836
|
*
|
|
24598
24837
|
* def render(self):
|
|
24599
24838
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"]) # <<<<<<<<<<<<<<
|
|
24600
24839
|
* for r in grid:
|
|
24601
24840
|
* print("".join(r))
|
|
24602
24841
|
*/
|
|
24603
|
-
__pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24842
|
+
__pyx_t_1 = PyList_New(5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 174, __pyx_L1_error)
|
|
24604
24843
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24605
24844
|
__Pyx_INCREF(__pyx_n_u_A);
|
|
24606
24845
|
__Pyx_GIVEREF(__pyx_n_u_A);
|
|
24607
|
-
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_A)) __PYX_ERR(0,
|
|
24846
|
+
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_u_A)) __PYX_ERR(0, 174, __pyx_L1_error);
|
|
24608
24847
|
__Pyx_INCREF(__pyx_kp_u__12);
|
|
24609
24848
|
__Pyx_GIVEREF(__pyx_kp_u__12);
|
|
24610
|
-
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__12)) __PYX_ERR(0,
|
|
24849
|
+
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_u__12)) __PYX_ERR(0, 174, __pyx_L1_error);
|
|
24611
24850
|
__Pyx_INCREF(__pyx_n_u_g);
|
|
24612
24851
|
__Pyx_GIVEREF(__pyx_n_u_g);
|
|
24613
|
-
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_g)) __PYX_ERR(0,
|
|
24852
|
+
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_u_g)) __PYX_ERR(0, 174, __pyx_L1_error);
|
|
24614
24853
|
__Pyx_INCREF(__pyx_n_u_c);
|
|
24615
24854
|
__Pyx_GIVEREF(__pyx_n_u_c);
|
|
24616
|
-
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_c)) __PYX_ERR(0,
|
|
24855
|
+
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 3, __pyx_n_u_c)) __PYX_ERR(0, 174, __pyx_L1_error);
|
|
24617
24856
|
__Pyx_INCREF(__pyx_n_u_a);
|
|
24618
24857
|
__Pyx_GIVEREF(__pyx_n_u_a);
|
|
24619
|
-
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_a)) __PYX_ERR(0,
|
|
24620
|
-
__pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.render_ascii(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), ((PyObject*)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
24858
|
+
if (__Pyx_PyList_SET_ITEM(__pyx_t_1, 4, __pyx_n_u_a)) __PYX_ERR(0, 174, __pyx_L1_error);
|
|
24859
|
+
__pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.render_ascii(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), ((PyObject*)__pyx_t_1), 0)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 174, __pyx_L1_error)
|
|
24621
24860
|
__Pyx_GOTREF(__pyx_t_2);
|
|
24622
24861
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24623
24862
|
__pyx_v_grid = ((PyArrayObject *)__pyx_t_2);
|
|
24624
24863
|
__pyx_t_2 = 0;
|
|
24625
24864
|
|
|
24626
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24865
|
+
/* "mettagrid/mettagrid.pyx":175
|
|
24627
24866
|
* def render(self):
|
|
24628
24867
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"])
|
|
24629
24868
|
* for r in grid: # <<<<<<<<<<<<<<
|
|
@@ -24635,9 +24874,9 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24635
24874
|
__pyx_t_3 = 0;
|
|
24636
24875
|
__pyx_t_4 = NULL;
|
|
24637
24876
|
} else {
|
|
24638
|
-
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_grid)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
24877
|
+
__pyx_t_3 = -1; __pyx_t_2 = PyObject_GetIter(((PyObject *)__pyx_v_grid)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24639
24878
|
__Pyx_GOTREF(__pyx_t_2);
|
|
24640
|
-
__pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
24879
|
+
__pyx_t_4 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24641
24880
|
}
|
|
24642
24881
|
for (;;) {
|
|
24643
24882
|
if (likely(!__pyx_t_4)) {
|
|
@@ -24645,28 +24884,28 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24645
24884
|
{
|
|
24646
24885
|
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2);
|
|
24647
24886
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
24648
|
-
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0,
|
|
24887
|
+
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24649
24888
|
#endif
|
|
24650
24889
|
if (__pyx_t_3 >= __pyx_temp) break;
|
|
24651
24890
|
}
|
|
24652
24891
|
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
24653
|
-
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0,
|
|
24892
|
+
__pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24654
24893
|
#else
|
|
24655
|
-
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24894
|
+
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24656
24895
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24657
24896
|
#endif
|
|
24658
24897
|
} else {
|
|
24659
24898
|
{
|
|
24660
24899
|
Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2);
|
|
24661
24900
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
24662
|
-
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0,
|
|
24901
|
+
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24663
24902
|
#endif
|
|
24664
24903
|
if (__pyx_t_3 >= __pyx_temp) break;
|
|
24665
24904
|
}
|
|
24666
24905
|
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
24667
|
-
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0,
|
|
24906
|
+
__pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_3++; if (unlikely((0 < 0))) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24668
24907
|
#else
|
|
24669
|
-
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24908
|
+
__pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24670
24909
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24671
24910
|
#endif
|
|
24672
24911
|
}
|
|
@@ -24676,7 +24915,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24676
24915
|
PyObject* exc_type = PyErr_Occurred();
|
|
24677
24916
|
if (exc_type) {
|
|
24678
24917
|
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
|
24679
|
-
else __PYX_ERR(0,
|
|
24918
|
+
else __PYX_ERR(0, 175, __pyx_L1_error)
|
|
24680
24919
|
}
|
|
24681
24920
|
break;
|
|
24682
24921
|
}
|
|
@@ -24685,21 +24924,21 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24685
24924
|
__Pyx_XDECREF_SET(__pyx_v_r, __pyx_t_1);
|
|
24686
24925
|
__pyx_t_1 = 0;
|
|
24687
24926
|
|
|
24688
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24927
|
+
/* "mettagrid/mettagrid.pyx":176
|
|
24689
24928
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"])
|
|
24690
24929
|
* for r in grid:
|
|
24691
24930
|
* print("".join(r)) # <<<<<<<<<<<<<<
|
|
24692
24931
|
*
|
|
24693
24932
|
* cpdef grid_objects(self):
|
|
24694
24933
|
*/
|
|
24695
|
-
__pyx_t_1 = PyUnicode_Join(__pyx_kp_u__13, __pyx_v_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
24934
|
+
__pyx_t_1 = PyUnicode_Join(__pyx_kp_u__13, __pyx_v_r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 176, __pyx_L1_error)
|
|
24696
24935
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24697
|
-
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0,
|
|
24936
|
+
__pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_print, __pyx_t_1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __pyx_L1_error)
|
|
24698
24937
|
__Pyx_GOTREF(__pyx_t_5);
|
|
24699
24938
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24700
24939
|
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
|
|
24701
24940
|
|
|
24702
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24941
|
+
/* "mettagrid/mettagrid.pyx":175
|
|
24703
24942
|
* def render(self):
|
|
24704
24943
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"])
|
|
24705
24944
|
* for r in grid: # <<<<<<<<<<<<<<
|
|
@@ -24709,7 +24948,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24709
24948
|
}
|
|
24710
24949
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
24711
24950
|
|
|
24712
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24951
|
+
/* "mettagrid/mettagrid.pyx":173
|
|
24713
24952
|
* return self._grid_features
|
|
24714
24953
|
*
|
|
24715
24954
|
* def render(self): # <<<<<<<<<<<<<<
|
|
@@ -24734,7 +24973,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_4render(struct __p
|
|
|
24734
24973
|
return __pyx_r;
|
|
24735
24974
|
}
|
|
24736
24975
|
|
|
24737
|
-
/* "mettagrid/mettagrid.pyx":
|
|
24976
|
+
/* "mettagrid/mettagrid.pyx":178
|
|
24738
24977
|
* print("".join(r))
|
|
24739
24978
|
*
|
|
24740
24979
|
* cpdef grid_objects(self): # <<<<<<<<<<<<<<
|
|
@@ -24791,7 +25030,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24791
25030
|
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
|
|
24792
25031
|
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
|
|
24793
25032
|
#endif
|
|
24794
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_grid_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25033
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_grid_objects); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
24795
25034
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24796
25035
|
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_9mettagrid_11mettagrid_c_9MettaGrid_7grid_objects)) {
|
|
24797
25036
|
__Pyx_XDECREF(__pyx_r);
|
|
@@ -24814,7 +25053,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24814
25053
|
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
|
|
24815
25054
|
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
24816
25055
|
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
24817
|
-
if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25056
|
+
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
24818
25057
|
__Pyx_GOTREF(__pyx_t_2);
|
|
24819
25058
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
24820
25059
|
}
|
|
@@ -24836,51 +25075,51 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24836
25075
|
#endif
|
|
24837
25076
|
}
|
|
24838
25077
|
|
|
24839
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25078
|
+
/* "mettagrid/mettagrid.pyx":180
|
|
24840
25079
|
* cpdef grid_objects(self):
|
|
24841
25080
|
* cdef GridObject *obj
|
|
24842
25081
|
* cdef ObsType[:] obj_data = np.zeros(len(self.grid_features()), dtype=self._obs_encoder.obs_np_type()) # <<<<<<<<<<<<<<
|
|
24843
25082
|
* cdef unsigned int obj_id, i
|
|
24844
25083
|
* cdef ObservationEncoder obs_encoder = self._obs_encoder
|
|
24845
25084
|
*/
|
|
24846
|
-
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25085
|
+
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24847
25086
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24848
|
-
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25087
|
+
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24849
25088
|
__Pyx_GOTREF(__pyx_t_2);
|
|
24850
25089
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24851
|
-
__pyx_t_1 = ((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grid_features(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25090
|
+
__pyx_t_1 = ((struct __pyx_vtabstruct_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grid_features(((struct __pyx_obj_9mettagrid_8grid_env_GridEnv *)__pyx_v_self), 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24852
25091
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24853
25092
|
if (unlikely(__pyx_t_1 == Py_None)) {
|
|
24854
25093
|
PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()");
|
|
24855
|
-
__PYX_ERR(0,
|
|
25094
|
+
__PYX_ERR(0, 180, __pyx_L1_error)
|
|
24856
25095
|
}
|
|
24857
|
-
__pyx_t_6 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0,
|
|
25096
|
+
__pyx_t_6 = __Pyx_PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24858
25097
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24859
|
-
__pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25098
|
+
__pyx_t_1 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24860
25099
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24861
|
-
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
25100
|
+
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24862
25101
|
__Pyx_GOTREF(__pyx_t_3);
|
|
24863
25102
|
__Pyx_GIVEREF(__pyx_t_1);
|
|
24864
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0,
|
|
25103
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error);
|
|
24865
25104
|
__pyx_t_1 = 0;
|
|
24866
|
-
__pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25105
|
+
__pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24867
25106
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24868
|
-
__pyx_t_4 = ((struct __pyx_vtabstruct_9mettagrid_19observation_encoder_ObservationEncoder *)__pyx_v_self->__pyx_base._obs_encoder->__pyx_vtab)->obs_np_type(__pyx_v_self->__pyx_base._obs_encoder, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25107
|
+
__pyx_t_4 = ((struct __pyx_vtabstruct_9mettagrid_19observation_encoder_ObservationEncoder *)__pyx_v_self->__pyx_base._obs_encoder->__pyx_vtab)->obs_np_type(__pyx_v_self->__pyx_base._obs_encoder, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24869
25108
|
__Pyx_GOTREF(__pyx_t_4);
|
|
24870
|
-
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
25109
|
+
if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24871
25110
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
24872
|
-
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25111
|
+
__pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24873
25112
|
__Pyx_GOTREF(__pyx_t_4);
|
|
24874
25113
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
24875
25114
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
24876
25115
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24877
|
-
__pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_ObsType(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0,
|
|
25116
|
+
__pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_ds_nn_ObsType(__pyx_t_4, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 180, __pyx_L1_error)
|
|
24878
25117
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
24879
25118
|
__pyx_v_obj_data = __pyx_t_7;
|
|
24880
25119
|
__pyx_t_7.memview = NULL;
|
|
24881
25120
|
__pyx_t_7.data = NULL;
|
|
24882
25121
|
|
|
24883
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25122
|
+
/* "mettagrid/mettagrid.pyx":182
|
|
24884
25123
|
* cdef ObsType[:] obj_data = np.zeros(len(self.grid_features()), dtype=self._obs_encoder.obs_np_type())
|
|
24885
25124
|
* cdef unsigned int obj_id, i
|
|
24886
25125
|
* cdef ObservationEncoder obs_encoder = self._obs_encoder # <<<<<<<<<<<<<<
|
|
@@ -24892,19 +25131,19 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24892
25131
|
__pyx_v_obs_encoder = ((struct __pyx_obj_9mettagrid_19observation_encoder_ObservationEncoder *)__pyx_t_4);
|
|
24893
25132
|
__pyx_t_4 = 0;
|
|
24894
25133
|
|
|
24895
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25134
|
+
/* "mettagrid/mettagrid.pyx":184
|
|
24896
25135
|
* cdef ObservationEncoder obs_encoder = self._obs_encoder
|
|
24897
25136
|
* cdef vector[unsigned int] offsets
|
|
24898
25137
|
* objects = {} # <<<<<<<<<<<<<<
|
|
24899
25138
|
* for obj_id in range(1, self._grid.objects.size()):
|
|
24900
25139
|
* obj = self._grid.object(obj_id)
|
|
24901
25140
|
*/
|
|
24902
|
-
__pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25141
|
+
__pyx_t_4 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
|
|
24903
25142
|
__Pyx_GOTREF(__pyx_t_4);
|
|
24904
25143
|
__pyx_v_objects = ((PyObject*)__pyx_t_4);
|
|
24905
25144
|
__pyx_t_4 = 0;
|
|
24906
25145
|
|
|
24907
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25146
|
+
/* "mettagrid/mettagrid.pyx":185
|
|
24908
25147
|
* cdef vector[unsigned int] offsets
|
|
24909
25148
|
* objects = {}
|
|
24910
25149
|
* for obj_id in range(1, self._grid.objects.size()): # <<<<<<<<<<<<<<
|
|
@@ -24916,7 +25155,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24916
25155
|
for (__pyx_t_5 = 1; __pyx_t_5 < __pyx_t_9; __pyx_t_5+=1) {
|
|
24917
25156
|
__pyx_v_obj_id = __pyx_t_5;
|
|
24918
25157
|
|
|
24919
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25158
|
+
/* "mettagrid/mettagrid.pyx":186
|
|
24920
25159
|
* objects = {}
|
|
24921
25160
|
* for obj_id in range(1, self._grid.objects.size()):
|
|
24922
25161
|
* obj = self._grid.object(obj_id) # <<<<<<<<<<<<<<
|
|
@@ -24925,7 +25164,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24925
25164
|
*/
|
|
24926
25165
|
__pyx_v_obj = __pyx_v_self->__pyx_base._grid->object(__pyx_v_obj_id);
|
|
24927
25166
|
|
|
24928
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25167
|
+
/* "mettagrid/mettagrid.pyx":187
|
|
24929
25168
|
* for obj_id in range(1, self._grid.objects.size()):
|
|
24930
25169
|
* obj = self._grid.object(obj_id)
|
|
24931
25170
|
* if obj == NULL: # <<<<<<<<<<<<<<
|
|
@@ -24935,7 +25174,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24935
25174
|
__pyx_t_10 = (__pyx_v_obj == NULL);
|
|
24936
25175
|
if (__pyx_t_10) {
|
|
24937
25176
|
|
|
24938
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25177
|
+
/* "mettagrid/mettagrid.pyx":188
|
|
24939
25178
|
* obj = self._grid.object(obj_id)
|
|
24940
25179
|
* if obj == NULL:
|
|
24941
25180
|
* continue # <<<<<<<<<<<<<<
|
|
@@ -24944,7 +25183,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24944
25183
|
*/
|
|
24945
25184
|
goto __pyx_L3_continue;
|
|
24946
25185
|
|
|
24947
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25186
|
+
/* "mettagrid/mettagrid.pyx":187
|
|
24948
25187
|
* for obj_id in range(1, self._grid.objects.size()):
|
|
24949
25188
|
* obj = self._grid.object(obj_id)
|
|
24950
25189
|
* if obj == NULL: # <<<<<<<<<<<<<<
|
|
@@ -24953,82 +25192,82 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
24953
25192
|
*/
|
|
24954
25193
|
}
|
|
24955
25194
|
|
|
24956
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25195
|
+
/* "mettagrid/mettagrid.pyx":190
|
|
24957
25196
|
* continue
|
|
24958
25197
|
* objects[obj_id] = {
|
|
24959
25198
|
* "id": obj_id, # <<<<<<<<<<<<<<
|
|
24960
25199
|
* "type": obj._type_id,
|
|
24961
25200
|
* "r": obj.location.r,
|
|
24962
25201
|
*/
|
|
24963
|
-
__pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25202
|
+
__pyx_t_4 = __Pyx_PyDict_NewPresized(5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
24964
25203
|
__Pyx_GOTREF(__pyx_t_4);
|
|
24965
|
-
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25204
|
+
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
24966
25205
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24967
|
-
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_id, __pyx_t_1) < 0) __PYX_ERR(0,
|
|
25206
|
+
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_id, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
24968
25207
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24969
25208
|
|
|
24970
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25209
|
+
/* "mettagrid/mettagrid.pyx":191
|
|
24971
25210
|
* objects[obj_id] = {
|
|
24972
25211
|
* "id": obj_id,
|
|
24973
25212
|
* "type": obj._type_id, # <<<<<<<<<<<<<<
|
|
24974
25213
|
* "r": obj.location.r,
|
|
24975
25214
|
* "c": obj.location.c,
|
|
24976
25215
|
*/
|
|
24977
|
-
__pyx_t_1 = __Pyx_PyInt_From_TypeId(__pyx_v_obj->_type_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25216
|
+
__pyx_t_1 = __Pyx_PyInt_From_TypeId(__pyx_v_obj->_type_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error)
|
|
24978
25217
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24979
|
-
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_type, __pyx_t_1) < 0) __PYX_ERR(0,
|
|
25218
|
+
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_type, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
24980
25219
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24981
25220
|
|
|
24982
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25221
|
+
/* "mettagrid/mettagrid.pyx":192
|
|
24983
25222
|
* "id": obj_id,
|
|
24984
25223
|
* "type": obj._type_id,
|
|
24985
25224
|
* "r": obj.location.r, # <<<<<<<<<<<<<<
|
|
24986
25225
|
* "c": obj.location.c,
|
|
24987
25226
|
* "layer": obj.location.layer
|
|
24988
25227
|
*/
|
|
24989
|
-
__pyx_t_1 = __Pyx_PyInt_From_GridCoord(__pyx_v_obj->location.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25228
|
+
__pyx_t_1 = __Pyx_PyInt_From_GridCoord(__pyx_v_obj->location.r); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error)
|
|
24990
25229
|
__Pyx_GOTREF(__pyx_t_1);
|
|
24991
|
-
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_r, __pyx_t_1) < 0) __PYX_ERR(0,
|
|
25230
|
+
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_r, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
24992
25231
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
24993
25232
|
|
|
24994
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25233
|
+
/* "mettagrid/mettagrid.pyx":193
|
|
24995
25234
|
* "type": obj._type_id,
|
|
24996
25235
|
* "r": obj.location.r,
|
|
24997
25236
|
* "c": obj.location.c, # <<<<<<<<<<<<<<
|
|
24998
25237
|
* "layer": obj.location.layer
|
|
24999
25238
|
* }
|
|
25000
25239
|
*/
|
|
25001
|
-
__pyx_t_1 = __Pyx_PyInt_From_GridCoord(__pyx_v_obj->location.c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25240
|
+
__pyx_t_1 = __Pyx_PyInt_From_GridCoord(__pyx_v_obj->location.c); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error)
|
|
25002
25241
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25003
|
-
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_c, __pyx_t_1) < 0) __PYX_ERR(0,
|
|
25242
|
+
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_c, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
25004
25243
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25005
25244
|
|
|
25006
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25245
|
+
/* "mettagrid/mettagrid.pyx":194
|
|
25007
25246
|
* "r": obj.location.r,
|
|
25008
25247
|
* "c": obj.location.c,
|
|
25009
25248
|
* "layer": obj.location.layer # <<<<<<<<<<<<<<
|
|
25010
25249
|
* }
|
|
25011
25250
|
* offsets.resize(obs_encoder._type_feature_names[obj._type_id].size())
|
|
25012
25251
|
*/
|
|
25013
|
-
__pyx_t_1 = __Pyx_PyInt_From_Layer(__pyx_v_obj->location.layer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25252
|
+
__pyx_t_1 = __Pyx_PyInt_From_Layer(__pyx_v_obj->location.layer); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error)
|
|
25014
25253
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25015
|
-
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_layer, __pyx_t_1) < 0) __PYX_ERR(0,
|
|
25254
|
+
if (PyDict_SetItem(__pyx_t_4, __pyx_n_u_layer, __pyx_t_1) < 0) __PYX_ERR(0, 190, __pyx_L1_error)
|
|
25016
25255
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25017
25256
|
|
|
25018
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25257
|
+
/* "mettagrid/mettagrid.pyx":189
|
|
25019
25258
|
* if obj == NULL:
|
|
25020
25259
|
* continue
|
|
25021
25260
|
* objects[obj_id] = { # <<<<<<<<<<<<<<
|
|
25022
25261
|
* "id": obj_id,
|
|
25023
25262
|
* "type": obj._type_id,
|
|
25024
25263
|
*/
|
|
25025
|
-
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25264
|
+
__pyx_t_1 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __pyx_L1_error)
|
|
25026
25265
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25027
|
-
if (unlikely((PyDict_SetItem(__pyx_v_objects, __pyx_t_1, __pyx_t_4) < 0))) __PYX_ERR(0,
|
|
25266
|
+
if (unlikely((PyDict_SetItem(__pyx_v_objects, __pyx_t_1, __pyx_t_4) < 0))) __PYX_ERR(0, 189, __pyx_L1_error)
|
|
25028
25267
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25029
25268
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25030
25269
|
|
|
25031
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25270
|
+
/* "mettagrid/mettagrid.pyx":196
|
|
25032
25271
|
* "layer": obj.location.layer
|
|
25033
25272
|
* }
|
|
25034
25273
|
* offsets.resize(obs_encoder._type_feature_names[obj._type_id].size()) # <<<<<<<<<<<<<<
|
|
@@ -25039,10 +25278,10 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25039
25278
|
__pyx_v_offsets.resize((__pyx_v_obs_encoder->_type_feature_names[__pyx_v_obj->_type_id]).size());
|
|
25040
25279
|
} catch(...) {
|
|
25041
25280
|
__Pyx_CppExn2PyErr();
|
|
25042
|
-
__PYX_ERR(0,
|
|
25281
|
+
__PYX_ERR(0, 196, __pyx_L1_error)
|
|
25043
25282
|
}
|
|
25044
25283
|
|
|
25045
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25284
|
+
/* "mettagrid/mettagrid.pyx":197
|
|
25046
25285
|
* }
|
|
25047
25286
|
* offsets.resize(obs_encoder._type_feature_names[obj._type_id].size())
|
|
25048
25287
|
* for i in range(offsets.size()): # <<<<<<<<<<<<<<
|
|
@@ -25054,7 +25293,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25054
25293
|
for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) {
|
|
25055
25294
|
__pyx_v_i = __pyx_t_13;
|
|
25056
25295
|
|
|
25057
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25296
|
+
/* "mettagrid/mettagrid.pyx":198
|
|
25058
25297
|
* offsets.resize(obs_encoder._type_feature_names[obj._type_id].size())
|
|
25059
25298
|
* for i in range(offsets.size()):
|
|
25060
25299
|
* offsets[i] = i # <<<<<<<<<<<<<<
|
|
@@ -25064,18 +25303,18 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25064
25303
|
(__pyx_v_offsets[__pyx_v_i]) = __pyx_v_i;
|
|
25065
25304
|
}
|
|
25066
25305
|
|
|
25067
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25306
|
+
/* "mettagrid/mettagrid.pyx":199
|
|
25068
25307
|
* for i in range(offsets.size()):
|
|
25069
25308
|
* offsets[i] = i
|
|
25070
25309
|
* obs_encoder._encode(obj, obj_data, offsets) # <<<<<<<<<<<<<<
|
|
25071
25310
|
* for i, name in enumerate(obs_encoder._type_feature_names[obj._type_id]):
|
|
25072
25311
|
* objects[obj_id][name] = obj_data[i]
|
|
25073
25312
|
*/
|
|
25074
|
-
__pyx_t_4 = ((struct __pyx_vtabstruct_9mettagrid_19observation_encoder_ObservationEncoder *)__pyx_v_obs_encoder->__pyx_vtab)->_encode(__pyx_v_obs_encoder, __pyx_v_obj, __pyx_v_obj_data, __pyx_v_offsets); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25313
|
+
__pyx_t_4 = ((struct __pyx_vtabstruct_9mettagrid_19observation_encoder_ObservationEncoder *)__pyx_v_obs_encoder->__pyx_vtab)->_encode(__pyx_v_obs_encoder, __pyx_v_obj, __pyx_v_obj_data, __pyx_v_offsets); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 199, __pyx_L1_error)
|
|
25075
25314
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25076
25315
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25077
25316
|
|
|
25078
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25317
|
+
/* "mettagrid/mettagrid.pyx":200
|
|
25079
25318
|
* offsets[i] = i
|
|
25080
25319
|
* obs_encoder._encode(obj, obj_data, offsets)
|
|
25081
25320
|
* for i, name in enumerate(obs_encoder._type_feature_names[obj._type_id]): # <<<<<<<<<<<<<<
|
|
@@ -25083,16 +25322,16 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25083
25322
|
*
|
|
25084
25323
|
*/
|
|
25085
25324
|
__pyx_t_13 = 0;
|
|
25086
|
-
__pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_string((__pyx_v_obs_encoder->_type_feature_names[__pyx_v_obj->_type_id])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25325
|
+
__pyx_t_4 = __pyx_convert_vector_to_py_std_3a__3a_string((__pyx_v_obs_encoder->_type_feature_names[__pyx_v_obj->_type_id])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25087
25326
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25088
25327
|
if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
|
|
25089
25328
|
__pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1);
|
|
25090
25329
|
__pyx_t_6 = 0;
|
|
25091
25330
|
__pyx_t_14 = NULL;
|
|
25092
25331
|
} else {
|
|
25093
|
-
__pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25332
|
+
__pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25094
25333
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25095
|
-
__pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0,
|
|
25334
|
+
__pyx_t_14 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25096
25335
|
}
|
|
25097
25336
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25098
25337
|
for (;;) {
|
|
@@ -25101,28 +25340,28 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25101
25340
|
{
|
|
25102
25341
|
Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_1);
|
|
25103
25342
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
25104
|
-
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0,
|
|
25343
|
+
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25105
25344
|
#endif
|
|
25106
25345
|
if (__pyx_t_6 >= __pyx_temp) break;
|
|
25107
25346
|
}
|
|
25108
25347
|
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
25109
|
-
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0,
|
|
25348
|
+
__pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25110
25349
|
#else
|
|
25111
|
-
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25350
|
+
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25112
25351
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25113
25352
|
#endif
|
|
25114
25353
|
} else {
|
|
25115
25354
|
{
|
|
25116
25355
|
Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_1);
|
|
25117
25356
|
#if !CYTHON_ASSUME_SAFE_MACROS
|
|
25118
|
-
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0,
|
|
25357
|
+
if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25119
25358
|
#endif
|
|
25120
25359
|
if (__pyx_t_6 >= __pyx_temp) break;
|
|
25121
25360
|
}
|
|
25122
25361
|
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
25123
|
-
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0,
|
|
25362
|
+
__pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely((0 < 0))) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25124
25363
|
#else
|
|
25125
|
-
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25364
|
+
__pyx_t_4 = __Pyx_PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25126
25365
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25127
25366
|
#endif
|
|
25128
25367
|
}
|
|
@@ -25132,7 +25371,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25132
25371
|
PyObject* exc_type = PyErr_Occurred();
|
|
25133
25372
|
if (exc_type) {
|
|
25134
25373
|
if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
|
|
25135
|
-
else __PYX_ERR(0,
|
|
25374
|
+
else __PYX_ERR(0, 200, __pyx_L1_error)
|
|
25136
25375
|
}
|
|
25137
25376
|
break;
|
|
25138
25377
|
}
|
|
@@ -25143,7 +25382,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25143
25382
|
__pyx_v_i = __pyx_t_13;
|
|
25144
25383
|
__pyx_t_13 = (__pyx_t_13 + 1);
|
|
25145
25384
|
|
|
25146
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25385
|
+
/* "mettagrid/mettagrid.pyx":201
|
|
25147
25386
|
* obs_encoder._encode(obj, obj_data, offsets)
|
|
25148
25387
|
* for i, name in enumerate(obs_encoder._type_feature_names[obj._type_id]):
|
|
25149
25388
|
* objects[obj_id][name] = obj_data[i] # <<<<<<<<<<<<<<
|
|
@@ -25151,18 +25390,18 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25151
25390
|
* for agent_idx in range(self._agents.size()):
|
|
25152
25391
|
*/
|
|
25153
25392
|
__pyx_t_15 = __pyx_v_i;
|
|
25154
|
-
__pyx_t_4 = __Pyx_PyInt_From_ObsType((*((ObsType *) ( /* dim=0 */ (__pyx_v_obj_data.data + __pyx_t_15 * __pyx_v_obj_data.strides[0]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25393
|
+
__pyx_t_4 = __Pyx_PyInt_From_ObsType((*((ObsType *) ( /* dim=0 */ (__pyx_v_obj_data.data + __pyx_t_15 * __pyx_v_obj_data.strides[0]) )))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 201, __pyx_L1_error)
|
|
25155
25394
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25156
|
-
__pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
25395
|
+
__pyx_t_3 = __Pyx_PyInt_From_unsigned_int(__pyx_v_obj_id); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error)
|
|
25157
25396
|
__Pyx_GOTREF(__pyx_t_3);
|
|
25158
|
-
__pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_objects, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25397
|
+
__pyx_t_2 = __Pyx_PyDict_GetItem(__pyx_v_objects, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error)
|
|
25159
25398
|
__Pyx_GOTREF(__pyx_t_2);
|
|
25160
25399
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
25161
|
-
if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_v_name, __pyx_t_4) < 0))) __PYX_ERR(0,
|
|
25400
|
+
if (unlikely((PyObject_SetItem(__pyx_t_2, __pyx_v_name, __pyx_t_4) < 0))) __PYX_ERR(0, 201, __pyx_L1_error)
|
|
25162
25401
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
25163
25402
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25164
25403
|
|
|
25165
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25404
|
+
/* "mettagrid/mettagrid.pyx":200
|
|
25166
25405
|
* offsets[i] = i
|
|
25167
25406
|
* obs_encoder._encode(obj, obj_data, offsets)
|
|
25168
25407
|
* for i, name in enumerate(obs_encoder._type_feature_names[obj._type_id]): # <<<<<<<<<<<<<<
|
|
@@ -25174,7 +25413,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25174
25413
|
__pyx_L3_continue:;
|
|
25175
25414
|
}
|
|
25176
25415
|
|
|
25177
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25416
|
+
/* "mettagrid/mettagrid.pyx":203
|
|
25178
25417
|
* objects[obj_id][name] = obj_data[i]
|
|
25179
25418
|
*
|
|
25180
25419
|
* for agent_idx in range(self._agents.size()): # <<<<<<<<<<<<<<
|
|
@@ -25186,35 +25425,35 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25186
25425
|
for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_9; __pyx_t_16+=1) {
|
|
25187
25426
|
__pyx_v_agent_idx = __pyx_t_16;
|
|
25188
25427
|
|
|
25189
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25428
|
+
/* "mettagrid/mettagrid.pyx":204
|
|
25190
25429
|
*
|
|
25191
25430
|
* for agent_idx in range(self._agents.size()):
|
|
25192
25431
|
* agent_object = objects[self._agents[agent_idx].id] # <<<<<<<<<<<<<<
|
|
25193
25432
|
* agent_object["agent_id"] = agent_idx
|
|
25194
25433
|
*
|
|
25195
25434
|
*/
|
|
25196
|
-
__pyx_t_1 = __Pyx_PyInt_From_GridObjectId((__pyx_v_self->__pyx_base._agents[__pyx_v_agent_idx])->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25435
|
+
__pyx_t_1 = __Pyx_PyInt_From_GridObjectId((__pyx_v_self->__pyx_base._agents[__pyx_v_agent_idx])->id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
|
|
25197
25436
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25198
|
-
__pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_objects, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25437
|
+
__pyx_t_4 = __Pyx_PyDict_GetItem(__pyx_v_objects, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 204, __pyx_L1_error)
|
|
25199
25438
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25200
25439
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25201
25440
|
__Pyx_XDECREF_SET(__pyx_v_agent_object, __pyx_t_4);
|
|
25202
25441
|
__pyx_t_4 = 0;
|
|
25203
25442
|
|
|
25204
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25443
|
+
/* "mettagrid/mettagrid.pyx":205
|
|
25205
25444
|
* for agent_idx in range(self._agents.size()):
|
|
25206
25445
|
* agent_object = objects[self._agents[agent_idx].id]
|
|
25207
25446
|
* agent_object["agent_id"] = agent_idx # <<<<<<<<<<<<<<
|
|
25208
25447
|
*
|
|
25209
25448
|
* return objects
|
|
25210
25449
|
*/
|
|
25211
|
-
__pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_agent_idx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
25450
|
+
__pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_agent_idx); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 205, __pyx_L1_error)
|
|
25212
25451
|
__Pyx_GOTREF(__pyx_t_4);
|
|
25213
|
-
if (unlikely((PyObject_SetItem(__pyx_v_agent_object, __pyx_n_u_agent_id, __pyx_t_4) < 0))) __PYX_ERR(0,
|
|
25452
|
+
if (unlikely((PyObject_SetItem(__pyx_v_agent_object, __pyx_n_u_agent_id, __pyx_t_4) < 0))) __PYX_ERR(0, 205, __pyx_L1_error)
|
|
25214
25453
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25215
25454
|
}
|
|
25216
25455
|
|
|
25217
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25456
|
+
/* "mettagrid/mettagrid.pyx":207
|
|
25218
25457
|
* agent_object["agent_id"] = agent_idx
|
|
25219
25458
|
*
|
|
25220
25459
|
* return objects # <<<<<<<<<<<<<<
|
|
@@ -25226,7 +25465,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(struct
|
|
|
25226
25465
|
__pyx_r = __pyx_v_objects;
|
|
25227
25466
|
goto __pyx_L0;
|
|
25228
25467
|
|
|
25229
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25468
|
+
/* "mettagrid/mettagrid.pyx":178
|
|
25230
25469
|
* print("".join(r))
|
|
25231
25470
|
*
|
|
25232
25471
|
* cpdef grid_objects(self): # <<<<<<<<<<<<<<
|
|
@@ -25304,7 +25543,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_6grid_objects(stru
|
|
|
25304
25543
|
int __pyx_clineno = 0;
|
|
25305
25544
|
__Pyx_RefNannySetupContext("grid_objects", 1);
|
|
25306
25545
|
__Pyx_XDECREF(__pyx_r);
|
|
25307
|
-
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25546
|
+
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_grid_objects(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
25308
25547
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25309
25548
|
__pyx_r = __pyx_t_1;
|
|
25310
25549
|
__pyx_t_1 = 0;
|
|
@@ -25321,7 +25560,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_6grid_objects(stru
|
|
|
25321
25560
|
return __pyx_r;
|
|
25322
25561
|
}
|
|
25323
25562
|
|
|
25324
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25563
|
+
/* "mettagrid/mettagrid.pyx":209
|
|
25325
25564
|
* return objects
|
|
25326
25565
|
*
|
|
25327
25566
|
* cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions): # <<<<<<<<<<<<<<
|
|
@@ -25379,7 +25618,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25379
25618
|
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
|
|
25380
25619
|
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
|
|
25381
25620
|
#endif
|
|
25382
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25621
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_step); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
25383
25622
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25384
25623
|
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_9mettagrid_11mettagrid_c_9MettaGrid_9step)) {
|
|
25385
25624
|
__Pyx_XDECREF(__pyx_r);
|
|
@@ -25402,11 +25641,11 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25402
25641
|
PyObject *__pyx_callargs[2] = {__pyx_t_4, ((PyObject *)__pyx_v_actions)};
|
|
25403
25642
|
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
25404
25643
|
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
25405
|
-
if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25644
|
+
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
25406
25645
|
__Pyx_GOTREF(__pyx_t_2);
|
|
25407
25646
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
25408
25647
|
}
|
|
25409
|
-
if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0,
|
|
25648
|
+
if (!(likely(PyTuple_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_2))) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
25410
25649
|
__pyx_r = ((PyObject*)__pyx_t_2);
|
|
25411
25650
|
__pyx_t_2 = 0;
|
|
25412
25651
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
@@ -25425,25 +25664,25 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25425
25664
|
#endif
|
|
25426
25665
|
}
|
|
25427
25666
|
|
|
25428
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25667
|
+
/* "mettagrid/mettagrid.pyx":210
|
|
25429
25668
|
*
|
|
25430
25669
|
* cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions):
|
|
25431
25670
|
* (obs, rewards, terms, truncs, infos) = super(MettaGrid, self).step(actions) # <<<<<<<<<<<<<<
|
|
25432
25671
|
*
|
|
25433
25672
|
* self._group_rewards[:] = 0
|
|
25434
25673
|
*/
|
|
25435
|
-
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25674
|
+
__pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25436
25675
|
__Pyx_GOTREF(__pyx_t_2);
|
|
25437
25676
|
__Pyx_INCREF((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
25438
25677
|
__Pyx_GIVEREF((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
25439
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid))) __PYX_ERR(0,
|
|
25678
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid))) __PYX_ERR(0, 210, __pyx_L1_error);
|
|
25440
25679
|
__Pyx_INCREF((PyObject *)__pyx_v_self);
|
|
25441
25680
|
__Pyx_GIVEREF((PyObject *)__pyx_v_self);
|
|
25442
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self))) __PYX_ERR(0,
|
|
25443
|
-
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
25681
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_self))) __PYX_ERR(0, 210, __pyx_L1_error);
|
|
25682
|
+
__pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25444
25683
|
__Pyx_GOTREF(__pyx_t_3);
|
|
25445
25684
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
25446
|
-
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
25685
|
+
__pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_step); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25447
25686
|
__Pyx_GOTREF(__pyx_t_2);
|
|
25448
25687
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
25449
25688
|
__pyx_t_3 = NULL;
|
|
@@ -25464,7 +25703,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25464
25703
|
PyObject *__pyx_callargs[2] = {__pyx_t_3, ((PyObject *)__pyx_v_actions)};
|
|
25465
25704
|
__pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_5, 1+__pyx_t_5);
|
|
25466
25705
|
__Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
25467
|
-
if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25706
|
+
if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25468
25707
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25469
25708
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
25470
25709
|
}
|
|
@@ -25474,7 +25713,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25474
25713
|
if (unlikely(size != 5)) {
|
|
25475
25714
|
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
|
|
25476
25715
|
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
|
|
25477
|
-
__PYX_ERR(0,
|
|
25716
|
+
__PYX_ERR(0, 210, __pyx_L1_error)
|
|
25478
25717
|
}
|
|
25479
25718
|
#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
|
|
25480
25719
|
if (likely(PyTuple_CheckExact(sequence))) {
|
|
@@ -25500,7 +25739,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25500
25739
|
Py_ssize_t i;
|
|
25501
25740
|
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6,&__pyx_t_7};
|
|
25502
25741
|
for (i=0; i < 5; i++) {
|
|
25503
|
-
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0,
|
|
25742
|
+
PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25504
25743
|
__Pyx_GOTREF(item);
|
|
25505
25744
|
*(temps[i]) = item;
|
|
25506
25745
|
}
|
|
@@ -25510,7 +25749,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25510
25749
|
} else {
|
|
25511
25750
|
Py_ssize_t index = -1;
|
|
25512
25751
|
PyObject** temps[5] = {&__pyx_t_2,&__pyx_t_3,&__pyx_t_4,&__pyx_t_6,&__pyx_t_7};
|
|
25513
|
-
__pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0,
|
|
25752
|
+
__pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25514
25753
|
__Pyx_GOTREF(__pyx_t_8);
|
|
25515
25754
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25516
25755
|
__pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_8);
|
|
@@ -25519,7 +25758,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25519
25758
|
__Pyx_GOTREF(item);
|
|
25520
25759
|
*(temps[index]) = item;
|
|
25521
25760
|
}
|
|
25522
|
-
if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 5) < 0) __PYX_ERR(0,
|
|
25761
|
+
if (__Pyx_IternextUnpackEndCheck(__pyx_t_9(__pyx_t_8), 5) < 0) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
25523
25762
|
__pyx_t_9 = NULL;
|
|
25524
25763
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
25525
25764
|
goto __pyx_L4_unpacking_done;
|
|
@@ -25527,7 +25766,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25527
25766
|
__Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
|
|
25528
25767
|
__pyx_t_9 = NULL;
|
|
25529
25768
|
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
|
|
25530
|
-
__PYX_ERR(0,
|
|
25769
|
+
__PYX_ERR(0, 210, __pyx_L1_error)
|
|
25531
25770
|
__pyx_L4_unpacking_done:;
|
|
25532
25771
|
}
|
|
25533
25772
|
__pyx_v_obs = __pyx_t_2;
|
|
@@ -25541,7 +25780,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25541
25780
|
__pyx_v_infos = __pyx_t_7;
|
|
25542
25781
|
__pyx_t_7 = 0;
|
|
25543
25782
|
|
|
25544
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25783
|
+
/* "mettagrid/mettagrid.pyx":212
|
|
25545
25784
|
* (obs, rewards, terms, truncs, infos) = super(MettaGrid, self).step(actions)
|
|
25546
25785
|
*
|
|
25547
25786
|
* self._group_rewards[:] = 0 # <<<<<<<<<<<<<<
|
|
@@ -25563,7 +25802,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25563
25802
|
}
|
|
25564
25803
|
}
|
|
25565
25804
|
|
|
25566
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25805
|
+
/* "mettagrid/mettagrid.pyx":216
|
|
25567
25806
|
* cdef unsigned int group_id
|
|
25568
25807
|
* cdef float group_reward
|
|
25569
25808
|
* cdef bint share_rewards = False # <<<<<<<<<<<<<<
|
|
@@ -25572,7 +25811,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25572
25811
|
*/
|
|
25573
25812
|
__pyx_v_share_rewards = 0;
|
|
25574
25813
|
|
|
25575
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25814
|
+
/* "mettagrid/mettagrid.pyx":218
|
|
25576
25815
|
* cdef bint share_rewards = False
|
|
25577
25816
|
*
|
|
25578
25817
|
* for agent_idx in range(self._agents.size()): # <<<<<<<<<<<<<<
|
|
@@ -25584,20 +25823,20 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25584
25823
|
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
|
|
25585
25824
|
__pyx_v_agent_idx = __pyx_t_12;
|
|
25586
25825
|
|
|
25587
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25826
|
+
/* "mettagrid/mettagrid.pyx":219
|
|
25588
25827
|
*
|
|
25589
25828
|
* for agent_idx in range(self._agents.size()):
|
|
25590
25829
|
* if rewards[agent_idx] != 0: # <<<<<<<<<<<<<<
|
|
25591
25830
|
* share_rewards = True
|
|
25592
25831
|
* agent = <Agent*>self._agents[agent_idx]
|
|
25593
25832
|
*/
|
|
25594
|
-
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_v_agent_idx, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25833
|
+
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_v_agent_idx, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 219, __pyx_L1_error)
|
|
25595
25834
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25596
|
-
__pyx_t_13 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_1, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0,
|
|
25835
|
+
__pyx_t_13 = (__Pyx_PyInt_BoolNeObjC(__pyx_t_1, __pyx_int_0, 0, 0)); if (unlikely((__pyx_t_13 < 0))) __PYX_ERR(0, 219, __pyx_L1_error)
|
|
25597
25836
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25598
25837
|
if (__pyx_t_13) {
|
|
25599
25838
|
|
|
25600
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25839
|
+
/* "mettagrid/mettagrid.pyx":220
|
|
25601
25840
|
* for agent_idx in range(self._agents.size()):
|
|
25602
25841
|
* if rewards[agent_idx] != 0:
|
|
25603
25842
|
* share_rewards = True # <<<<<<<<<<<<<<
|
|
@@ -25606,7 +25845,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25606
25845
|
*/
|
|
25607
25846
|
__pyx_v_share_rewards = 1;
|
|
25608
25847
|
|
|
25609
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25848
|
+
/* "mettagrid/mettagrid.pyx":221
|
|
25610
25849
|
* if rewards[agent_idx] != 0:
|
|
25611
25850
|
* share_rewards = True
|
|
25612
25851
|
* agent = <Agent*>self._agents[agent_idx] # <<<<<<<<<<<<<<
|
|
@@ -25615,7 +25854,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25615
25854
|
*/
|
|
25616
25855
|
__pyx_v_agent = ((Agent *)(__pyx_v_self->__pyx_base._agents[__pyx_v_agent_idx]));
|
|
25617
25856
|
|
|
25618
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25857
|
+
/* "mettagrid/mettagrid.pyx":222
|
|
25619
25858
|
* share_rewards = True
|
|
25620
25859
|
* agent = <Agent*>self._agents[agent_idx]
|
|
25621
25860
|
* group_id = agent.group # <<<<<<<<<<<<<<
|
|
@@ -25625,26 +25864,26 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25625
25864
|
__pyx_t_14 = __pyx_v_agent->group;
|
|
25626
25865
|
__pyx_v_group_id = __pyx_t_14;
|
|
25627
25866
|
|
|
25628
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25867
|
+
/* "mettagrid/mettagrid.pyx":223
|
|
25629
25868
|
* agent = <Agent*>self._agents[agent_idx]
|
|
25630
25869
|
* group_id = agent.group
|
|
25631
25870
|
* group_reward = rewards[agent_idx] * self._group_reward_pct[group_id] # <<<<<<<<<<<<<<
|
|
25632
25871
|
* rewards[agent_idx] -= group_reward
|
|
25633
25872
|
* self._group_rewards[group_id] += group_reward / self._group_sizes[group_id]
|
|
25634
25873
|
*/
|
|
25635
|
-
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_v_agent_idx, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25874
|
+
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_v_agent_idx, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 223, __pyx_L1_error)
|
|
25636
25875
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25637
|
-
__pyx_t_7 = PyFloat_FromDouble((__pyx_v_self->_group_reward_pct[__pyx_v_group_id])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0,
|
|
25876
|
+
__pyx_t_7 = PyFloat_FromDouble((__pyx_v_self->_group_reward_pct[__pyx_v_group_id])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __pyx_L1_error)
|
|
25638
25877
|
__Pyx_GOTREF(__pyx_t_7);
|
|
25639
|
-
__pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0,
|
|
25878
|
+
__pyx_t_6 = PyNumber_Multiply(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __pyx_L1_error)
|
|
25640
25879
|
__Pyx_GOTREF(__pyx_t_6);
|
|
25641
25880
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25642
25881
|
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
25643
|
-
__pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_15 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0,
|
|
25882
|
+
__pyx_t_15 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_15 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L1_error)
|
|
25644
25883
|
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
25645
25884
|
__pyx_v_group_reward = __pyx_t_15;
|
|
25646
25885
|
|
|
25647
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25886
|
+
/* "mettagrid/mettagrid.pyx":224
|
|
25648
25887
|
* group_id = agent.group
|
|
25649
25888
|
* group_reward = rewards[agent_idx] * self._group_reward_pct[group_id]
|
|
25650
25889
|
* rewards[agent_idx] -= group_reward # <<<<<<<<<<<<<<
|
|
@@ -25652,18 +25891,18 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25652
25891
|
*
|
|
25653
25892
|
*/
|
|
25654
25893
|
__pyx_t_16 = __pyx_v_agent_idx;
|
|
25655
|
-
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_t_16, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0,
|
|
25894
|
+
__pyx_t_6 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_t_16, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 224, __pyx_L1_error)
|
|
25656
25895
|
__Pyx_GOTREF(__pyx_t_6);
|
|
25657
|
-
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_group_reward); if (unlikely(!__pyx_t_7)) __PYX_ERR(0,
|
|
25896
|
+
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_group_reward); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 224, __pyx_L1_error)
|
|
25658
25897
|
__Pyx_GOTREF(__pyx_t_7);
|
|
25659
|
-
__pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25898
|
+
__pyx_t_1 = PyNumber_InPlaceSubtract(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 224, __pyx_L1_error)
|
|
25660
25899
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25661
25900
|
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
25662
25901
|
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
25663
|
-
if (unlikely((__Pyx_SetItemInt(__pyx_v_rewards, __pyx_t_16, __pyx_t_1, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0) < 0))) __PYX_ERR(0,
|
|
25902
|
+
if (unlikely((__Pyx_SetItemInt(__pyx_v_rewards, __pyx_t_16, __pyx_t_1, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0) < 0))) __PYX_ERR(0, 224, __pyx_L1_error)
|
|
25664
25903
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25665
25904
|
|
|
25666
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25905
|
+
/* "mettagrid/mettagrid.pyx":225
|
|
25667
25906
|
* group_reward = rewards[agent_idx] * self._group_reward_pct[group_id]
|
|
25668
25907
|
* rewards[agent_idx] -= group_reward
|
|
25669
25908
|
* self._group_rewards[group_id] += group_reward / self._group_sizes[group_id] # <<<<<<<<<<<<<<
|
|
@@ -25673,12 +25912,12 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25673
25912
|
__pyx_t_5 = (__pyx_v_self->_group_sizes[__pyx_v_group_id]);
|
|
25674
25913
|
if (unlikely(__pyx_t_5 == 0)) {
|
|
25675
25914
|
PyErr_SetString(PyExc_ZeroDivisionError, "float division");
|
|
25676
|
-
__PYX_ERR(0,
|
|
25915
|
+
__PYX_ERR(0, 225, __pyx_L1_error)
|
|
25677
25916
|
}
|
|
25678
25917
|
__pyx_t_17 = __pyx_v_group_id;
|
|
25679
25918
|
*((double *) ( /* dim=0 */ (__pyx_v_self->_group_rewards.data + __pyx_t_17 * __pyx_v_self->_group_rewards.strides[0]) )) += (__pyx_v_group_reward / ((float)__pyx_t_5));
|
|
25680
25919
|
|
|
25681
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25920
|
+
/* "mettagrid/mettagrid.pyx":219
|
|
25682
25921
|
*
|
|
25683
25922
|
* for agent_idx in range(self._agents.size()):
|
|
25684
25923
|
* if rewards[agent_idx] != 0: # <<<<<<<<<<<<<<
|
|
@@ -25688,7 +25927,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25688
25927
|
}
|
|
25689
25928
|
}
|
|
25690
25929
|
|
|
25691
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25930
|
+
/* "mettagrid/mettagrid.pyx":227
|
|
25692
25931
|
* self._group_rewards[group_id] += group_reward / self._group_sizes[group_id]
|
|
25693
25932
|
*
|
|
25694
25933
|
* if share_rewards: # <<<<<<<<<<<<<<
|
|
@@ -25697,7 +25936,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25697
25936
|
*/
|
|
25698
25937
|
if (__pyx_v_share_rewards) {
|
|
25699
25938
|
|
|
25700
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25939
|
+
/* "mettagrid/mettagrid.pyx":228
|
|
25701
25940
|
*
|
|
25702
25941
|
* if share_rewards:
|
|
25703
25942
|
* for agent_idx in range(self._agents.size()): # <<<<<<<<<<<<<<
|
|
@@ -25709,7 +25948,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25709
25948
|
for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) {
|
|
25710
25949
|
__pyx_v_agent_idx = __pyx_t_12;
|
|
25711
25950
|
|
|
25712
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25951
|
+
/* "mettagrid/mettagrid.pyx":229
|
|
25713
25952
|
* if share_rewards:
|
|
25714
25953
|
* for agent_idx in range(self._agents.size()):
|
|
25715
25954
|
* agent = <Agent*>self._agents[agent_idx] # <<<<<<<<<<<<<<
|
|
@@ -25718,7 +25957,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25718
25957
|
*/
|
|
25719
25958
|
__pyx_v_agent = ((Agent *)(__pyx_v_self->__pyx_base._agents[__pyx_v_agent_idx]));
|
|
25720
25959
|
|
|
25721
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25960
|
+
/* "mettagrid/mettagrid.pyx":230
|
|
25722
25961
|
* for agent_idx in range(self._agents.size()):
|
|
25723
25962
|
* agent = <Agent*>self._agents[agent_idx]
|
|
25724
25963
|
* group_id = agent.group # <<<<<<<<<<<<<<
|
|
@@ -25728,7 +25967,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25728
25967
|
__pyx_t_14 = __pyx_v_agent->group;
|
|
25729
25968
|
__pyx_v_group_id = __pyx_t_14;
|
|
25730
25969
|
|
|
25731
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25970
|
+
/* "mettagrid/mettagrid.pyx":231
|
|
25732
25971
|
* agent = <Agent*>self._agents[agent_idx]
|
|
25733
25972
|
* group_id = agent.group
|
|
25734
25973
|
* group_reward = self._group_rewards[group_id] # <<<<<<<<<<<<<<
|
|
@@ -25738,7 +25977,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25738
25977
|
__pyx_t_17 = __pyx_v_group_id;
|
|
25739
25978
|
__pyx_v_group_reward = (*((double *) ( /* dim=0 */ (__pyx_v_self->_group_rewards.data + __pyx_t_17 * __pyx_v_self->_group_rewards.strides[0]) )));
|
|
25740
25979
|
|
|
25741
|
-
/* "mettagrid/mettagrid.pyx":
|
|
25980
|
+
/* "mettagrid/mettagrid.pyx":232
|
|
25742
25981
|
* group_id = agent.group
|
|
25743
25982
|
* group_reward = self._group_rewards[group_id]
|
|
25744
25983
|
* rewards[agent_idx] += group_reward # <<<<<<<<<<<<<<
|
|
@@ -25746,19 +25985,19 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25746
25985
|
*
|
|
25747
25986
|
*/
|
|
25748
25987
|
__pyx_t_16 = __pyx_v_agent_idx;
|
|
25749
|
-
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_t_16, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
25988
|
+
__pyx_t_1 = __Pyx_GetItemInt(__pyx_v_rewards, __pyx_t_16, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error)
|
|
25750
25989
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25751
|
-
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_group_reward); if (unlikely(!__pyx_t_7)) __PYX_ERR(0,
|
|
25990
|
+
__pyx_t_7 = PyFloat_FromDouble(__pyx_v_group_reward); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 232, __pyx_L1_error)
|
|
25752
25991
|
__Pyx_GOTREF(__pyx_t_7);
|
|
25753
|
-
__pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0,
|
|
25992
|
+
__pyx_t_6 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 232, __pyx_L1_error)
|
|
25754
25993
|
__Pyx_GOTREF(__pyx_t_6);
|
|
25755
25994
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
25756
25995
|
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
25757
|
-
if (unlikely((__Pyx_SetItemInt(__pyx_v_rewards, __pyx_t_16, __pyx_t_6, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0) < 0))) __PYX_ERR(0,
|
|
25996
|
+
if (unlikely((__Pyx_SetItemInt(__pyx_v_rewards, __pyx_t_16, __pyx_t_6, std::vector<GridObject *> ::size_type, 0, __Pyx_PyInt_FromSize_t, 0, 0, 0) < 0))) __PYX_ERR(0, 232, __pyx_L1_error)
|
|
25758
25997
|
__Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
|
|
25759
25998
|
}
|
|
25760
25999
|
|
|
25761
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26000
|
+
/* "mettagrid/mettagrid.pyx":227
|
|
25762
26001
|
* self._group_rewards[group_id] += group_reward / self._group_sizes[group_id]
|
|
25763
26002
|
*
|
|
25764
26003
|
* if share_rewards: # <<<<<<<<<<<<<<
|
|
@@ -25767,7 +26006,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25767
26006
|
*/
|
|
25768
26007
|
}
|
|
25769
26008
|
|
|
25770
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26009
|
+
/* "mettagrid/mettagrid.pyx":233
|
|
25771
26010
|
* group_reward = self._group_rewards[group_id]
|
|
25772
26011
|
* rewards[agent_idx] += group_reward
|
|
25773
26012
|
* return (obs, rewards, terms, truncs, infos) # <<<<<<<<<<<<<<
|
|
@@ -25775,28 +26014,28 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(struct __pyx_o
|
|
|
25775
26014
|
* cpdef dict get_episode_stats(self):
|
|
25776
26015
|
*/
|
|
25777
26016
|
__Pyx_XDECREF(__pyx_r);
|
|
25778
|
-
__pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0,
|
|
26017
|
+
__pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 233, __pyx_L1_error)
|
|
25779
26018
|
__Pyx_GOTREF(__pyx_t_6);
|
|
25780
26019
|
__Pyx_INCREF(__pyx_v_obs);
|
|
25781
26020
|
__Pyx_GIVEREF(__pyx_v_obs);
|
|
25782
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_obs)) __PYX_ERR(0,
|
|
26021
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_obs)) __PYX_ERR(0, 233, __pyx_L1_error);
|
|
25783
26022
|
__Pyx_INCREF(__pyx_v_rewards);
|
|
25784
26023
|
__Pyx_GIVEREF(__pyx_v_rewards);
|
|
25785
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_rewards)) __PYX_ERR(0,
|
|
26024
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_rewards)) __PYX_ERR(0, 233, __pyx_L1_error);
|
|
25786
26025
|
__Pyx_INCREF(__pyx_v_terms);
|
|
25787
26026
|
__Pyx_GIVEREF(__pyx_v_terms);
|
|
25788
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_terms)) __PYX_ERR(0,
|
|
26027
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_v_terms)) __PYX_ERR(0, 233, __pyx_L1_error);
|
|
25789
26028
|
__Pyx_INCREF(__pyx_v_truncs);
|
|
25790
26029
|
__Pyx_GIVEREF(__pyx_v_truncs);
|
|
25791
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_truncs)) __PYX_ERR(0,
|
|
26030
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_v_truncs)) __PYX_ERR(0, 233, __pyx_L1_error);
|
|
25792
26031
|
__Pyx_INCREF(__pyx_v_infos);
|
|
25793
26032
|
__Pyx_GIVEREF(__pyx_v_infos);
|
|
25794
|
-
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_infos)) __PYX_ERR(0,
|
|
26033
|
+
if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_v_infos)) __PYX_ERR(0, 233, __pyx_L1_error);
|
|
25795
26034
|
__pyx_r = ((PyObject*)__pyx_t_6);
|
|
25796
26035
|
__pyx_t_6 = 0;
|
|
25797
26036
|
goto __pyx_L0;
|
|
25798
26037
|
|
|
25799
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26038
|
+
/* "mettagrid/mettagrid.pyx":209
|
|
25800
26039
|
* return objects
|
|
25801
26040
|
*
|
|
25802
26041
|
* cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions): # <<<<<<<<<<<<<<
|
|
@@ -25879,12 +26118,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
25879
26118
|
(void)__Pyx_Arg_NewRef_FASTCALL(values[0]);
|
|
25880
26119
|
kw_args--;
|
|
25881
26120
|
}
|
|
25882
|
-
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0,
|
|
26121
|
+
else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error)
|
|
25883
26122
|
else goto __pyx_L5_argtuple_error;
|
|
25884
26123
|
}
|
|
25885
26124
|
if (unlikely(kw_args > 0)) {
|
|
25886
26125
|
const Py_ssize_t kwd_pos_args = __pyx_nargs;
|
|
25887
|
-
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "step") < 0)) __PYX_ERR(0,
|
|
26126
|
+
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "step") < 0)) __PYX_ERR(0, 209, __pyx_L3_error)
|
|
25888
26127
|
}
|
|
25889
26128
|
} else if (unlikely(__pyx_nargs != 1)) {
|
|
25890
26129
|
goto __pyx_L5_argtuple_error;
|
|
@@ -25895,7 +26134,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
25895
26134
|
}
|
|
25896
26135
|
goto __pyx_L6_skip;
|
|
25897
26136
|
__pyx_L5_argtuple_error:;
|
|
25898
|
-
__Pyx_RaiseArgtupleInvalid("step", 1, 1, 1, __pyx_nargs); __PYX_ERR(0,
|
|
26137
|
+
__Pyx_RaiseArgtupleInvalid("step", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 209, __pyx_L3_error)
|
|
25899
26138
|
__pyx_L6_skip:;
|
|
25900
26139
|
goto __pyx_L4_argument_unpacking_done;
|
|
25901
26140
|
__pyx_L3_error:;
|
|
@@ -25909,7 +26148,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
25909
26148
|
__Pyx_RefNannyFinishContext();
|
|
25910
26149
|
return NULL;
|
|
25911
26150
|
__pyx_L4_argument_unpacking_done:;
|
|
25912
|
-
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_actions), __pyx_ptype_5numpy_ndarray, 1, "actions", 0))) __PYX_ERR(0,
|
|
26151
|
+
if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_actions), __pyx_ptype_5numpy_ndarray, 1, "actions", 0))) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
25913
26152
|
__pyx_r = __pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_8step(((struct __pyx_obj_9mettagrid_11mettagrid_c_MettaGrid *)__pyx_v_self), __pyx_v_actions);
|
|
25914
26153
|
|
|
25915
26154
|
/* function exit code */
|
|
@@ -25936,7 +26175,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_8step(struct __pyx
|
|
|
25936
26175
|
int __pyx_clineno = 0;
|
|
25937
26176
|
__Pyx_RefNannySetupContext("step", 1);
|
|
25938
26177
|
__Pyx_XDECREF(__pyx_r);
|
|
25939
|
-
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(__pyx_v_self, __pyx_v_actions, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
26178
|
+
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_step(__pyx_v_self, __pyx_v_actions, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
25940
26179
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25941
26180
|
__pyx_r = __pyx_t_1;
|
|
25942
26181
|
__pyx_t_1 = 0;
|
|
@@ -25953,7 +26192,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_8step(struct __pyx
|
|
|
25953
26192
|
return __pyx_r;
|
|
25954
26193
|
}
|
|
25955
26194
|
|
|
25956
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26195
|
+
/* "mettagrid/mettagrid.pyx":235
|
|
25957
26196
|
* return (obs, rewards, terms, truncs, infos)
|
|
25958
26197
|
*
|
|
25959
26198
|
* cpdef dict get_episode_stats(self): # <<<<<<<<<<<<<<
|
|
@@ -25992,7 +26231,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(s
|
|
|
25992
26231
|
if (unlikely(!__Pyx_object_dict_version_matches(((PyObject *)__pyx_v_self), __pyx_tp_dict_version, __pyx_obj_dict_version))) {
|
|
25993
26232
|
PY_UINT64_T __pyx_typedict_guard = __Pyx_get_tp_dict_version(((PyObject *)__pyx_v_self));
|
|
25994
26233
|
#endif
|
|
25995
|
-
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_episode_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
26234
|
+
__pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_episode_stats); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
25996
26235
|
__Pyx_GOTREF(__pyx_t_1);
|
|
25997
26236
|
if (!__Pyx_IsSameCFunction(__pyx_t_1, (void*) __pyx_pw_9mettagrid_11mettagrid_c_9MettaGrid_11get_episode_stats)) {
|
|
25998
26237
|
__Pyx_XDECREF(__pyx_r);
|
|
@@ -26015,11 +26254,11 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(s
|
|
|
26015
26254
|
PyObject *__pyx_callargs[2] = {__pyx_t_4, NULL};
|
|
26016
26255
|
__pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_5, 0+__pyx_t_5);
|
|
26017
26256
|
__Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
26018
|
-
if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
26257
|
+
if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
26019
26258
|
__Pyx_GOTREF(__pyx_t_2);
|
|
26020
26259
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
26021
26260
|
}
|
|
26022
|
-
if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0,
|
|
26261
|
+
if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None) || __Pyx_RaiseUnexpectedTypeError("dict", __pyx_t_2))) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
26023
26262
|
__pyx_r = ((PyObject*)__pyx_t_2);
|
|
26024
26263
|
__pyx_t_2 = 0;
|
|
26025
26264
|
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
|
|
@@ -26038,7 +26277,7 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(s
|
|
|
26038
26277
|
#endif
|
|
26039
26278
|
}
|
|
26040
26279
|
|
|
26041
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26280
|
+
/* "mettagrid/mettagrid.pyx":236
|
|
26042
26281
|
*
|
|
26043
26282
|
* cpdef dict get_episode_stats(self):
|
|
26044
26283
|
* return { # <<<<<<<<<<<<<<
|
|
@@ -26047,28 +26286,28 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(s
|
|
|
26047
26286
|
*/
|
|
26048
26287
|
__Pyx_XDECREF(__pyx_r);
|
|
26049
26288
|
|
|
26050
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26289
|
+
/* "mettagrid/mettagrid.pyx":237
|
|
26051
26290
|
* cpdef dict get_episode_stats(self):
|
|
26052
26291
|
* return {
|
|
26053
26292
|
* "game": self._stats.stats(), # <<<<<<<<<<<<<<
|
|
26054
26293
|
* "agent": [ (<Agent*>agent).stats.stats() for agent in self._agents ]
|
|
26055
26294
|
* }
|
|
26056
26295
|
*/
|
|
26057
|
-
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
26296
|
+
__pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error)
|
|
26058
26297
|
__Pyx_GOTREF(__pyx_t_1);
|
|
26059
|
-
__pyx_t_2 = __pyx_convert_map_to_py_std_3a__3a_string____int(__pyx_v_self->__pyx_base._stats.stats()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
26298
|
+
__pyx_t_2 = __pyx_convert_map_to_py_std_3a__3a_string____int(__pyx_v_self->__pyx_base._stats.stats()); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error)
|
|
26060
26299
|
__Pyx_GOTREF(__pyx_t_2);
|
|
26061
|
-
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_game, __pyx_t_2) < 0) __PYX_ERR(0,
|
|
26300
|
+
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_game, __pyx_t_2) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
|
|
26062
26301
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
26063
26302
|
{ /* enter inner scope */
|
|
26064
26303
|
|
|
26065
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26304
|
+
/* "mettagrid/mettagrid.pyx":238
|
|
26066
26305
|
* return {
|
|
26067
26306
|
* "game": self._stats.stats(),
|
|
26068
26307
|
* "agent": [ (<Agent*>agent).stats.stats() for agent in self._agents ] # <<<<<<<<<<<<<<
|
|
26069
26308
|
* }
|
|
26070
26309
|
*/
|
|
26071
|
-
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0,
|
|
26310
|
+
__pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error)
|
|
26072
26311
|
__Pyx_GOTREF(__pyx_t_2);
|
|
26073
26312
|
__pyx_t_6 = __pyx_v_self->__pyx_base._agents.begin();
|
|
26074
26313
|
for (;;) {
|
|
@@ -26076,19 +26315,19 @@ static PyObject *__pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(s
|
|
|
26076
26315
|
__pyx_t_7 = *__pyx_t_6;
|
|
26077
26316
|
++__pyx_t_6;
|
|
26078
26317
|
__pyx_8genexpr2__pyx_v_agent = __pyx_t_7;
|
|
26079
|
-
__pyx_t_3 = __pyx_convert_map_to_py_std_3a__3a_string____int(((Agent *)__pyx_8genexpr2__pyx_v_agent)->stats.stats()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0,
|
|
26318
|
+
__pyx_t_3 = __pyx_convert_map_to_py_std_3a__3a_string____int(((Agent *)__pyx_8genexpr2__pyx_v_agent)->stats.stats()); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 238, __pyx_L1_error)
|
|
26080
26319
|
__Pyx_GOTREF(__pyx_t_3);
|
|
26081
|
-
if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0,
|
|
26320
|
+
if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) __PYX_ERR(0, 238, __pyx_L1_error)
|
|
26082
26321
|
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
|
|
26083
26322
|
}
|
|
26084
26323
|
} /* exit inner scope */
|
|
26085
|
-
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_agent_2, __pyx_t_2) < 0) __PYX_ERR(0,
|
|
26324
|
+
if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_agent_2, __pyx_t_2) < 0) __PYX_ERR(0, 237, __pyx_L1_error)
|
|
26086
26325
|
__Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
|
|
26087
26326
|
__pyx_r = ((PyObject*)__pyx_t_1);
|
|
26088
26327
|
__pyx_t_1 = 0;
|
|
26089
26328
|
goto __pyx_L0;
|
|
26090
26329
|
|
|
26091
|
-
/* "mettagrid/mettagrid.pyx":
|
|
26330
|
+
/* "mettagrid/mettagrid.pyx":235
|
|
26092
26331
|
* return (obs, rewards, terms, truncs, infos)
|
|
26093
26332
|
*
|
|
26094
26333
|
* cpdef dict get_episode_stats(self): # <<<<<<<<<<<<<<
|
|
@@ -26160,7 +26399,7 @@ static PyObject *__pyx_pf_9mettagrid_11mettagrid_c_9MettaGrid_10get_episode_stat
|
|
|
26160
26399
|
int __pyx_clineno = 0;
|
|
26161
26400
|
__Pyx_RefNannySetupContext("get_episode_stats", 1);
|
|
26162
26401
|
__Pyx_XDECREF(__pyx_r);
|
|
26163
|
-
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0,
|
|
26402
|
+
__pyx_t_1 = __pyx_f_9mettagrid_11mettagrid_c_9MettaGrid_get_episode_stats(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
26164
26403
|
__Pyx_GOTREF(__pyx_t_1);
|
|
26165
26404
|
__pyx_r = __pyx_t_1;
|
|
26166
26405
|
__pyx_t_1 = 0;
|
|
@@ -27618,6 +27857,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
|
|
|
27618
27857
|
{&__pyx_n_s_asyncio_coroutines, __pyx_k_asyncio_coroutines, sizeof(__pyx_k_asyncio_coroutines), 0, 0, 1, 1},
|
|
27619
27858
|
{&__pyx_n_s_attack, __pyx_k_attack, sizeof(__pyx_k_attack), 0, 0, 1, 1},
|
|
27620
27859
|
{&__pyx_n_s_base, __pyx_k_base, sizeof(__pyx_k_base), 0, 0, 1, 1},
|
|
27860
|
+
{&__pyx_n_s_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 0, 1, 1},
|
|
27861
|
+
{&__pyx_n_u_block, __pyx_k_block, sizeof(__pyx_k_block), 0, 1, 0, 1},
|
|
27621
27862
|
{&__pyx_n_s_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 0, 1, 1},
|
|
27622
27863
|
{&__pyx_n_u_c, __pyx_k_c, sizeof(__pyx_k_c), 0, 1, 0, 1},
|
|
27623
27864
|
{&__pyx_n_s_change_color, __pyx_k_change_color, sizeof(__pyx_k_change_color), 0, 0, 1, 1},
|
|
@@ -27650,8 +27891,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
|
|
|
27650
27891
|
{&__pyx_n_s_game, __pyx_k_game, sizeof(__pyx_k_game), 0, 0, 1, 1},
|
|
27651
27892
|
{&__pyx_n_u_game, __pyx_k_game, sizeof(__pyx_k_game), 0, 1, 0, 1},
|
|
27652
27893
|
{&__pyx_kp_u_gc, __pyx_k_gc, sizeof(__pyx_k_gc), 0, 1, 0, 0},
|
|
27653
|
-
{&__pyx_n_s_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 0, 1, 1},
|
|
27654
27894
|
{&__pyx_n_u_generator, __pyx_k_generator, sizeof(__pyx_k_generator), 0, 1, 0, 1},
|
|
27895
|
+
{&__pyx_kp_u_generator_red, __pyx_k_generator_red, sizeof(__pyx_k_generator_red), 0, 1, 0, 0},
|
|
27655
27896
|
{&__pyx_n_s_get, __pyx_k_get, sizeof(__pyx_k_get), 0, 0, 1, 1},
|
|
27656
27897
|
{&__pyx_n_s_get_episode_stats, __pyx_k_get_episode_stats, sizeof(__pyx_k_get_episode_stats), 0, 0, 1, 1},
|
|
27657
27898
|
{&__pyx_n_s_get_items, __pyx_k_get_items, sizeof(__pyx_k_get_items), 0, 0, 1, 1},
|
|
@@ -27699,8 +27940,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
|
|
|
27699
27940
|
{&__pyx_n_s_mettagrid_actions_swap, __pyx_k_mettagrid_actions_swap, sizeof(__pyx_k_mettagrid_actions_swap), 0, 0, 1, 1},
|
|
27700
27941
|
{&__pyx_n_s_mettagrid_mettagrid_c, __pyx_k_mettagrid_mettagrid_c, sizeof(__pyx_k_mettagrid_mettagrid_c), 0, 0, 1, 1},
|
|
27701
27942
|
{&__pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_k_mettagrid_mettagrid_pyx, sizeof(__pyx_k_mettagrid_mettagrid_pyx), 0, 0, 1, 0},
|
|
27702
|
-
{&__pyx_n_s_mine, __pyx_k_mine, sizeof(__pyx_k_mine), 0, 0, 1, 1},
|
|
27703
27943
|
{&__pyx_n_u_mine, __pyx_k_mine, sizeof(__pyx_k_mine), 0, 1, 0, 1},
|
|
27944
|
+
{&__pyx_kp_u_mine_red, __pyx_k_mine_red, sizeof(__pyx_k_mine_red), 0, 1, 0, 0},
|
|
27704
27945
|
{&__pyx_n_s_mode, __pyx_k_mode, sizeof(__pyx_k_mode), 0, 0, 1, 1},
|
|
27705
27946
|
{&__pyx_n_s_move, __pyx_k_move, sizeof(__pyx_k_move), 0, 0, 1, 1},
|
|
27706
27947
|
{&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1},
|
|
@@ -27786,9 +28027,9 @@ static int __Pyx_CreateStringTabAndInitStrings(void) {
|
|
|
27786
28027
|
/* #### Code section: cached_builtins ### */
|
|
27787
28028
|
static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) {
|
|
27788
28029
|
__pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 110, __pyx_L1_error)
|
|
27789
|
-
__pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0,
|
|
27790
|
-
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0,
|
|
27791
|
-
__pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0,
|
|
28030
|
+
__pyx_builtin_print = __Pyx_GetBuiltinName(__pyx_n_s_print); if (!__pyx_builtin_print) __PYX_ERR(0, 176, __pyx_L1_error)
|
|
28031
|
+
__pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 200, __pyx_L1_error)
|
|
28032
|
+
__pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 210, __pyx_L1_error)
|
|
27792
28033
|
__pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error)
|
|
27793
28034
|
__pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 68, __pyx_L1_error)
|
|
27794
28035
|
__pyx_builtin___import__ = __Pyx_GetBuiltinName(__pyx_n_s_import); if (!__pyx_builtin___import__) __PYX_ERR(1, 100, __pyx_L1_error)
|
|
@@ -27978,59 +28219,59 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) {
|
|
|
27978
28219
|
__Pyx_GIVEREF(__pyx_tuple__23);
|
|
27979
28220
|
__pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle_Enum, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(1, 1, __pyx_L1_error)
|
|
27980
28221
|
|
|
27981
|
-
/* "mettagrid/mettagrid.pyx":
|
|
28222
|
+
/* "mettagrid/mettagrid.pyx":170
|
|
27982
28223
|
*
|
|
27983
28224
|
*
|
|
27984
28225
|
* cpdef list[str] grid_features(self): # <<<<<<<<<<<<<<
|
|
27985
28226
|
* return self._grid_features
|
|
27986
28227
|
*
|
|
27987
28228
|
*/
|
|
27988
|
-
__pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0,
|
|
28229
|
+
__pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
27989
28230
|
__Pyx_GOTREF(__pyx_tuple__25);
|
|
27990
28231
|
__Pyx_GIVEREF(__pyx_tuple__25);
|
|
27991
|
-
__pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_grid_features,
|
|
28232
|
+
__pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_grid_features, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
27992
28233
|
|
|
27993
|
-
/* "mettagrid/mettagrid.pyx":
|
|
28234
|
+
/* "mettagrid/mettagrid.pyx":173
|
|
27994
28235
|
* return self._grid_features
|
|
27995
28236
|
*
|
|
27996
28237
|
* def render(self): # <<<<<<<<<<<<<<
|
|
27997
28238
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"])
|
|
27998
28239
|
* for r in grid:
|
|
27999
28240
|
*/
|
|
28000
|
-
__pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_grid, __pyx_n_s_r); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0,
|
|
28241
|
+
__pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_grid, __pyx_n_s_r); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 173, __pyx_L1_error)
|
|
28001
28242
|
__Pyx_GOTREF(__pyx_tuple__27);
|
|
28002
28243
|
__Pyx_GIVEREF(__pyx_tuple__27);
|
|
28003
|
-
__pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_render,
|
|
28244
|
+
__pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_render, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 173, __pyx_L1_error)
|
|
28004
28245
|
|
|
28005
|
-
/* "mettagrid/mettagrid.pyx":
|
|
28246
|
+
/* "mettagrid/mettagrid.pyx":178
|
|
28006
28247
|
* print("".join(r))
|
|
28007
28248
|
*
|
|
28008
28249
|
* cpdef grid_objects(self): # <<<<<<<<<<<<<<
|
|
28009
28250
|
* cdef GridObject *obj
|
|
28010
28251
|
* cdef ObsType[:] obj_data = np.zeros(len(self.grid_features()), dtype=self._obs_encoder.obs_np_type())
|
|
28011
28252
|
*/
|
|
28012
|
-
__pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_grid_objects,
|
|
28253
|
+
__pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_grid_objects, 178, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
28013
28254
|
|
|
28014
|
-
/* "mettagrid/mettagrid.pyx":
|
|
28255
|
+
/* "mettagrid/mettagrid.pyx":209
|
|
28015
28256
|
* return objects
|
|
28016
28257
|
*
|
|
28017
28258
|
* cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions): # <<<<<<<<<<<<<<
|
|
28018
28259
|
* (obs, rewards, terms, truncs, infos) = super(MettaGrid, self).step(actions)
|
|
28019
28260
|
*
|
|
28020
28261
|
*/
|
|
28021
|
-
__pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_actions); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0,
|
|
28262
|
+
__pyx_tuple__30 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_actions); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
28022
28263
|
__Pyx_GOTREF(__pyx_tuple__30);
|
|
28023
28264
|
__Pyx_GIVEREF(__pyx_tuple__30);
|
|
28024
|
-
__pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_step,
|
|
28265
|
+
__pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(2, 0, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_step, 209, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
28025
28266
|
|
|
28026
|
-
/* "mettagrid/mettagrid.pyx":
|
|
28267
|
+
/* "mettagrid/mettagrid.pyx":235
|
|
28027
28268
|
* return (obs, rewards, terms, truncs, infos)
|
|
28028
28269
|
*
|
|
28029
28270
|
* cpdef dict get_episode_stats(self): # <<<<<<<<<<<<<<
|
|
28030
28271
|
* return {
|
|
28031
28272
|
* "game": self._stats.stats(),
|
|
28032
28273
|
*/
|
|
28033
|
-
__pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_get_episode_stats,
|
|
28274
|
+
__pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_mettagrid_mettagrid_pyx, __pyx_n_s_get_episode_stats, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
28034
28275
|
|
|
28035
28276
|
/* "(tree fragment)":1
|
|
28036
28277
|
* def __reduce_cython__(self): # <<<<<<<<<<<<<<
|
|
@@ -29469,68 +29710,68 @@ if (!__Pyx_RefNanny) {
|
|
|
29469
29710
|
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
29470
29711
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29471
29712
|
|
|
29472
|
-
/* "mettagrid/mettagrid.pyx":
|
|
29713
|
+
/* "mettagrid/mettagrid.pyx":170
|
|
29473
29714
|
*
|
|
29474
29715
|
*
|
|
29475
29716
|
* cpdef list[str] grid_features(self): # <<<<<<<<<<<<<<
|
|
29476
29717
|
* return self._grid_features
|
|
29477
29718
|
*
|
|
29478
29719
|
*/
|
|
29479
|
-
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_3grid_features, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_grid_features, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
29720
|
+
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_3grid_features, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_grid_features, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
29480
29721
|
__Pyx_GOTREF(__pyx_t_4);
|
|
29481
|
-
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_grid_features, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
29722
|
+
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_grid_features, __pyx_t_4) < 0) __PYX_ERR(0, 170, __pyx_L1_error)
|
|
29482
29723
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29483
29724
|
PyType_Modified(__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
29484
29725
|
|
|
29485
|
-
/* "mettagrid/mettagrid.pyx":
|
|
29726
|
+
/* "mettagrid/mettagrid.pyx":173
|
|
29486
29727
|
* return self._grid_features
|
|
29487
29728
|
*
|
|
29488
29729
|
* def render(self): # <<<<<<<<<<<<<<
|
|
29489
29730
|
* grid = self.render_ascii(["A", "#", "g", "c", "a"])
|
|
29490
29731
|
* for r in grid:
|
|
29491
29732
|
*/
|
|
29492
|
-
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_5render, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_render, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
29733
|
+
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_5render, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_render, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L1_error)
|
|
29493
29734
|
__Pyx_GOTREF(__pyx_t_4);
|
|
29494
|
-
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_render, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
29735
|
+
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_render, __pyx_t_4) < 0) __PYX_ERR(0, 173, __pyx_L1_error)
|
|
29495
29736
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29496
29737
|
PyType_Modified(__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
29497
29738
|
|
|
29498
|
-
/* "mettagrid/mettagrid.pyx":
|
|
29739
|
+
/* "mettagrid/mettagrid.pyx":178
|
|
29499
29740
|
* print("".join(r))
|
|
29500
29741
|
*
|
|
29501
29742
|
* cpdef grid_objects(self): # <<<<<<<<<<<<<<
|
|
29502
29743
|
* cdef GridObject *obj
|
|
29503
29744
|
* cdef ObsType[:] obj_data = np.zeros(len(self.grid_features()), dtype=self._obs_encoder.obs_np_type())
|
|
29504
29745
|
*/
|
|
29505
|
-
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_7grid_objects, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_grid_objects, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
29746
|
+
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_7grid_objects, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_grid_objects, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
29506
29747
|
__Pyx_GOTREF(__pyx_t_4);
|
|
29507
|
-
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_grid_objects, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
29748
|
+
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_grid_objects, __pyx_t_4) < 0) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
29508
29749
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29509
29750
|
PyType_Modified(__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
29510
29751
|
|
|
29511
|
-
/* "mettagrid/mettagrid.pyx":
|
|
29752
|
+
/* "mettagrid/mettagrid.pyx":209
|
|
29512
29753
|
* return objects
|
|
29513
29754
|
*
|
|
29514
29755
|
* cpdef tuple[cnp.ndarray, cnp.ndarray, cnp.ndarray, cnp.ndarray, dict] step(self, cnp.ndarray actions): # <<<<<<<<<<<<<<
|
|
29515
29756
|
* (obs, rewards, terms, truncs, infos) = super(MettaGrid, self).step(actions)
|
|
29516
29757
|
*
|
|
29517
29758
|
*/
|
|
29518
|
-
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_9step, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_step, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
29759
|
+
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_9step, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_step, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
29519
29760
|
__Pyx_GOTREF(__pyx_t_4);
|
|
29520
|
-
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_step, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
29761
|
+
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_step, __pyx_t_4) < 0) __PYX_ERR(0, 209, __pyx_L1_error)
|
|
29521
29762
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29522
29763
|
PyType_Modified(__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
29523
29764
|
|
|
29524
|
-
/* "mettagrid/mettagrid.pyx":
|
|
29765
|
+
/* "mettagrid/mettagrid.pyx":235
|
|
29525
29766
|
* return (obs, rewards, terms, truncs, infos)
|
|
29526
29767
|
*
|
|
29527
29768
|
* cpdef dict get_episode_stats(self): # <<<<<<<<<<<<<<
|
|
29528
29769
|
* return {
|
|
29529
29770
|
* "game": self._stats.stats(),
|
|
29530
29771
|
*/
|
|
29531
|
-
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_11get_episode_stats, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_get_episode_stats, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0,
|
|
29772
|
+
__pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_9mettagrid_11mettagrid_c_9MettaGrid_11get_episode_stats, __Pyx_CYFUNCTION_CCLASS, __pyx_n_s_MettaGrid_get_episode_stats, NULL, __pyx_n_s_mettagrid_mettagrid_c, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
29532
29773
|
__Pyx_GOTREF(__pyx_t_4);
|
|
29533
|
-
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_get_episode_stats, __pyx_t_4) < 0) __PYX_ERR(0,
|
|
29774
|
+
if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid, __pyx_n_s_get_episode_stats, __pyx_t_4) < 0) __PYX_ERR(0, 235, __pyx_L1_error)
|
|
29534
29775
|
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
|
|
29535
29776
|
PyType_Modified(__pyx_ptype_9mettagrid_11mettagrid_c_MettaGrid);
|
|
29536
29777
|
|