Generated by Cython 0.29.2
Yellow lines hint at Python interaction.
Click on a line that starts with a "+
" to see the C code that Cython generated for it.
Raw output: game.c
+001: #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
__pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+002: import numpy as np
__pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
003:
004: cimport numpy as np
005: cimport cython
006:
007: from cpython.mem cimport PyMem_Malloc, PyMem_Free
008: from libc.stdlib cimport rand, srand, RAND_MAX
009: from libc.math cimport sqrt
010:
011: """Enum for items, players and environments of the map."""
+012: cpdef enum:
enum { __pyx_e_8worldmor_4game_4game_GRASS = 0, __pyx_e_8worldmor_4game_4game_WALL = 1, __pyx_e_8worldmor_4game_4game_BLOOD = 2, __pyx_e_8worldmor_4game_4game_PLAYER = 3, __pyx_e_8worldmor_4game_4game_BULLET = 4, __pyx_e_8worldmor_4game_4game_HEALTH = 5, __pyx_e_8worldmor_4game_4game_ENEMY_B = 6, __pyx_e_8worldmor_4game_4game_ENEMY_1 = 7, __pyx_e_8worldmor_4game_4game_ENEMY_2 = 8, __pyx_e_8worldmor_4game_4game_ENEMY_E = 9, __pyx_e_8worldmor_4game_4game_GUN_B = 12, __pyx_e_8worldmor_4game_4game_GUN_1 = 13, __pyx_e_8worldmor_4game_4game_GUN_2 = 14, __pyx_e_8worldmor_4game_4game_GUN_3 = 15, __pyx_e_8worldmor_4game_4game_GUN_E = 16, __pyx_e_8worldmor_4game_4game_EXPLODE = 21 };
013: GRASS = 0
014: WALL = 1
015: BLOOD = 2
016: PLAYER = 3
017: BULLET = 4
018: HEALTH = 5
019:
020: ENEMY_B = 6
021: ENEMY_1 = 7
022: ENEMY_2 = 8
023: ENEMY_E = 9
024:
025: GUN_B = 12
026: GUN_1 = 13
027: GUN_2 = 14
028: GUN_3 = 15
029: GUN_E = 16
030:
031: EXPLODE = 21
032:
033: """The probability of free points on map."""
+034: cdef double PROBABILITY_OF_FREE_POINTS = 0.002
__pyx_v_8worldmor_4game_4game_PROBABILITY_OF_FREE_POINTS = 0.002;
035:
036: """How many points add when collect blood."""
+037: cdef int ADD_POINTS = 10
__pyx_v_8worldmor_4game_4game_ADD_POINTS = 10;
038:
039: """Guns characteristics"""
+040: cdef int GUN_B_STRONG = 10
__pyx_v_8worldmor_4game_4game_GUN_B_STRONG = 10;
+041: cdef int GUN_B_DISTANCE = 2
__pyx_v_8worldmor_4game_4game_GUN_B_DISTANCE = 2;
+042: cdef int GUN_B_BULLETS = 1
__pyx_v_8worldmor_4game_4game_GUN_B_BULLETS = 1;
+043: cdef int GUN_1_STRONG = 40
__pyx_v_8worldmor_4game_4game_GUN_1_STRONG = 40;
+044: cdef int GUN_1_BULLETS = 5
__pyx_v_8worldmor_4game_4game_GUN_1_BULLETS = 5;
+045: cdef int GUN_1_DISTANCE = 2
__pyx_v_8worldmor_4game_4game_GUN_1_DISTANCE = 2;
+046: cdef int GUN_2_STRONG = 20
__pyx_v_8worldmor_4game_4game_GUN_2_STRONG = 20;
+047: cdef int GUN_2_BULLETS = 1
__pyx_v_8worldmor_4game_4game_GUN_2_BULLETS = 1;
+048: cdef int GUN_2_DISTANCE = 4
__pyx_v_8worldmor_4game_4game_GUN_2_DISTANCE = 4;
+049: cdef int GUN_3_STRONG = 55
__pyx_v_8worldmor_4game_4game_GUN_3_STRONG = 55;
+050: cdef int GUN_3_BULLETS = 6
__pyx_v_8worldmor_4game_4game_GUN_3_BULLETS = 6;
+051: cdef int GUN_3_DISTANCE = 3
__pyx_v_8worldmor_4game_4game_GUN_3_DISTANCE = 3;
+052: cdef int GUN_E_STRONG = 34
__pyx_v_8worldmor_4game_4game_GUN_E_STRONG = 34;
+053: cdef int GUN_E_BULLETS = 3
__pyx_v_8worldmor_4game_4game_GUN_E_BULLETS = 3;
+054: cdef int GUN_E_DISTANCE = 5
__pyx_v_8worldmor_4game_4game_GUN_E_DISTANCE = 5;
055:
056: """Max bullets 0 - 999"""
+057: cdef int MAX_BULLETS = 666
__pyx_v_8worldmor_4game_4game_MAX_BULLETS = 0x29A;
058: """Max health 0 - 999"""
+059: cdef int MAX_HEALTH = 100
__pyx_v_8worldmor_4game_4game_MAX_HEALTH = 0x64;
060: """Bullets in one bullets box"""
+061: cdef int BULLETS_ADD = 20
__pyx_v_8worldmor_4game_4game_BULLETS_ADD = 20;
062: """Health in one health box"""
+063: cdef int HEALTH_ADD = 10
__pyx_v_8worldmor_4game_4game_HEALTH_ADD = 10;
064:
065: """Number of bullets which have enemy on start"""
+066: cdef int ENEMY_START_BULLETS = 10
__pyx_v_8worldmor_4game_4game_ENEMY_START_BULLETS = 10;
067:
068: """The base probability of wall.
069:
070: Calculate as p=WALL_BASE_PROBABILITY/(WALL_DIVIDER_BASE^walls-1)
071:
072: Walls is the count of wall rectangles in the neighbor.
073:
074: -1 is for decrease probability when no wall in neighbor and increase when
075: near is one wall (creatins walls not clumps)"""
+076: cdef double WALL_BASE_PROBABILITY = 0.45
__pyx_v_8worldmor_4game_4game_WALL_BASE_PROBABILITY = 0.45;
077:
078: """Base in divider. The formula described in WALL_BASE_PROBABILITY comment above."""
+079: cdef double WALL_DIVIDER_BASE = 3
__pyx_v_8worldmor_4game_4game_WALL_DIVIDER_BASE = 3.0;
080:
081: # Coords when do refactor the map to resize it.
+082: cdef struct coords:
struct __pyx_t_8worldmor_4game_4game_coords { int row_min; int row_max; int col_min; int col_max; };
083: int row_min
084: int row_max
085: int col_min
086: int col_max
087:
088: # Position on map
+089: cdef struct cord_move:
struct __pyx_t_8worldmor_4game_4game_cord_move { int row; int col; };
090: int row
091: int col
092:
+093: cdef class Worldmor:
struct __pyx_obj_8worldmor_4game_4game_Worldmor { PyObject_HEAD struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *__pyx_vtab; unsigned PY_LONG_LONG **map; int rows; int cols; int pos_row; int pos_col; int mid_row; int mid_col; double bullets_exponent; double bullets_multiply; double bullets_max_prob; double health_exponent; double health_multiply; double health_max_prob; double enemy_start_probability; double enemy_distance_divider; double enemy_max_prob; double guns_exponent; double guns_multiply; double guns_max_prob; int move_flag; int shoot_flag; int view_range; int check_range; int how_far_see_ai; int how_long_between_turn_ai; double go_for_player_ai_prob; double go_for_gun_ai_prob; double go_for_health_ai_prob; double go_for_bullets_ai_prob; }; struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor { unsigned PY_LONG_LONG (*to_health)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*get_health)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*to_bullets)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*get_bullets)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*to_visible)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*get_visible)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*to_direction)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*get_direction)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*to_gun)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*get_gun)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, unsigned PY_LONG_LONG, int __pyx_skip_dispatch); void (*left)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*right)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*up)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*down)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*shoot)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*do_one_time_moment)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*do_shoot)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int, int); int (*get_strong)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int); int (*get_distance)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int); int (*get_bullets_dec)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int); int (*do_move)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int, int, int); void (*recalculate_map_range)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *); double (*e_distance)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int, int, int); void (*enemy_ai)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int); struct __pyx_t_8worldmor_4game_4game_cord_move (*find_nearest)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int, int, int); PyArrayObject *(*get_map)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int, int __pyx_skip_dispatch); PyArrayObject *(*get_map_to_save)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_pos_row)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_pos_col)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_mid_row)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_mid_col)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_ai_how_far_see)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); int (*get_how_fast_ai_is)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int __pyx_skip_dispatch); void (*set_pos_row)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*set_pos_col)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*set_mid_row)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*set_mid_col)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*set_ai_how_far_see)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*set_how_fast_ai_is)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int __pyx_skip_dispatch); void (*put_map_to_game)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, PyArrayObject *, int __pyx_skip_dispatch); unsigned PY_LONG_LONG (*generate_part_of_map)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int); int (*count_near_walls)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int); void (*refactor_cols_up)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *); void (*refactor_cols_down)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *); void (*refactor_rows_down)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *); void (*refactor_rows_up)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *); struct __pyx_t_8worldmor_4game_4game_coords (*get_cords_slides)(struct __pyx_obj_8worldmor_4game_4game_Worldmor *, int, int); }; static struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *__pyx_vtabptr_8worldmor_4game_4game_Worldmor;
094: """Game"""
095:
096: cdef unsigned long long ** map
097: cdef int rows
098: cdef int cols
099: cdef int pos_row
100: cdef int pos_col
101: cdef int mid_row
102: cdef int mid_col
103:
104: cdef double bullets_exponent
105: cdef double bullets_multiply
106: cdef double bullets_max_prob
107:
108: cdef double health_exponent
109: cdef double health_multiply
110: cdef double health_max_prob
111:
112: cdef double enemy_start_probability
113: cdef double enemy_distance_divider
114: cdef double enemy_max_prob
115:
116: cdef double guns_exponent
117: cdef double guns_multiply
118: cdef double guns_max_prob
119:
120: cdef int move_flag
121: cdef int shoot_flag
122:
123: cdef int view_range
124: cdef int check_range
125:
126: cdef int how_far_see_ai
127: cdef int how_long_between_turn_ai
128: cdef double go_for_player_ai_prob
129: cdef double go_for_gun_ai_prob
130: cdef double go_for_health_ai_prob
131: cdef double go_for_bullets_ai_prob
132:
+133: def __cinit__(self, int rows, int random_seed, double bullets_exponent, double bullets_multiply,
/* Python wrapper */ static int __pyx_pw_8worldmor_4game_4game_8Worldmor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_8worldmor_4game_4game_8Worldmor_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_rows; int __pyx_v_random_seed; double __pyx_v_bullets_exponent; double __pyx_v_bullets_multiply; double __pyx_v_bullets_max_prob; double __pyx_v_health_exponent; double __pyx_v_health_multiply; double __pyx_v_health_max_prob; double __pyx_v_enemy_start_probability; double __pyx_v_enemy_distance_divider; double __pyx_v_enemy_max_prob; double __pyx_v_guns_exponent; double __pyx_v_guns_multiply; double __pyx_v_guns_max_prob; int __pyx_v_how_far_see_ai; int __pyx_v_how_long_between_turn_ai; double __pyx_v_go_for_player_ai_prob; double __pyx_v_go_for_gun_ai_prob; double __pyx_v_go_for_health_ai_prob; double __pyx_v_go_for_bullets_ai_prob; int __pyx_v_check_range; int __pyx_v_view_range; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rows,&__pyx_n_s_random_seed,&__pyx_n_s_bullets_exponent,&__pyx_n_s_bullets_multiply,&__pyx_n_s_bullets_max_prob,&__pyx_n_s_health_exponent,&__pyx_n_s_health_multiply,&__pyx_n_s_health_max_prob,&__pyx_n_s_enemy_start_probability,&__pyx_n_s_enemy_distance_divider,&__pyx_n_s_enemy_max_prob,&__pyx_n_s_guns_exponent,&__pyx_n_s_guns_multiply,&__pyx_n_s_guns_max_prob,&__pyx_n_s_how_far_see_ai,&__pyx_n_s_how_long_between_turn_ai,&__pyx_n_s_go_for_player_ai_prob,&__pyx_n_s_go_for_gun_ai_prob,&__pyx_n_s_go_for_health_ai_prob,&__pyx_n_s_go_for_bullets_ai_prob,&__pyx_n_s_check_range,&__pyx_n_s_view_range,0}; PyObject* values[22] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 22: values[21] = PyTuple_GET_ITEM(__pyx_args, 21); CYTHON_FALLTHROUGH; case 21: values[20] = PyTuple_GET_ITEM(__pyx_args, 20); CYTHON_FALLTHROUGH; case 20: values[19] = PyTuple_GET_ITEM(__pyx_args, 19); CYTHON_FALLTHROUGH; case 19: values[18] = PyTuple_GET_ITEM(__pyx_args, 18); CYTHON_FALLTHROUGH; case 18: values[17] = PyTuple_GET_ITEM(__pyx_args, 17); CYTHON_FALLTHROUGH; case 17: values[16] = PyTuple_GET_ITEM(__pyx_args, 16); CYTHON_FALLTHROUGH; case 16: values[15] = PyTuple_GET_ITEM(__pyx_args, 15); CYTHON_FALLTHROUGH; case 15: values[14] = PyTuple_GET_ITEM(__pyx_args, 14); CYTHON_FALLTHROUGH; case 14: values[13] = PyTuple_GET_ITEM(__pyx_args, 13); CYTHON_FALLTHROUGH; case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); CYTHON_FALLTHROUGH; case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); CYTHON_FALLTHROUGH; case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); CYTHON_FALLTHROUGH; case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); CYTHON_FALLTHROUGH; case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); CYTHON_FALLTHROUGH; case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rows)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_seed)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 1); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bullets_exponent)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 2); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bullets_multiply)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 3); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_bullets_max_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 4); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_health_exponent)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 5); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_health_multiply)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 6); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_health_max_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 7); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enemy_start_probability)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 8); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enemy_distance_divider)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 9); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_enemy_max_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 10); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_guns_exponent)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 11); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_guns_multiply)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 12); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_guns_max_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 13); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_how_far_see_ai)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 14); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_how_long_between_turn_ai)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 15); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 16: if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_go_for_player_ai_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 16); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 17: if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_go_for_gun_ai_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 17); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 18: if (likely((values[18] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_go_for_health_ai_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 18); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 19: if (likely((values[19] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_go_for_bullets_ai_prob)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 19); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 20: if (likely((values[20] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_check_range)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 20); __PYX_ERR(0, 133, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 21: if (likely((values[21] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_view_range)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, 21); __PYX_ERR(0, 133, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 22) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[7] = PyTuple_GET_ITEM(__pyx_args, 7); values[8] = PyTuple_GET_ITEM(__pyx_args, 8); values[9] = PyTuple_GET_ITEM(__pyx_args, 9); values[10] = PyTuple_GET_ITEM(__pyx_args, 10); values[11] = PyTuple_GET_ITEM(__pyx_args, 11); values[12] = PyTuple_GET_ITEM(__pyx_args, 12); values[13] = PyTuple_GET_ITEM(__pyx_args, 13); values[14] = PyTuple_GET_ITEM(__pyx_args, 14); values[15] = PyTuple_GET_ITEM(__pyx_args, 15); values[16] = PyTuple_GET_ITEM(__pyx_args, 16); values[17] = PyTuple_GET_ITEM(__pyx_args, 17); values[18] = PyTuple_GET_ITEM(__pyx_args, 18); values[19] = PyTuple_GET_ITEM(__pyx_args, 19); values[20] = PyTuple_GET_ITEM(__pyx_args, 20); values[21] = PyTuple_GET_ITEM(__pyx_args, 21); } __pyx_v_rows = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_rows == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) __pyx_v_random_seed = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_random_seed == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) __pyx_v_bullets_exponent = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_bullets_exponent == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) __pyx_v_bullets_multiply = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_bullets_multiply == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 133, __pyx_L3_error) __pyx_v_bullets_max_prob = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_bullets_max_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) __pyx_v_health_exponent = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_health_exponent == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) __pyx_v_health_multiply = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_health_multiply == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) __pyx_v_health_max_prob = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_health_max_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 134, __pyx_L3_error) __pyx_v_enemy_start_probability = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_enemy_start_probability == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) __pyx_v_enemy_distance_divider = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_enemy_distance_divider == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) __pyx_v_enemy_max_prob = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_enemy_max_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 135, __pyx_L3_error) __pyx_v_guns_exponent = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_guns_exponent == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) __pyx_v_guns_multiply = __pyx_PyFloat_AsDouble(values[12]); if (unlikely((__pyx_v_guns_multiply == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) __pyx_v_guns_max_prob = __pyx_PyFloat_AsDouble(values[13]); if (unlikely((__pyx_v_guns_max_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) __pyx_v_how_far_see_ai = __Pyx_PyInt_As_int(values[14]); if (unlikely((__pyx_v_how_far_see_ai == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L3_error) __pyx_v_how_long_between_turn_ai = __Pyx_PyInt_As_int(values[15]); if (unlikely((__pyx_v_how_long_between_turn_ai == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error) __pyx_v_go_for_player_ai_prob = __pyx_PyFloat_AsDouble(values[16]); if (unlikely((__pyx_v_go_for_player_ai_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error) __pyx_v_go_for_gun_ai_prob = __pyx_PyFloat_AsDouble(values[17]); if (unlikely((__pyx_v_go_for_gun_ai_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 137, __pyx_L3_error) __pyx_v_go_for_health_ai_prob = __pyx_PyFloat_AsDouble(values[18]); if (unlikely((__pyx_v_go_for_health_ai_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) __pyx_v_go_for_bullets_ai_prob = __pyx_PyFloat_AsDouble(values[19]); if (unlikely((__pyx_v_go_for_bullets_ai_prob == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) __pyx_v_check_range = __Pyx_PyInt_As_int(values[20]); if (unlikely((__pyx_v_check_range == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) __pyx_v_view_range = __Pyx_PyInt_As_int(values[21]); if (unlikely((__pyx_v_view_range == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 22, 22, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor___cinit__(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), __pyx_v_rows, __pyx_v_random_seed, __pyx_v_bullets_exponent, __pyx_v_bullets_multiply, __pyx_v_bullets_max_prob, __pyx_v_health_exponent, __pyx_v_health_multiply, __pyx_v_health_max_prob, __pyx_v_enemy_start_probability, __pyx_v_enemy_distance_divider, __pyx_v_enemy_max_prob, __pyx_v_guns_exponent, __pyx_v_guns_multiply, __pyx_v_guns_max_prob, __pyx_v_how_far_see_ai, __pyx_v_how_long_between_turn_ai, __pyx_v_go_for_player_ai_prob, __pyx_v_go_for_gun_ai_prob, __pyx_v_go_for_health_ai_prob, __pyx_v_go_for_bullets_ai_prob, __pyx_v_check_range, __pyx_v_view_range); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static int __pyx_pf_8worldmor_4game_4game_8Worldmor___cinit__(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_rows, int __pyx_v_random_seed, double __pyx_v_bullets_exponent, double __pyx_v_bullets_multiply, double __pyx_v_bullets_max_prob, double __pyx_v_health_exponent, double __pyx_v_health_multiply, double __pyx_v_health_max_prob, double __pyx_v_enemy_start_probability, double __pyx_v_enemy_distance_divider, double __pyx_v_enemy_max_prob, double __pyx_v_guns_exponent, double __pyx_v_guns_multiply, double __pyx_v_guns_max_prob, int __pyx_v_how_far_see_ai, int __pyx_v_how_long_between_turn_ai, double __pyx_v_go_for_player_ai_prob, double __pyx_v_go_for_gun_ai_prob, double __pyx_v_go_for_health_ai_prob, double __pyx_v_go_for_bullets_ai_prob, int __pyx_v_check_range, int __pyx_v_view_range) { int __pyx_v_i; int __pyx_v_j; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__", 0); /* … */ /* function exit code */ __pyx_r = 0; __Pyx_RefNannyFinishContext(); return __pyx_r; }
134: double bullets_max_prob, double health_exponent, double health_multiply, double health_max_prob,
135: double enemy_start_probability, double enemy_distance_divider, double enemy_max_prob,
136: double guns_exponent, double guns_multiply, double guns_max_prob, int how_far_see_ai,
137: int how_long_between_turn_ai, double go_for_player_ai_prob, double go_for_gun_ai_prob,
138: double go_for_health_ai_prob, double go_for_bullets_ai_prob, int check_range, int view_range):
139: """Init"""
+140: srand(random_seed)
srand(__pyx_v_random_seed);
+141: self.bullets_exponent = bullets_exponent
__pyx_v_self->bullets_exponent = __pyx_v_bullets_exponent;
+142: self.bullets_multiply = bullets_multiply
__pyx_v_self->bullets_multiply = __pyx_v_bullets_multiply;
+143: self.bullets_max_prob = bullets_max_prob
__pyx_v_self->bullets_max_prob = __pyx_v_bullets_max_prob;
144:
+145: self.health_exponent = health_exponent
__pyx_v_self->health_exponent = __pyx_v_health_exponent;
+146: self.health_multiply = health_multiply
__pyx_v_self->health_multiply = __pyx_v_health_multiply;
+147: self.health_max_prob = health_max_prob
__pyx_v_self->health_max_prob = __pyx_v_health_max_prob;
148:
+149: self.enemy_start_probability = enemy_start_probability
__pyx_v_self->enemy_start_probability = __pyx_v_enemy_start_probability;
+150: self.enemy_distance_divider = enemy_distance_divider
__pyx_v_self->enemy_distance_divider = __pyx_v_enemy_distance_divider;
+151: self.enemy_max_prob = enemy_max_prob
__pyx_v_self->enemy_max_prob = __pyx_v_enemy_max_prob;
152:
+153: self.guns_exponent = guns_exponent
__pyx_v_self->guns_exponent = __pyx_v_guns_exponent;
+154: self.guns_multiply = guns_multiply
__pyx_v_self->guns_multiply = __pyx_v_guns_multiply;
+155: self.guns_max_prob = guns_max_prob
__pyx_v_self->guns_max_prob = __pyx_v_guns_max_prob;
156:
+157: self.how_far_see_ai = how_far_see_ai
__pyx_v_self->how_far_see_ai = __pyx_v_how_far_see_ai;
+158: self.how_long_between_turn_ai = how_long_between_turn_ai
__pyx_v_self->how_long_between_turn_ai = __pyx_v_how_long_between_turn_ai;
+159: self.go_for_player_ai_prob = go_for_player_ai_prob
__pyx_v_self->go_for_player_ai_prob = __pyx_v_go_for_player_ai_prob;
+160: self.go_for_bullets_ai_prob = go_for_bullets_ai_prob
__pyx_v_self->go_for_bullets_ai_prob = __pyx_v_go_for_bullets_ai_prob;
+161: self.go_for_health_ai_prob = go_for_health_ai_prob
__pyx_v_self->go_for_health_ai_prob = __pyx_v_go_for_health_ai_prob;
+162: self.go_for_gun_ai_prob = go_for_gun_ai_prob
__pyx_v_self->go_for_gun_ai_prob = __pyx_v_go_for_gun_ai_prob;
163:
+164: self.move_flag = 0
__pyx_v_self->move_flag = 0;
+165: self.shoot_flag = 0
__pyx_v_self->shoot_flag = 0;
166:
+167: self.view_range = view_range
__pyx_v_self->view_range = __pyx_v_view_range;
+168: self.check_range = check_range
__pyx_v_self->check_range = __pyx_v_check_range;
169:
170: cdef int i, j
+171: self.rows = rows
__pyx_v_self->rows = __pyx_v_rows;
+172: self.cols = rows
__pyx_v_self->cols = __pyx_v_rows;
+173: self.pos_row = <int> (rows / 2)
__pyx_v_self->pos_row = ((int)__Pyx_div_long(__pyx_v_rows, 2));
+174: self.pos_col = <int> (rows / 2)
__pyx_v_self->pos_col = ((int)__Pyx_div_long(__pyx_v_rows, 2));
+175: self.mid_row = <int> (rows / 2)
__pyx_v_self->mid_row = ((int)__Pyx_div_long(__pyx_v_rows, 2));
+176: self.mid_col = <int> (rows / 2)
__pyx_v_self->mid_col = ((int)__Pyx_div_long(__pyx_v_rows, 2));
+177: self.map = <unsigned long long **> PyMem_Malloc(self.rows * sizeof(unsigned long long*))
__pyx_v_self->map = ((unsigned PY_LONG_LONG **)PyMem_Malloc((__pyx_v_self->rows * (sizeof(unsigned PY_LONG_LONG *)))));
178: # generate the map
+179: for i in range(self.rows):
__pyx_t_1 = __pyx_v_self->rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+180: self.map[i] = <unsigned long long *> PyMem_Malloc(self.cols * sizeof(unsigned long long))
(__pyx_v_self->map[__pyx_v_i]) = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_self->cols * (sizeof(unsigned PY_LONG_LONG)))));
+181: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+182: self.map[i][j] = GRASS
((__pyx_v_self->map[__pyx_v_i])[__pyx_v_j]) = __pyx_e_8worldmor_4game_4game_GRASS; } }
+183: for i in range(rows):
__pyx_t_1 = __pyx_v_rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+184: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+185: self.map[i][j] = self.generate_part_of_map(i, j)
((__pyx_v_self->map[__pyx_v_i])[__pyx_v_j]) = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->generate_part_of_map(__pyx_v_self, __pyx_v_i, __pyx_v_j); } }
186: # Set player character
+187: self.map[self.pos_row][self.pos_col] = self.to_health(100) + self.to_bullets(20) + \
((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]) = (((((((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, 0x64, 0) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_bullets(__pyx_v_self, 20, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 1, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, __pyx_e_8worldmor_4game_4game_GUN_B, 0)) + __pyx_e_8worldmor_4game_4game_PLAYER);
188: self.to_direction(1) + self.to_visible(1) + self.to_gun(GUN_B) + PLAYER
189:
+190: def __dealloc__(self):
/* Python wrapper */ static void __pyx_pw_8worldmor_4game_4game_8Worldmor_3__dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pw_8worldmor_4game_4game_8Worldmor_3__dealloc__(PyObject *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0); __pyx_pf_8worldmor_4game_4game_8Worldmor_2__dealloc__(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); } static void __pyx_pf_8worldmor_4game_4game_8Worldmor_2__dealloc__(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__dealloc__", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
+191: free_mem(self.map, self.rows)
__pyx_f_8worldmor_4game_4game_free_mem(__pyx_v_self->map, __pyx_v_self->rows);
192:
+193: cpdef unsigned long long to_health(self, unsigned long long health):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_5to_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_to_health(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_health, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_health", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_health); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_5to_health)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_health); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.to_health", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_5to_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_4to_health[] = "Convert health value to size(code) to save in map."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_5to_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health) { unsigned PY_LONG_LONG __pyx_v_health; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_health (wrapper)", 0); assert(__pyx_arg_health); { __pyx_v_health = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_health); if (unlikely((__pyx_v_health == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 193, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_health", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_4to_health(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_health)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_4to_health(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_health) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_health", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_to_health(__pyx_v_self, __pyx_v_health, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_health", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
194: """Convert health value to size(code) to save in map."""
+195: return health * 1000
__pyx_r = (__pyx_v_health * 0x3E8); goto __pyx_L0;
196:
+197: cpdef unsigned long long get_health(self, unsigned long long health):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_7get_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_get_health(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_health, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_health", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_health); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_7get_health)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_health); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_health", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_7get_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_6get_health[] = "Get health value from size(code) to number for represent and work."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_7get_health(PyObject *__pyx_v_self, PyObject *__pyx_arg_health) { unsigned PY_LONG_LONG __pyx_v_health; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_health (wrapper)", 0); assert(__pyx_arg_health); { __pyx_v_health = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_health); if (unlikely((__pyx_v_health == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_health", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_6get_health(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_health)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_6get_health(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_health) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_health", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_get_health(__pyx_v_self, __pyx_v_health, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_health", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
198: """Get health value from size(code) to number for represent and work."""
+199: return (<unsigned long long> (health / 1000)) % 1000
__pyx_r = (((unsigned PY_LONG_LONG)(__pyx_v_health / 0x3E8)) % 0x3E8); goto __pyx_L0;
200:
+201: cpdef unsigned long long to_bullets(self, unsigned long long bullets):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_9to_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_to_bullets(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_bullets, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_bullets", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_bullets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_9to_bullets)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_bullets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.to_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_9to_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_8to_bullets[] = "Convert bullets value to size(code) to save in map."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_9to_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets) { unsigned PY_LONG_LONG __pyx_v_bullets; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_bullets (wrapper)", 0); assert(__pyx_arg_bullets); { __pyx_v_bullets = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_bullets); if (unlikely((__pyx_v_bullets == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_8to_bullets(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_bullets)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_8to_bullets(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_bullets) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_bullets", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_to_bullets(__pyx_v_self, __pyx_v_bullets, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
202: """Convert bullets value to size(code) to save in map."""
+203: return bullets * 1000000
__pyx_r = (__pyx_v_bullets * 0xF4240); goto __pyx_L0;
204:
+205: cpdef unsigned long long get_bullets(self, unsigned long long bullets):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_11get_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_get_bullets(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_bullets, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_bullets", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_bullets); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_11get_bullets)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_bullets); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_11get_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_10get_bullets[] = "Get bullets value from size(code) to number for represent and work."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_11get_bullets(PyObject *__pyx_v_self, PyObject *__pyx_arg_bullets) { unsigned PY_LONG_LONG __pyx_v_bullets; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_bullets (wrapper)", 0); assert(__pyx_arg_bullets); { __pyx_v_bullets = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_bullets); if (unlikely((__pyx_v_bullets == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 205, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_10get_bullets(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_bullets)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_10get_bullets(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_bullets) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_bullets", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_get_bullets(__pyx_v_self, __pyx_v_bullets, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_bullets", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
206: """Get bullets value from size(code) to number for represent and work."""
+207: return (<unsigned long long> (bullets / 1000000)) % 1000
__pyx_r = (((unsigned PY_LONG_LONG)(__pyx_v_bullets / 0xF4240)) % 0x3E8); goto __pyx_L0;
208:
+209: cpdef unsigned long long to_visible(self, unsigned long long visible):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_13to_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_to_visible(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_visible, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_visible", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_visible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_13to_visible)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_visible); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.to_visible", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_13to_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_12to_visible[] = "Convert visible value to size(code) to save in map."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_13to_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible) { unsigned PY_LONG_LONG __pyx_v_visible; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_visible (wrapper)", 0); assert(__pyx_arg_visible); { __pyx_v_visible = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_visible); if (unlikely((__pyx_v_visible == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_visible", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_12to_visible(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_visible)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_12to_visible(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_visible) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_visible", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_to_visible(__pyx_v_self, __pyx_v_visible, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_visible", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
210: """Convert visible value to size(code) to save in map."""
+211: return visible * 100
__pyx_r = (__pyx_v_visible * 0x64); goto __pyx_L0;
212:
+213: cpdef unsigned long long get_visible(self, unsigned long long visible):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_15get_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_get_visible(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_visible, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_visible", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_visible); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_15get_visible)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_visible); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_visible", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_15get_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_14get_visible[] = "Get visible value from size(code) to number for represent and work."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_15get_visible(PyObject *__pyx_v_self, PyObject *__pyx_arg_visible) { unsigned PY_LONG_LONG __pyx_v_visible; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_visible (wrapper)", 0); assert(__pyx_arg_visible); { __pyx_v_visible = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_visible); if (unlikely((__pyx_v_visible == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_visible", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_14get_visible(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_visible)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_14get_visible(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_visible) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_visible", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_get_visible(__pyx_v_self, __pyx_v_visible, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 213, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_visible", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
214: """Get visible value from size(code) to number for represent and work."""
+215: return (<unsigned long long> (visible / 100)) % 10
__pyx_r = (((unsigned PY_LONG_LONG)(__pyx_v_visible / 0x64)) % 10); goto __pyx_L0;
216:
+217: cpdef unsigned long long to_direction(self, unsigned long long direction):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_17to_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_to_direction(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_direction, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_direction", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_direction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_17to_direction)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_direction); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.to_direction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_17to_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_16to_direction[] = "Convert direction value to size(code) to save in map."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_17to_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction) { unsigned PY_LONG_LONG __pyx_v_direction; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_direction (wrapper)", 0); assert(__pyx_arg_direction); { __pyx_v_direction = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_direction); if (unlikely((__pyx_v_direction == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_direction", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_16to_direction(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_direction)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_16to_direction(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_direction) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_direction", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_to_direction(__pyx_v_self, __pyx_v_direction, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 217, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_direction", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
218: """Convert direction value to size(code) to save in map."""
+219: return direction * 1000000000
__pyx_r = (__pyx_v_direction * 0x3B9ACA00); goto __pyx_L0;
220:
+221: cpdef unsigned long long get_direction(self, unsigned long long direction):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_19get_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_get_direction(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_direction, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_direction", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_direction); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_19get_direction)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_direction); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_direction", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_19get_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_18get_direction[] = "Get direction value from size(code) to number for represent and work."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_19get_direction(PyObject *__pyx_v_self, PyObject *__pyx_arg_direction) { unsigned PY_LONG_LONG __pyx_v_direction; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_direction (wrapper)", 0); assert(__pyx_arg_direction); { __pyx_v_direction = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_direction); if (unlikely((__pyx_v_direction == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_direction", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_18get_direction(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_direction)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_18get_direction(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_direction) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_direction", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_get_direction(__pyx_v_self, __pyx_v_direction, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 221, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_direction", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
222: """Get direction value from size(code) to number for represent and work."""
+223: return (<unsigned long long> (direction / 1000000000)) % 10
__pyx_r = (((unsigned PY_LONG_LONG)(__pyx_v_direction / 0x3B9ACA00)) % 10); goto __pyx_L0;
224:
+225: cpdef unsigned long long to_gun(self, unsigned long long gun):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_21to_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_to_gun(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_gun, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_gun", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_to_gun); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_21to_gun)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_gun); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.to_gun", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_21to_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_20to_gun[] = "Convert gun id value to size(code) to save in map."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_21to_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun) { unsigned PY_LONG_LONG __pyx_v_gun; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_gun (wrapper)", 0); assert(__pyx_arg_gun); { __pyx_v_gun = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_gun); if (unlikely((__pyx_v_gun == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_gun", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_20to_gun(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_gun)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_20to_gun(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_gun) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("to_gun", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_to_gun(__pyx_v_self, __pyx_v_gun, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.to_gun", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
226: """Convert gun id value to size(code) to save in map."""
+227: return gun * <unsigned long long>10000000000
__pyx_r = (__pyx_v_gun * ((unsigned PY_LONG_LONG)0x2540BE400)); goto __pyx_L0;
228:
+229: cpdef unsigned long long get_gun(self, unsigned long long gun):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_23get_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun); /*proto*/ static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_get_gun(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_gun, int __pyx_skip_dispatch) { unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_gun", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_gun); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_23get_gun)) { __pyx_t_3 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_v_gun); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_t_2); if (unlikely((__pyx_t_6 == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_gun", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_23get_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_22get_gun[] = "Get gun value from size(code) to number for represent and work."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_23get_gun(PyObject *__pyx_v_self, PyObject *__pyx_arg_gun) { unsigned PY_LONG_LONG __pyx_v_gun; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_gun (wrapper)", 0); assert(__pyx_arg_gun); { __pyx_v_gun = __Pyx_PyInt_As_unsigned_PY_LONG_LONG(__pyx_arg_gun); if (unlikely((__pyx_v_gun == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_gun", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_22get_gun(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((unsigned PY_LONG_LONG)__pyx_v_gun)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_22get_gun(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, unsigned PY_LONG_LONG __pyx_v_gun) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_gun", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_unsigned_PY_LONG_LONG(__pyx_f_8worldmor_4game_4game_8Worldmor_get_gun(__pyx_v_self, __pyx_v_gun, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_gun", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
230: """Get gun value from size(code) to number for represent and work."""
+231: return (<unsigned long long> (gun / <unsigned long long>10000000000)) % 100
__pyx_r = (((unsigned PY_LONG_LONG)(__pyx_v_gun / ((unsigned PY_LONG_LONG)0x2540BE400))) % 0x64); goto __pyx_L0;
232:
+233: cpdef void left(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_25left(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_left(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("left", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_left); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_25left)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.left", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_25left(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_24left[] = "Set flag to want move left. In do_one_time_moment will be move done."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_25left(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("left (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_24left(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_24left(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("left", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_left(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.left", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
234: """Set flag to want move left. In do_one_time_moment will be move done."""
+235: self.move_flag = 4
__pyx_v_self->move_flag = 4;
236:
+237: cpdef void right(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_27right(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_right(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("right", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_right); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_27right)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.right", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_27right(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_26right[] = "Set flag to want move right. In do_one_time_moment will be move done."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_27right(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("right (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_26right(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_26right(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("right", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_right(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.right", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
238: """Set flag to want move right. In do_one_time_moment will be move done."""
+239: self.move_flag = 2
__pyx_v_self->move_flag = 2;
240:
+241: cpdef void up(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_29up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_up(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("up", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_up); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_29up)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.up", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_29up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_28up[] = "Set flag to want move up. In do_one_time_moment will be move done."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_29up(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("up (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_28up(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_28up(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("up", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_up(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.up", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
242: """Set flag to want move up. In do_one_time_moment will be move done."""
+243: self.move_flag = 1
__pyx_v_self->move_flag = 1;
244:
+245: cpdef void down(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_31down(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_down(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("down", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_down); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_31down)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.down", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_31down(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_30down[] = "Set flag to want move down. In do_one_time_moment will be move done."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_31down(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("down (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_30down(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_30down(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("down", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_down(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.down", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
246: """Set flag to want move down. In do_one_time_moment will be move done."""
+247: self.move_flag = 3
__pyx_v_self->move_flag = 3;
248:
+249: cpdef void shoot(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_33shoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_shoot(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("shoot", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shoot); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_33shoot)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.shoot", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_33shoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_32shoot[] = "Set shoot flag for wanting shoot in this time moment. \n Flag 1 for shoot before move and 2 for shoot after move.\n "; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_33shoot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("shoot (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_32shoot(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_32shoot(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("shoot", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_shoot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.shoot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
250: """Set shoot flag for wanting shoot in this time moment.
251: Flag 1 for shoot before move and 2 for shoot after move.
252: """
+253: if self.move_flag == 0:
__pyx_t_5 = ((__pyx_v_self->move_flag == 0) != 0); if (__pyx_t_5) { /* … */ goto __pyx_L3; }
+254: self.shoot_flag = 1
__pyx_v_self->shoot_flag = 1;
255: else:
+256: self.shoot_flag = 2
/*else*/ { __pyx_v_self->shoot_flag = 2; } __pyx_L3:;
257:
+258: cpdef int do_one_time_moment(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_35do_one_time_moment(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_do_one_time_moment(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_v_move_value; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_one_time_moment", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_do_one_time_moment); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_35do_one_time_moment)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.do_one_time_moment", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_35do_one_time_moment(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_34do_one_time_moment[] = "The method does move or shoot at a given time, for the player and enemy.\n Flags set between time and actions are checked for creating move or shoot. \n Even in this step are make the AI actions.\n "; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_35do_one_time_moment(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_one_time_moment (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_34do_one_time_moment(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_34do_one_time_moment(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_one_time_moment", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_do_one_time_moment(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 258, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.do_one_time_moment", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
259: """The method does move or shoot at a given time, for the player and enemy.
260: Flags set between time and actions are checked for creating move or shoot.
261: Even in this step are make the AI actions.
262: """
263: # check the set flags
264:
265: # shoot before move
+266: if self.shoot_flag == 1:
__pyx_t_6 = ((__pyx_v_self->shoot_flag == 1) != 0); if (__pyx_t_6) { /* … */ }
+267: self.do_shoot(self.pos_row, self.pos_col, self.get_direction(self.map[self.pos_row][self.pos_col]))
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0));
268: # move and collect
+269: cdef int move_value = 0
__pyx_v_move_value = 0;
+270: if self.move_flag == 1:
switch (__pyx_v_self->move_flag) { case 1: /* … */ break; case 2:
+271: move_value = self.do_move(self.pos_row, self.pos_col, self.pos_row - 1, self.pos_col)
__pyx_v_move_value = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, (__pyx_v_self->pos_row - 1), __pyx_v_self->pos_col);
+272: if move_value >= 1:
__pyx_t_6 = ((__pyx_v_move_value >= 1) != 0); if (__pyx_t_6) { /* … */ }
+273: self.pos_row -= 1
__pyx_v_self->pos_row = (__pyx_v_self->pos_row - 1);
+274: self.map[self.pos_row][self.pos_col] += self.to_direction(1) - self.to_direction(
__pyx_t_5 = __pyx_v_self->pos_row; __pyx_t_7 = __pyx_v_self->pos_col; /* … */ ((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) = (((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) + (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 1, 0) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0), 0)));
275: self.get_direction(self.map[self.pos_row][self.pos_col]))
276:
+277: elif self.move_flag == 2:
break; case 3:
+278: move_value = self.do_move(self.pos_row, self.pos_col, self.pos_row, self.pos_col + 1)
__pyx_v_move_value = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, __pyx_v_self->pos_row, (__pyx_v_self->pos_col + 1));
+279: if move_value >= 1:
__pyx_t_6 = ((__pyx_v_move_value >= 1) != 0); if (__pyx_t_6) { /* … */ }
+280: self.pos_col += 1
__pyx_v_self->pos_col = (__pyx_v_self->pos_col + 1);
+281: self.map[self.pos_row][self.pos_col] += self.to_direction(2) - \
__pyx_t_5 = __pyx_v_self->pos_row; __pyx_t_7 = __pyx_v_self->pos_col; /* … */ ((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) = (((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) + (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 2, 0) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0), 0)));
282: self.to_direction(
283: self.get_direction(self.map[self.pos_row][self.pos_col]))
+284: elif self.move_flag == 3:
break; case 4:
+285: move_value = self.do_move(self.pos_row, self.pos_col, self.pos_row + 1, self.pos_col)
__pyx_v_move_value = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, (__pyx_v_self->pos_row + 1), __pyx_v_self->pos_col);
+286: if move_value >= 1:
__pyx_t_6 = ((__pyx_v_move_value >= 1) != 0); if (__pyx_t_6) { /* … */ }
+287: self.pos_row += 1
__pyx_v_self->pos_row = (__pyx_v_self->pos_row + 1);
+288: self.map[self.pos_row][self.pos_col] += self.to_direction(3) - \
__pyx_t_5 = __pyx_v_self->pos_row; __pyx_t_7 = __pyx_v_self->pos_col; /* … */ ((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) = (((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) + (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 3, 0) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0), 0)));
289: self.to_direction(
290: self.get_direction(self.map[self.pos_row][self.pos_col]))
+291: elif self.move_flag == 4:
break; default: break; }
+292: move_value = self.do_move(self.pos_row, self.pos_col, self.pos_row, self.pos_col - 1)
__pyx_v_move_value = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, __pyx_v_self->pos_row, (__pyx_v_self->pos_col - 1));
+293: if move_value >= 1:
__pyx_t_6 = ((__pyx_v_move_value >= 1) != 0); if (__pyx_t_6) { /* … */ }
+294: self.pos_col -= 1
__pyx_v_self->pos_col = (__pyx_v_self->pos_col - 1);
+295: self.map[self.pos_row][self.pos_col] += self.to_direction(4) - \
__pyx_t_5 = __pyx_v_self->pos_row; __pyx_t_7 = __pyx_v_self->pos_col; /* … */ ((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) = (((__pyx_v_self->map[__pyx_t_5])[__pyx_t_7]) + (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 4, 0) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0), 0)));
296: self.to_direction(
297: self.get_direction(self.map[self.pos_row][self.pos_col]))
298: # shoot after move
+299: if self.shoot_flag == 2:
__pyx_t_6 = ((__pyx_v_self->shoot_flag == 2) != 0); if (__pyx_t_6) { /* … */ }
+300: self.do_shoot(self.pos_row, self.pos_col, self.get_direction(self.map[self.pos_row][self.pos_col]))
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_self->pos_row, __pyx_v_self->pos_col, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]), 0));
301: # there are do the ai steps
+302: self.recalculate_map_range()
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->recalculate_map_range(__pyx_v_self);
+303: self.shoot_flag = 0
__pyx_v_self->shoot_flag = 0;
+304: self.move_flag = 0
__pyx_v_self->move_flag = 0;
305:
+306: if self.map[self.pos_row][self.pos_col] % 100 == BLOOD:
__pyx_t_6 = (((((__pyx_v_self->map[__pyx_v_self->pos_row])[__pyx_v_self->pos_col]) % 0x64) == __pyx_e_8worldmor_4game_4game_BLOOD) != 0); if (__pyx_t_6) { /* … */ }
+307: return -1
__pyx_r = -1; goto __pyx_L0;
+308: if move_value == 2:
__pyx_t_6 = ((__pyx_v_move_value == 2) != 0); if (__pyx_t_6) { /* … */ }
+309: return ADD_POINTS
__pyx_r = __pyx_v_8worldmor_4game_4game_ADD_POINTS; goto __pyx_L0;
310: else:
+311: return 0
/*else*/ { __pyx_r = 0; goto __pyx_L0; }
312:
313: @cython.boundscheck(False)
+314: cdef void do_shoot(self, int row, int col, int direction):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_do_shoot(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col, int __pyx_v_direction) { int __pyx_v_bullets; int __pyx_v_gun; int __pyx_v_down_bullets; int __pyx_v_check_col; int __pyx_v_row_min; int __pyx_v_row_max; int __pyx_v_row_step; int __pyx_v_col_min; int __pyx_v_col_max; int __pyx_v_col_step; int __pyx_v_code; int __pyx_v_check_health; int __pyx_v_kill; int __pyx_v_br; int __pyx_v_strong; int __pyx_v_distance; CYTHON_UNUSED long __pyx_v_to_col; CYTHON_UNUSED long __pyx_v_to_row; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_shoot", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); }
315: """Method for doing shoot logic for the one field with player or enemy.
316: Check bullets, gun and do shoot logic.
317: When kill adds score blood to map.
318:
319: :param row: row position
320: :param col: col position
321: """
322: # check bullets
+323: cdef int bullets = self.get_bullets(self.map[row][col])
__pyx_v_bullets = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0);
+324: cdef int gun = self.get_gun(self.map[row][col])
__pyx_v_gun = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0);
+325: cdef int down_bullets = self.get_bullets_dec(gun)
__pyx_v_down_bullets = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets_dec(__pyx_v_self, __pyx_v_gun);
+326: if bullets - down_bullets < 0: return
__pyx_t_1 = (((__pyx_v_bullets - __pyx_v_down_bullets) < 0) != 0); if (__pyx_t_1) { goto __pyx_L0; }
+327: cdef int check_col, row_min, row_max, row_step = 1, col_min, col_max, col_step = 1, code, check_health
__pyx_v_row_step = 1; __pyx_v_col_step = 1;
+328: cdef int kill = 0, br = 0, strong, distance
__pyx_v_kill = 0; __pyx_v_br = 0;
329: # get gun parameters
+330: self.map[row][col] -= self.to_bullets(down_bullets)
__pyx_t_2 = __pyx_v_row; __pyx_t_3 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_bullets(__pyx_v_self, __pyx_v_down_bullets, 0));
+331: strong = self.get_strong(gun)
__pyx_v_strong = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_strong(__pyx_v_self, __pyx_v_gun);
+332: distance = self.get_distance(gun)
__pyx_v_distance = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_distance(__pyx_v_self, __pyx_v_gun);
333: # direction of shoot
+334: distance += 1
__pyx_v_distance = (__pyx_v_distance + 1);
+335: if direction == 1:
switch (__pyx_v_direction) { case 1: /* … */ break; case 2:
+336: col_min = col
__pyx_v_col_min = __pyx_v_col;
+337: col_max = col + 1
__pyx_v_col_max = (__pyx_v_col + 1);
+338: row_min = row - 1
__pyx_v_row_min = (__pyx_v_row - 1);
+339: row_max = row - distance
__pyx_v_row_max = (__pyx_v_row - __pyx_v_distance);
+340: row_step = -1
__pyx_v_row_step = -1;
+341: to_col = col
__pyx_v_to_col = __pyx_v_col;
+342: to_row = row - distance + 1
__pyx_v_to_row = ((__pyx_v_row - __pyx_v_distance) + 1);
+343: elif direction == 2:
break; case 3:
+344: row_min = row
__pyx_v_row_min = __pyx_v_row;
+345: row_max = row + 1
__pyx_v_row_max = (__pyx_v_row + 1);
+346: col_min = col + 1
__pyx_v_col_min = (__pyx_v_col + 1);
+347: col_max = col + distance
__pyx_v_col_max = (__pyx_v_col + __pyx_v_distance);
+348: to_row = row
__pyx_v_to_row = __pyx_v_row;
+349: to_col = col + distance - 1
__pyx_v_to_col = ((__pyx_v_col + __pyx_v_distance) - 1);
+350: elif direction == 3:
break; default:
+351: col_min = col
__pyx_v_col_min = __pyx_v_col;
+352: col_max = col + 1
__pyx_v_col_max = (__pyx_v_col + 1);
+353: row_min = row + 1
__pyx_v_row_min = (__pyx_v_row + 1);
+354: row_max = row + distance
__pyx_v_row_max = (__pyx_v_row + __pyx_v_distance);
+355: to_col = col
__pyx_v_to_col = __pyx_v_col;
+356: to_row = row + distance - 1
__pyx_v_to_row = ((__pyx_v_row + __pyx_v_distance) - 1);
357: else:
+358: row_min = row
__pyx_v_row_min = __pyx_v_row;
+359: row_max = row + 1
__pyx_v_row_max = (__pyx_v_row + 1);
+360: col_min = col - 1
__pyx_v_col_min = (__pyx_v_col - 1);
+361: col_max = col - distance
__pyx_v_col_max = (__pyx_v_col - __pyx_v_distance);
+362: col_step = -1
__pyx_v_col_step = -1;
+363: to_row = row
__pyx_v_to_row = __pyx_v_row;
+364: to_col = col - distance + 1
__pyx_v_to_col = ((__pyx_v_col - __pyx_v_distance) + 1); break; }
+365: check_col = col_min
__pyx_v_check_col = __pyx_v_col_min;
366: # check the bullet trajectory
+367: while row_min != row_max:
while (1) { __pyx_t_1 = ((__pyx_v_row_min != __pyx_v_row_max) != 0); if (!__pyx_t_1) break;
+368: col_min = check_col
__pyx_v_col_min = __pyx_v_check_col;
+369: while col_min != col_max:
while (1) { __pyx_t_1 = ((__pyx_v_col_min != __pyx_v_col_max) != 0); if (!__pyx_t_1) break;
+370: if row_min < 0 or row_min >= self.rows or col_min < 0 or col_min >= self.cols:
__pyx_t_4 = ((__pyx_v_row_min < 0) != 0); if (!__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L9_bool_binop_done; } __pyx_t_4 = ((__pyx_v_row_min >= __pyx_v_self->rows) != 0); if (!__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L9_bool_binop_done; } __pyx_t_4 = ((__pyx_v_col_min < 0) != 0); if (!__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L9_bool_binop_done; } __pyx_t_4 = ((__pyx_v_col_min >= __pyx_v_self->cols) != 0); __pyx_t_1 = __pyx_t_4; __pyx_L9_bool_binop_done:; if (__pyx_t_1) { /* … */ }
+371: continue
goto __pyx_L6_continue;
+372: code = self.map[row_min][col_min] % 100
__pyx_v_code = (((__pyx_v_self->map[__pyx_v_row_min])[__pyx_v_col_min]) % 0x64);
+373: if code == WALL:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_WALL) != 0); if (__pyx_t_1) { /* … */ }
+374: check_health = self.get_health(self.map[row_min][col_min]) - strong
__pyx_v_check_health = (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row_min])[__pyx_v_col_min]), 0) - __pyx_v_strong);
+375: if check_health <= 0:
__pyx_t_1 = ((__pyx_v_check_health <= 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L14; }
+376: kill = 2
__pyx_v_kill = 2;
377: else:
+378: self.map[row_min][col_min] -= self.to_health(strong)
/*else*/ { __pyx_t_2 = __pyx_v_row_min; __pyx_t_3 = __pyx_v_col_min; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, __pyx_v_strong, 0)); } __pyx_L14:;
+379: row_min += row_step
__pyx_v_row_min = (__pyx_v_row_min + __pyx_v_row_step);
+380: col_min += col_step
__pyx_v_col_min = (__pyx_v_col_min + __pyx_v_col_step);
+381: br = 1
__pyx_v_br = 1;
+382: break
goto __pyx_L7_break;
+383: if code == PLAYER:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_PLAYER) != 0); if (__pyx_t_1) { /* … */ }
+384: check_health = self.get_health(self.map[row_min][col_min]) - strong
__pyx_v_check_health = (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row_min])[__pyx_v_col_min]), 0) - __pyx_v_strong);
+385: if check_health <= 0:
__pyx_t_1 = ((__pyx_v_check_health <= 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L16; }
+386: kill = 1
__pyx_v_kill = 1;
387: else:
+388: self.map[row_min][col_min] -= self.to_health(strong)
/*else*/ { __pyx_t_2 = __pyx_v_row_min; __pyx_t_3 = __pyx_v_col_min; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, __pyx_v_strong, 0)); } __pyx_L16:;
+389: row_min += row_step
__pyx_v_row_min = (__pyx_v_row_min + __pyx_v_row_step);
+390: col_min += col_step
__pyx_v_col_min = (__pyx_v_col_min + __pyx_v_col_step);
+391: br = 1
__pyx_v_br = 1;
+392: break
goto __pyx_L7_break;
+393: if ENEMY_E >= code >= ENEMY_B:
__pyx_t_1 = (__pyx_e_8worldmor_4game_4game_ENEMY_E >= __pyx_v_code); if (__pyx_t_1) { __pyx_t_1 = (__pyx_v_code >= __pyx_e_8worldmor_4game_4game_ENEMY_B); } __pyx_t_4 = (__pyx_t_1 != 0); if (__pyx_t_4) { /* … */ }
+394: check_health = self.get_health(self.map[row_min][col_min]) - strong
__pyx_v_check_health = (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row_min])[__pyx_v_col_min]), 0) - __pyx_v_strong);
+395: if check_health <= 0:
__pyx_t_4 = ((__pyx_v_check_health <= 0) != 0); if (__pyx_t_4) { /* … */ goto __pyx_L18; }
+396: kill = 1
__pyx_v_kill = 1;
397: else:
+398: self.map[row_min][col_min] -= self.to_health(strong)
/*else*/ { __pyx_t_2 = __pyx_v_row_min; __pyx_t_3 = __pyx_v_col_min; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, __pyx_v_strong, 0)); } __pyx_L18:;
+399: row_min += row_step
__pyx_v_row_min = (__pyx_v_row_min + __pyx_v_row_step);
+400: col_min += col_step
__pyx_v_col_min = (__pyx_v_col_min + __pyx_v_col_step);
+401: br = 1
__pyx_v_br = 1;
+402: break
goto __pyx_L7_break;
+403: col_min += col_step
__pyx_v_col_min = (__pyx_v_col_min + __pyx_v_col_step); __pyx_L6_continue:; } __pyx_L7_break:;
+404: if br == 1:
__pyx_t_4 = ((__pyx_v_br == 1) != 0); if (__pyx_t_4) { /* … */ }
+405: break
goto __pyx_L5_break;
+406: row_min += row_step
__pyx_v_row_min = (__pyx_v_row_min + __pyx_v_row_step); } __pyx_L5_break:;
+407: if kill == 1:
switch (__pyx_v_kill) { case 1: /* … */ break; case 2:
408: # add blood to map to can collect points after kill enemies
+409: self.map[row_min-row_step][col_min-col_step] = self.to_visible(1) + BLOOD
((__pyx_v_self->map[(__pyx_v_row_min - __pyx_v_row_step)])[(__pyx_v_col_min - __pyx_v_col_step)]) = (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0) + __pyx_e_8worldmor_4game_4game_BLOOD);
+410: elif kill == 2:
break; default:
411: # no blood after kill wall
+412: self.map[row_min-row_step][col_min-col_step] = self.to_visible(1) + GRASS
((__pyx_v_self->map[(__pyx_v_row_min - __pyx_v_row_step)])[(__pyx_v_col_min - __pyx_v_col_step)]) = (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0) + __pyx_e_8worldmor_4game_4game_GRASS);
413: else:
414: # add shoot explosion for some time
+415: self.map[row_min-row_step][col_min-col_step] += \
__pyx_t_2 = (__pyx_v_row_min - __pyx_v_row_step); __pyx_t_3 = (__pyx_v_col_min - __pyx_v_col_step); /* … */ ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, (9 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_visible(__pyx_v_self, ((__pyx_v_self->map[(__pyx_v_row_min - __pyx_v_row_step)])[(__pyx_v_col_min - __pyx_v_col_step)]), 0)), 0)); break; }
416: self.to_visible(9 - self.get_visible(self.map[row_min-row_step][col_min-col_step]))
417:
+418: cdef int get_strong(self, int gun):
static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_strong(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_gun) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_strong", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
419: """Return gun strong based on the gun code."""
+420: if gun == GUN_E:
switch (__pyx_v_gun) { case __pyx_e_8worldmor_4game_4game_GUN_E: /* … */ break; case __pyx_e_8worldmor_4game_4game_GUN_1:
+421: return GUN_E_STRONG
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_E_STRONG; goto __pyx_L0;
+422: elif gun == GUN_1:
break; case __pyx_e_8worldmor_4game_4game_GUN_2:
+423: return GUN_1_STRONG
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_1_STRONG; goto __pyx_L0;
+424: elif gun == GUN_2:
break; case __pyx_e_8worldmor_4game_4game_GUN_3:
+425: return GUN_2_STRONG
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_2_STRONG; goto __pyx_L0;
+426: elif gun == GUN_3:
break; default:
+427: return GUN_3_STRONG
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_3_STRONG; goto __pyx_L0;
428: else:
+429: return GUN_B_STRONG
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_B_STRONG; goto __pyx_L0; break; }
430:
+431: cdef int get_distance(self, int gun):
static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_distance(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_gun) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_distance", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
432: """Return gun range of shoot based on the gun code."""
+433: if gun == GUN_E:
switch (__pyx_v_gun) { case __pyx_e_8worldmor_4game_4game_GUN_E: /* … */ break; case __pyx_e_8worldmor_4game_4game_GUN_1:
+434: return GUN_E_DISTANCE
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_E_DISTANCE; goto __pyx_L0;
+435: elif gun == GUN_1:
break; case __pyx_e_8worldmor_4game_4game_GUN_2:
+436: return GUN_1_DISTANCE
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_1_DISTANCE; goto __pyx_L0;
+437: elif gun == GUN_2:
break; case __pyx_e_8worldmor_4game_4game_GUN_3:
+438: return GUN_2_DISTANCE
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_2_DISTANCE; goto __pyx_L0;
+439: elif gun == GUN_3:
break; default:
+440: return GUN_3_DISTANCE
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_3_DISTANCE; goto __pyx_L0;
441: else:
+442: return GUN_B_DISTANCE
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_B_DISTANCE; goto __pyx_L0; break; }
443:
+444: cdef int get_bullets_dec(self, int gun):
static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_bullets_dec(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_gun) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_bullets_dec", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
445: """Return gun bullet cost based on the gun code."""
+446: if gun == GUN_E:
switch (__pyx_v_gun) { case __pyx_e_8worldmor_4game_4game_GUN_E: /* … */ break; case __pyx_e_8worldmor_4game_4game_GUN_1:
+447: return GUN_E_BULLETS
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_E_BULLETS; goto __pyx_L0;
+448: elif gun == GUN_1:
break; case __pyx_e_8worldmor_4game_4game_GUN_2:
+449: return GUN_1_BULLETS
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_1_BULLETS; goto __pyx_L0;
+450: elif gun == GUN_2:
break; case __pyx_e_8worldmor_4game_4game_GUN_3:
+451: return GUN_2_BULLETS
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_2_BULLETS; goto __pyx_L0;
+452: elif gun == GUN_3:
break; default:
+453: return GUN_3_BULLETS
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_3_BULLETS; goto __pyx_L0;
454: else:
+455: return GUN_B_BULLETS
__pyx_r = __pyx_v_8worldmor_4game_4game_GUN_B_BULLETS; goto __pyx_L0; break; }
456:
457: @cython.boundscheck(False)
+458: cdef int do_move(self, int old_row, int old_col, int new_row, int new_col):
static int __pyx_f_8worldmor_4game_4game_8Worldmor_do_move(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_old_row, int __pyx_v_old_col, int __pyx_v_new_row, int __pyx_v_new_col) { int __pyx_v_code; int __pyx_v_do; unsigned PY_LONG_LONG __pyx_v_add; unsigned PY_LONG_LONG __pyx_v_visible_old; unsigned PY_LONG_LONG __pyx_v_visible_new; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("do_move", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
459: """Method to perform moves at a given position,
460: the movement is performed if there is no other character or wall.
461: Also, some items may be collected.
462:
463: :param old_row: previous row position
464: :param old_col: previous columns position
465: :param new_row: new row position
466: :param new_col: new column position
467: :return: 1 if the character rolls or 0 if not.
468: """
469: cdef int code
+470: cdef int do = 0
__pyx_v_do = 0;
+471: cdef unsigned long long add = 0, visible_old, visible_new
__pyx_v_add = 0;
+472: if new_row < 0 or new_row >= self.rows or new_col < 0 or new_col >= self.cols or \
__pyx_t_2 = ((__pyx_v_new_row < 0) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_new_row >= __pyx_v_self->rows) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_new_col < 0) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_new_col >= __pyx_v_self->cols) != 0); if (!__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } /* … */ if (__pyx_t_1) { /* … */ }
+473: (old_col == new_col and old_row == new_row):
__pyx_t_2 = ((__pyx_v_old_col == __pyx_v_new_col) != 0); if (__pyx_t_2) { } else { __pyx_t_1 = __pyx_t_2; goto __pyx_L4_bool_binop_done; } __pyx_t_2 = ((__pyx_v_old_row == __pyx_v_new_row) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:;
+474: return 0
__pyx_r = 0; goto __pyx_L0;
+475: code = self.map[new_row][new_col] % 100
__pyx_v_code = (((__pyx_v_self->map[__pyx_v_new_row])[__pyx_v_new_col]) % 0x64);
476: # check code of new field and do the steps for the character
+477: if code == GRASS or code == BLOOD:
switch (__pyx_v_code) { case __pyx_e_8worldmor_4game_4game_GRASS: case __pyx_e_8worldmor_4game_4game_BLOOD: /* … */ break; default: break; }
+478: do = 1
__pyx_v_do = 1;
+479: if code == HEALTH:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_HEALTH) != 0); if (__pyx_t_1) { /* … */ }
+480: do = 1
__pyx_v_do = 1;
+481: add = self.to_health(min((<int>self.get_health(self.map[old_row][old_col])) +
__pyx_t_4 = (((int)((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)) + __pyx_v_8worldmor_4game_4game_HEALTH_ADD); /* … */ __pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, (__pyx_t_5 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+482: HEALTH_ADD, MAX_HEALTH)-self.get_health(self.map[old_row][old_col]))
__pyx_t_3 = __pyx_v_8worldmor_4game_4game_MAX_HEALTH; /* … */ if (((__pyx_t_3 < __pyx_t_4) != 0)) { __pyx_t_5 = __pyx_t_3; } else { __pyx_t_5 = __pyx_t_4; }
483:
+484: if code == BULLET:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_BULLET) != 0); if (__pyx_t_1) { /* … */ }
+485: do = 1
__pyx_v_do = 1;
+486: add = self.to_bullets(min((<int>self.get_bullets(self.map[old_row][old_col])) +
__pyx_t_3 = (((int)((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)) + __pyx_v_8worldmor_4game_4game_BULLETS_ADD); /* … */ __pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_bullets(__pyx_v_self, (__pyx_t_4 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+487: BULLETS_ADD, MAX_BULLETS)-self.get_bullets(self.map[old_row][old_col]))
__pyx_t_5 = __pyx_v_8worldmor_4game_4game_MAX_BULLETS; /* … */ if (((__pyx_t_5 < __pyx_t_3) != 0)) { __pyx_t_4 = __pyx_t_5; } else { __pyx_t_4 = __pyx_t_3; }
+488: if code == GUN_B:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_GUN_B) != 0); if (__pyx_t_1) { /* … */ }
+489: do = 1
__pyx_v_do = 1;
+490: add = self.to_gun(GUN_B - self.get_gun(self.map[old_row][old_col]))
__pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, (__pyx_e_8worldmor_4game_4game_GUN_B - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+491: if code == GUN_1:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_GUN_1) != 0); if (__pyx_t_1) { /* … */ }
+492: do = 1
__pyx_v_do = 1;
+493: add = self.to_gun(GUN_1 - self.get_gun(self.map[old_row][old_col]))
__pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, (__pyx_e_8worldmor_4game_4game_GUN_1 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+494: if code == GUN_2:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_GUN_2) != 0); if (__pyx_t_1) { /* … */ }
+495: do = 1
__pyx_v_do = 1;
+496: add = self.to_gun(GUN_2 - self.get_gun(self.map[old_row][old_col]))
__pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, (__pyx_e_8worldmor_4game_4game_GUN_2 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+497: if code == GUN_3:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_GUN_3) != 0); if (__pyx_t_1) { /* … */ }
+498: do = 1
__pyx_v_do = 1;
+499: add = self.to_gun(GUN_3 - self.get_gun(self.map[old_row][old_col]))
__pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, (__pyx_e_8worldmor_4game_4game_GUN_3 - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+500: if code == GUN_E:
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_GUN_E) != 0); if (__pyx_t_1) { /* … */ }
+501: do = 1
__pyx_v_do = 1;
+502: add = self.to_gun(GUN_E - self.get_gun(self.map[old_row][old_col]))
__pyx_v_add = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, (__pyx_e_8worldmor_4game_4game_GUN_E - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0)), 0);
+503: if do == 1:
__pyx_t_1 = ((__pyx_v_do == 1) != 0); if (__pyx_t_1) { /* … */ }
+504: visible_old = self.get_visible(self.map[old_row][old_col])
__pyx_v_visible_old = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_visible(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]), 0);
+505: visible_new = self.get_visible(self.map[new_row][new_col])
__pyx_v_visible_new = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_visible(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_new_row])[__pyx_v_new_col]), 0);
+506: self.map[new_row][new_col] = self.map[old_row][old_col] + add - \
((__pyx_v_self->map[__pyx_v_new_row])[__pyx_v_new_col]) = (((((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]) + __pyx_v_add) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, __pyx_v_visible_old, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, __pyx_v_visible_new, 0));
507: self.to_visible(visible_old) + self.to_visible(visible_new)
+508: self.map[old_row][old_col] = 0 + self.to_visible(visible_old)
((__pyx_v_self->map[__pyx_v_old_row])[__pyx_v_old_col]) = (0 + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, __pyx_v_visible_old, 0));
+509: if code == BLOOD: return 2
__pyx_t_1 = ((__pyx_v_code == __pyx_e_8worldmor_4game_4game_BLOOD) != 0); if (__pyx_t_1) { __pyx_r = 2; goto __pyx_L0; }
+510: else: return 1
/*else*/ { __pyx_r = 1; goto __pyx_L0; }
+511: return 0
__pyx_r = 0; goto __pyx_L0;
512:
513: @cython.boundscheck(False)
+514: cdef void recalculate_map_range(self):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_recalculate_map_range(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { int __pyx_v_row; int __pyx_v_col; double __pyx_v_distance; unsigned PY_LONG_LONG __pyx_v_visibility; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("recalculate_map_range", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
515: """Check specific map range and check visibilities,
516: find enemy and do their AI steps.
517: Manage visibility of the map.
518: """
519: cdef int row, col
520: cdef double distance
521: cdef unsigned long long visibility
522: # Calculate possibly range where can change the visibility
+523: for row in range(self.pos_row - self.check_range, self.pos_row + self.check_range + 1):
__pyx_t_1 = ((__pyx_v_self->pos_row + __pyx_v_self->check_range) + 1); __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = (__pyx_v_self->pos_row - __pyx_v_self->check_range); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_row = __pyx_t_3;
+524: for col in range(self.pos_col - self.check_range, self.pos_col + self.check_range + 1):
__pyx_t_4 = ((__pyx_v_self->pos_col + __pyx_v_self->check_range) + 1); __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = (__pyx_v_self->pos_col - __pyx_v_self->check_range); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_col = __pyx_t_6;
+525: if row < 0 or row >= self.rows or col < 0 or col >= self.cols:
__pyx_t_8 = ((__pyx_v_row < 0) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_row >= __pyx_v_self->rows) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_col < 0) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_col >= __pyx_v_self->cols) != 0); __pyx_t_7 = __pyx_t_8; __pyx_L8_bool_binop_done:; if (__pyx_t_7) { /* … */ }
+526: continue
goto __pyx_L5_continue;
+527: if ENEMY_B <= self.map[row][col] % 100 <= ENEMY_E:
__pyx_t_9 = (((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]) % 0x64); __pyx_t_7 = (__pyx_e_8worldmor_4game_4game_ENEMY_B <= __pyx_t_9); if (__pyx_t_7) { __pyx_t_7 = (__pyx_t_9 <= __pyx_e_8worldmor_4game_4game_ENEMY_E); } __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ }
+528: self.enemy_ai(row, col)
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->enemy_ai(__pyx_v_self, __pyx_v_row, __pyx_v_col);
+529: distance = self.e_distance(row, col, self.pos_row, self.pos_col)
__pyx_v_distance = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->e_distance(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_v_self->pos_row, __pyx_v_self->pos_col);
+530: visibility = self.get_visible(self.map[row][col])
__pyx_v_visibility = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_visible(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0);
+531: if visibility > 3:
__pyx_t_8 = ((__pyx_v_visibility > 3) != 0); if (__pyx_t_8) { /* … */ }
+532: self.map[row][col] -= self.to_visible(1)
__pyx_t_10 = __pyx_v_row; __pyx_t_11 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) = (((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0));
+533: if visibility == 3:
__pyx_t_8 = ((__pyx_v_visibility == 3) != 0); if (__pyx_t_8) { /* … */ }
+534: self.map[row][col] -= self.to_visible(2)
__pyx_t_10 = __pyx_v_row; __pyx_t_11 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) = (((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 2, 0));
+535: if distance < self.view_range: # if could see
__pyx_t_8 = ((__pyx_v_distance < __pyx_v_self->view_range) != 0); if (__pyx_t_8) { /* … */ goto __pyx_L15; }
+536: if visibility == 2: # Player see this field
__pyx_t_8 = ((__pyx_v_visibility == 2) != 0); if (__pyx_t_8) { /* … */ }
+537: self.map[row][col] -= self.to_visible(1)
__pyx_t_10 = __pyx_v_row; __pyx_t_11 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) = (((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0));
+538: if visibility == 0: # Player dont see this field
__pyx_t_8 = ((__pyx_v_visibility == 0) != 0); if (__pyx_t_8) { /* … */ }
+539: self.map[row][col] += self.to_visible(1)
__pyx_t_10 = __pyx_v_row; __pyx_t_11 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) = (((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0));
540: else: # could not see do it in "fog"
+541: if visibility == 1:
/*else*/ { __pyx_t_8 = ((__pyx_v_visibility == 1) != 0); if (__pyx_t_8) { /* … */ } } __pyx_L15:; __pyx_L5_continue:; } }
+542: self.map[row][col] += self.to_visible(1)
__pyx_t_10 = __pyx_v_row; __pyx_t_11 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) = (((__pyx_v_self->map[__pyx_t_10])[__pyx_t_11]) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0));
543:
544:
545: @cython.boundscheck(False)
546: @cython.cdivision(True)
+547: cdef double e_distance(self, int row_1, int col_1, int row_2, int col_2):
static double __pyx_f_8worldmor_4game_4game_8Worldmor_e_distance(CYTHON_UNUSED struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row_1, int __pyx_v_col_1, int __pyx_v_row_2, int __pyx_v_col_2) { double __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("e_distance", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.e_distance", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
548: """Count the Euclidean distance between two points in the map."""
+549: return sqrt(<double>(abs(row_1 - row_2) ** 2) + abs(col_1 - col_2) ** 2)
__pyx_t_1 = abs((__pyx_v_row_1 - __pyx_v_row_2)); if (unlikely(__pyx_t_1 == ((int)-1))) __PYX_ERR(0, 549, __pyx_L1_error) __pyx_t_2 = abs((__pyx_v_col_1 - __pyx_v_col_2)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 549, __pyx_L1_error) __pyx_r = sqrt((((double)__Pyx_pow_long(((long)__pyx_t_1), 2)) + __Pyx_pow_long(((long)__pyx_t_2), 2))); goto __pyx_L0;
550:
551: @cython.boundscheck(False)
552: @cython.cdivision(True)
+553: cdef void enemy_ai(self, int row, int col):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_enemy_ai(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col) { int __pyx_v_direction; double __pyx_v_distance; double __pyx_v_health_prob; double __pyx_v_bullets_prob; struct __pyx_t_8worldmor_4game_4game_cord_move __pyx_v_cords; int __pyx_v_row_diff; int __pyx_v_col_diff; int __pyx_v_gun_shoot_range; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("enemy_ai", 0); /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.enemy_ai", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); }
554: """Do turn off enemies. Do shoot on the player, when can, or go near to shoot if see the player.
555: Can do other turns when having no live to find pharmacies, bullets when not have bullets, etc...
556: When not have bullet dont shoot but try to find with some probability for example.
557:
558: :param row: row position of enemy
559: :param col: column position of enemy
560: """
561: # wait for draw
+562: cdef int direction = self.get_direction(self.map[row][col])
__pyx_v_direction = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_direction(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0);
+563: if direction > 0:
__pyx_t_1 = ((__pyx_v_direction > 0) != 0); if (__pyx_t_1) { /* … */ }
+564: self.map[row][col] -= self.to_direction(1)
__pyx_t_2 = __pyx_v_row; __pyx_t_3 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) - ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, 1, 0));
+565: return
goto __pyx_L0;
566:
+567: self.map[row][col] += self.to_direction(self.how_long_between_turn_ai)
__pyx_t_2 = __pyx_v_row; __pyx_t_3 = __pyx_v_col; ((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) = (((__pyx_v_self->map[__pyx_t_2])[__pyx_t_3]) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_direction(__pyx_v_self, __pyx_v_self->how_long_between_turn_ai, 0));
568: # Count distance from player
+569: cdef double distance = self.e_distance(row, col, self.pos_row, self.pos_col)
__pyx_v_distance = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->e_distance(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_v_self->pos_row, __pyx_v_self->pos_col);
570: # Count the probability of health need
+571: cdef double health_prob = self.go_for_health_ai_prob * (1 - self.get_health(self.map[row][col])/MAX_HEALTH)
__pyx_v_health_prob = (__pyx_v_self->go_for_health_ai_prob * (1 - (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_health(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0) / __pyx_v_8worldmor_4game_4game_MAX_HEALTH)));
572: # Count probability of bullets need
+573: cdef double bullets_prob = self.go_for_bullets_ai_prob * (1 - self.get_bullets(self.map[row][col])/MAX_BULLETS)
__pyx_v_bullets_prob = (__pyx_v_self->go_for_bullets_ai_prob * (1 - (((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0) / __pyx_v_8worldmor_4game_4game_MAX_BULLETS)));
574: cdef cord_move cords
+575: cdef int row_diff = 0, col_diff = 0, gun_shoot_range
__pyx_v_row_diff = 0; __pyx_v_col_diff = 0;
576: # enemy see the player move to kill or kill
+577: if distance <= self.how_far_see_ai and \
__pyx_t_4 = ((__pyx_v_distance <= __pyx_v_self->how_far_see_ai) != 0); if (__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L5_bool_binop_done; } /* … */ if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+578: <int>self.get_bullets(self.map[row][col]) >= \
__pyx_t_4 = ((((int)((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0)) >= ((int)((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_bullets_dec(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0)))) != 0); __pyx_t_1 = __pyx_t_4; __pyx_L5_bool_binop_done:;
579: <int>self.get_bullets_dec(self.get_gun(self.map[row][col])):
+580: gun_shoot_range = self.get_distance(self.get_gun(self.map[row][col]))
__pyx_v_gun_shoot_range = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_distance(__pyx_v_self, ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_gun(__pyx_v_self, ((__pyx_v_self->map[__pyx_v_row])[__pyx_v_col]), 0));
+581: if row == self.pos_row and abs(col - self.pos_col) <= gun_shoot_range:
__pyx_t_4 = ((__pyx_v_row == __pyx_v_self->pos_row) != 0);
if (__pyx_t_4) {
} else {
__pyx_t_1 = __pyx_t_4;
goto __pyx_L8_bool_binop_done;
}
__pyx_t_2 = abs((__pyx_v_col - __pyx_v_self->pos_col)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 581, __pyx_L1_error)
__pyx_t_4 = ((__pyx_t_2 <= __pyx_v_gun_shoot_range) != 0);
__pyx_t_1 = __pyx_t_4;
__pyx_L8_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+582: if self.pos_col < col:
__pyx_t_1 = ((__pyx_v_self->pos_col < __pyx_v_col) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L10; }
+583: self.do_shoot(row, col, 4)
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_row, __pyx_v_col, 4);
584: else:
+585: self.do_shoot(row, col, 2)
/*else*/ { ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_row, __pyx_v_col, 2); } __pyx_L10:;
+586: return
goto __pyx_L0;
+587: elif col == self.pos_col and abs(row - self.pos_row) <= gun_shoot_range:
__pyx_t_4 = ((__pyx_v_col == __pyx_v_self->pos_col) != 0);
if (__pyx_t_4) {
} else {
__pyx_t_1 = __pyx_t_4;
goto __pyx_L11_bool_binop_done;
}
__pyx_t_2 = abs((__pyx_v_row - __pyx_v_self->pos_row)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 587, __pyx_L1_error)
__pyx_t_4 = ((__pyx_t_2 <= __pyx_v_gun_shoot_range) != 0);
__pyx_t_1 = __pyx_t_4;
__pyx_L11_bool_binop_done:;
if (__pyx_t_1) {
/* … */
}
+588: if self.pos_row < row:
__pyx_t_1 = ((__pyx_v_self->pos_row < __pyx_v_row) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L13; }
+589: self.do_shoot(row, col, 1)
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_row, __pyx_v_col, 1);
590: else:
+591: self.do_shoot(row, col, 3)
/*else*/ { ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_shoot(__pyx_v_self, __pyx_v_row, __pyx_v_col, 3); } __pyx_L13:;
+592: return
goto __pyx_L0;
593: else:
+594: row_diff = self.pos_row - row
/*else*/ { __pyx_v_row_diff = (__pyx_v_self->pos_row - __pyx_v_row);
+595: col_diff = self.pos_col - col
__pyx_v_col_diff = (__pyx_v_self->pos_col - __pyx_v_col); }
596:
597: # go for health
+598: elif (rand() / <float> RAND_MAX) < health_prob:
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) < __pyx_v_health_prob) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+599: cords = self.find_nearest(row, col, HEALTH, HEALTH)
__pyx_v_cords = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->find_nearest(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_e_8worldmor_4game_4game_HEALTH, __pyx_e_8worldmor_4game_4game_HEALTH);
+600: row_diff = cords.row - row
__pyx_v_row_diff = (__pyx_v_cords.row - __pyx_v_row);
+601: col_diff = cords.col - col
__pyx_v_col_diff = (__pyx_v_cords.col - __pyx_v_col);
602:
603: # go for bullets
+604: elif (rand() / <float> RAND_MAX) < bullets_prob:
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) < __pyx_v_bullets_prob) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+605: cords = self.find_nearest(row, col, BULLET, BULLET)
__pyx_v_cords = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->find_nearest(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_e_8worldmor_4game_4game_BULLET, __pyx_e_8worldmor_4game_4game_BULLET);
+606: row_diff = cords.row - row
__pyx_v_row_diff = (__pyx_v_cords.row - __pyx_v_row);
+607: col_diff = cords.col - col
__pyx_v_col_diff = (__pyx_v_cords.col - __pyx_v_col);
608:
609: # go for gun
+610: elif (rand() / <float> RAND_MAX) < self.go_for_gun_ai_prob:
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) < __pyx_v_self->go_for_gun_ai_prob) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+611: cords = self.find_nearest(row, col, GUN_B, GUN_E)
__pyx_v_cords = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->find_nearest(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_e_8worldmor_4game_4game_GUN_B, __pyx_e_8worldmor_4game_4game_GUN_E);
+612: row_diff = cords.row - row
__pyx_v_row_diff = (__pyx_v_cords.row - __pyx_v_row);
+613: col_diff = cords.col - col
__pyx_v_col_diff = (__pyx_v_cords.col - __pyx_v_col);
614:
615: # go for player
+616: elif (rand() / <float> RAND_MAX) < self.go_for_player_ai_prob:
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) < __pyx_v_self->go_for_player_ai_prob) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L4; }
+617: row_diff = self.pos_row - row
__pyx_v_row_diff = (__pyx_v_self->pos_row - __pyx_v_row);
+618: col_diff = self.pos_col - col
__pyx_v_col_diff = (__pyx_v_self->pos_col - __pyx_v_col);
619:
620: else:
621: # random move or not when hit 0 :]
+622: if rand() % 2 == 0:
/*else*/ { __pyx_t_1 = (((rand() % 2) == 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L14; }
+623: row_diff = ((rand() % 3) - 1)
__pyx_v_row_diff = ((rand() % 3) - 1);
624: else:
+625: col_diff = ((rand() % 3) - 1)
/*else*/ { __pyx_v_col_diff = ((rand() % 3) - 1); } __pyx_L14:; } __pyx_L4:;
626:
627: # Do the move, in some prob in row, then in col and of 0 do in row if can
+628: if row_diff != 0 and (rand() / <float> RAND_MAX) < 0.5:
__pyx_t_4 = ((__pyx_v_row_diff != 0) != 0); if (__pyx_t_4) { } else { __pyx_t_1 = __pyx_t_4; goto __pyx_L16_bool_binop_done; } __pyx_t_4 = (((rand() / ((float)RAND_MAX)) < 0.5) != 0); __pyx_t_1 = __pyx_t_4; __pyx_L16_bool_binop_done:; if (__pyx_t_1) { /* … */ goto __pyx_L15; }
629: # move in row
+630: if row_diff < 0:
__pyx_t_1 = ((__pyx_v_row_diff < 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L18; }
+631: self.do_move(row, col, row-1, col)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, (__pyx_v_row - 1), __pyx_v_col));
+632: elif row_diff > 0:
__pyx_t_1 = ((__pyx_v_row_diff > 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L18; }
+633: self.do_move(row, col, row+1, col)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, (__pyx_v_row + 1), __pyx_v_col));
634: else:
+635: return
/*else*/ { goto __pyx_L0; } __pyx_L18:;
+636: elif col_diff != 0:
__pyx_t_1 = ((__pyx_v_col_diff != 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L15; }
637: # move in col
+638: if col_diff < 0:
__pyx_t_1 = ((__pyx_v_col_diff < 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L19; }
+639: self.do_move(row, col, row, col-1)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_v_row, (__pyx_v_col - 1)));
+640: elif col_diff > 0:
__pyx_t_1 = ((__pyx_v_col_diff > 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L19; }
+641: self.do_move(row, col, row, col+1)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, __pyx_v_row, (__pyx_v_col + 1)));
642: else:
+643: return
/*else*/ { goto __pyx_L0; } __pyx_L19:;
644: else:
645: # move in row
+646: if row_diff < 0:
/*else*/ { __pyx_t_1 = ((__pyx_v_row_diff < 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L20; }
+647: self.do_move(row, col, row-1, col)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, (__pyx_v_row - 1), __pyx_v_col));
+648: elif row_diff > 0:
__pyx_t_1 = ((__pyx_v_row_diff > 0) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L20; }
+649: self.do_move(row, col, row+1, col)
(void)(((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->do_move(__pyx_v_self, __pyx_v_row, __pyx_v_col, (__pyx_v_row + 1), __pyx_v_col));
650: else:
+651: return
/*else*/ { goto __pyx_L0; } __pyx_L20:; } __pyx_L15:;
652:
653: @cython.cdivision(True)
654: @cython.boundscheck(False)
+655: cdef cord_move find_nearest(self, int row, int col, int need_down_bound, int need_up_bound):
static struct __pyx_t_8worldmor_4game_4game_cord_move __pyx_f_8worldmor_4game_4game_8Worldmor_find_nearest(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col, int __pyx_v_need_down_bound, int __pyx_v_need_up_bound) { int __pyx_v_check_row; int __pyx_v_check_column; int __pyx_v_find_row; int __pyx_v_find_col; double __pyx_v_tmp; double __pyx_v_find_distance; struct __pyx_t_8worldmor_4game_4game_cord_move __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("find_nearest", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
656: """Find the nearest item what is need.
657:
658: :param row: row position
659: :param col: column position
660: :param need_down_bound: lower bound of range for finding all gun for example
661: :param need_up_bound: upper bound for finding items
662: :return: coordinates where is the item
663: """
+664: cdef int check_row, check_column, find_row = -1, find_col = -1
__pyx_v_find_row = -1; __pyx_v_find_col = -1;
665: cdef double tmp
+666: cdef double find_distance = self.how_far_see_ai*2
__pyx_v_find_distance = (__pyx_v_self->how_far_see_ai * 2);
+667: for check_row in range(row - self.how_far_see_ai, row + self.how_far_see_ai + 1):
__pyx_t_1 = ((__pyx_v_row + __pyx_v_self->how_far_see_ai) + 1); __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = (__pyx_v_row - __pyx_v_self->how_far_see_ai); __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_check_row = __pyx_t_3;
+668: for check_column in range(col - self.how_far_see_ai, col + self.how_far_see_ai + 1):
__pyx_t_4 = ((__pyx_v_col + __pyx_v_self->how_far_see_ai) + 1); __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = (__pyx_v_col - __pyx_v_self->how_far_see_ai); __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_check_column = __pyx_t_6;
669: # out from map continue
+670: if check_row < 0 or check_row >= self.rows or check_column < 0 or check_column >= self.cols:
__pyx_t_8 = ((__pyx_v_check_row < 0) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_check_row >= __pyx_v_self->rows) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_check_column < 0) != 0); if (!__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L8_bool_binop_done; } __pyx_t_8 = ((__pyx_v_check_column >= __pyx_v_self->cols) != 0); __pyx_t_7 = __pyx_t_8; __pyx_L8_bool_binop_done:; if (__pyx_t_7) { /* … */ }
+671: continue
goto __pyx_L5_continue;
672: # my position continue
+673: if check_row == row and check_column == col:
__pyx_t_8 = ((__pyx_v_check_row == __pyx_v_row) != 0); if (__pyx_t_8) { } else { __pyx_t_7 = __pyx_t_8; goto __pyx_L13_bool_binop_done; } __pyx_t_8 = ((__pyx_v_check_column == __pyx_v_col) != 0); __pyx_t_7 = __pyx_t_8; __pyx_L13_bool_binop_done:; if (__pyx_t_7) { /* … */ }
+674: continue
goto __pyx_L5_continue;
675: # find some if it nearest?
+676: if need_down_bound <= (<int>(self.map[check_row][check_column] % 100)) <= need_up_bound:
__pyx_t_9 = ((int)(((__pyx_v_self->map[__pyx_v_check_row])[__pyx_v_check_column]) % 0x64)); __pyx_t_7 = (__pyx_v_need_down_bound <= __pyx_t_9); if (__pyx_t_7) { __pyx_t_7 = (__pyx_t_9 <= __pyx_v_need_up_bound); } __pyx_t_8 = (__pyx_t_7 != 0); if (__pyx_t_8) { /* … */ } __pyx_L5_continue:; } }
+677: tmp = self.e_distance(check_row, check_column, row, col)
__pyx_v_tmp = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->e_distance(__pyx_v_self, __pyx_v_check_row, __pyx_v_check_column, __pyx_v_row, __pyx_v_col);
+678: if tmp < find_distance:
__pyx_t_8 = ((__pyx_v_tmp < __pyx_v_find_distance) != 0); if (__pyx_t_8) { /* … */ }
+679: find_distance = tmp
__pyx_v_find_distance = __pyx_v_tmp;
+680: find_row = check_row
__pyx_v_find_row = __pyx_v_check_row;
+681: find_col = check_column
__pyx_v_find_col = __pyx_v_check_column;
682:
+683: if find_row == -1 and find_col == -1:
__pyx_t_7 = ((__pyx_v_find_row == -1L) != 0); if (__pyx_t_7) { } else { __pyx_t_8 = __pyx_t_7; goto __pyx_L18_bool_binop_done; } __pyx_t_7 = ((__pyx_v_find_col == -1L) != 0); __pyx_t_8 = __pyx_t_7; __pyx_L18_bool_binop_done:; if (__pyx_t_8) { /* … */ }
+684: if rand() % 2 == 0:
__pyx_t_8 = (((rand() % 2) == 0) != 0); if (__pyx_t_8) { /* … */ goto __pyx_L20; }
+685: find_row = row+((rand() % 3) - 1)
__pyx_v_find_row = (__pyx_v_row + ((rand() % 3) - 1));
+686: find_col = 0
__pyx_v_find_col = 0;
687: else:
+688: find_col = col+((rand() % 3) - 1)
/*else*/ { __pyx_v_find_col = (__pyx_v_col + ((rand() % 3) - 1));
+689: find_row = 0
__pyx_v_find_row = 0; } __pyx_L20:;
+690: return cord_move(find_row, find_col)
__pyx_t_10.row = __pyx_v_find_row; __pyx_t_10.col = __pyx_v_find_col; __pyx_r = __pyx_t_10; goto __pyx_L0;
691:
692:
693: @cython.wraparound(False)
694: @cython.boundscheck(False)
+695: cpdef np.ndarray[np.int64_t, ndim=2] get_map(self, int row, int col):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_37get_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyArrayObject *__pyx_f_8worldmor_4game_4game_8Worldmor_get_map(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col, int __pyx_skip_dispatch) { int __pyx_v_i; int __pyx_v_j; PyArrayObject *__pyx_v_map_view = 0; struct __pyx_t_8worldmor_4game_4game_coords __pyx_v_co; __Pyx_LocalBuf_ND __pyx_pybuffernd_map_view; __Pyx_Buffer __pyx_pybuffer_map_view; PyArrayObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map", 0); __pyx_pybuffer_map_view.pybuffer.buf = NULL; __pyx_pybuffer_map_view.refcount = 0; __pyx_pybuffernd_map_view.data = NULL; __pyx_pybuffernd_map_view.rcbuffer = &__pyx_pybuffer_map_view; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_map); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_37get_map)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = __pyx_t_1; __pyx_t_6 = NULL; __pyx_t_7 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); __pyx_t_7 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { PyObject *__pyx_temp[3] = {__pyx_t_6, __pyx_t_3, __pyx_t_4}; __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_7, 2+__pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } else #endif { __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_6) { __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL; } __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 695, __pyx_L1_error) __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_map_view); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_37get_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_36get_map[] = "Method for obtaining and creating a viewport from the map to be displayed.\n The center of map is always player.\n\n :param row: number of rows to display\n :param col: number of columns to display\n :return: a part of global map with values\n "; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_37get_map(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_row; int __pyx_v_col; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map (wrapper)", 0); { static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_row,&__pyx_n_s_col,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); CYTHON_FALLTHROUGH; case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_row)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("get_map", 1, 2, 2, 1); __PYX_ERR(0, 695, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_map") < 0)) __PYX_ERR(0, 695, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_row = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L3_error) __pyx_v_col = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 695, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("get_map", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 695, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_36get_map(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), __pyx_v_row, __pyx_v_col); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_36get_map(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_8worldmor_4game_4game_8Worldmor_get_map(__pyx_v_self, __pyx_v_row, __pyx_v_col, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 695, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_map", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
696: """Method for obtaining and creating a viewport from the map to be displayed.
697: The center of map is always player.
698:
699: :param row: number of rows to display
700: :param col: number of columns to display
701: :return: a part of global map with values
702: """
703: cdef int i, j
+704: cdef np.ndarray[np.int64_t, ndim=2] map_view = np.zeros((row, col), dtype=np.int64)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_v_col); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_5); __pyx_t_1 = 0; __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_8, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 704, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 704, __pyx_L1_error) __pyx_t_9 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_map_view = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_map_view.rcbuffer->pybuffer.buf = NULL; __PYX_ERR(0, 704, __pyx_L1_error) } else {__pyx_pybuffernd_map_view.diminfo[0].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_view.diminfo[0].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_map_view.diminfo[1].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_map_view.diminfo[1].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[1]; } } __pyx_t_9 = 0; __pyx_v_map_view = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0;
+705: cdef coords co = self.get_cords_slides(row, col)
__pyx_v_co = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_cords_slides(__pyx_v_self, __pyx_v_row, __pyx_v_col);
706:
+707: if co.col_min < 1:
__pyx_t_10 = ((__pyx_v_co.col_min < 1) != 0); if (__pyx_t_10) { /* … */ }
+708: self.refactor_cols_down()
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->refactor_cols_down(__pyx_v_self);
+709: co = self.get_cords_slides(row, col)
__pyx_v_co = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_cords_slides(__pyx_v_self, __pyx_v_row, __pyx_v_col);
+710: if co.col_max >= self.cols:
__pyx_t_10 = ((__pyx_v_co.col_max >= __pyx_v_self->cols) != 0); if (__pyx_t_10) { /* … */ }
+711: self.refactor_cols_up()
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->refactor_cols_up(__pyx_v_self);
+712: co = self.get_cords_slides(row, col)
__pyx_v_co = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_cords_slides(__pyx_v_self, __pyx_v_row, __pyx_v_col);
+713: if co.row_min < 1:
__pyx_t_10 = ((__pyx_v_co.row_min < 1) != 0); if (__pyx_t_10) { /* … */ }
+714: self.refactor_rows_down()
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->refactor_rows_down(__pyx_v_self);
+715: co = self.get_cords_slides(row, col)
__pyx_v_co = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_cords_slides(__pyx_v_self, __pyx_v_row, __pyx_v_col);
+716: if co.row_max >= self.rows:
__pyx_t_10 = ((__pyx_v_co.row_max >= __pyx_v_self->rows) != 0); if (__pyx_t_10) { /* … */ }
+717: self.refactor_rows_up()
((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->refactor_rows_up(__pyx_v_self);
+718: co = self.get_cords_slides(row, col)
__pyx_v_co = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->get_cords_slides(__pyx_v_self, __pyx_v_row, __pyx_v_col);
719:
+720: for i in range(row):
__pyx_t_7 = __pyx_v_row; __pyx_t_11 = __pyx_t_7; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_i = __pyx_t_12;
+721: for j in range(col):
__pyx_t_13 = __pyx_v_col; __pyx_t_14 = __pyx_t_13; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_j = __pyx_t_15;
+722: map_view[i, j] = self.map[co.row_min + i][co.col_min + j]
__pyx_t_16 = __pyx_v_i; __pyx_t_17 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_map_view.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_map_view.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_map_view.diminfo[1].strides) = ((__pyx_v_self->map[(__pyx_v_co.row_min + __pyx_v_i)])[(__pyx_v_co.col_min + __pyx_v_j)]); } }
+723: return map_view
__Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_map_view)); __pyx_r = ((PyArrayObject *)__pyx_v_map_view); goto __pyx_L0;
724:
725: @cython.wraparound(False)
726: @cython.boundscheck(False)
+727: cpdef np.ndarray[np.int64_t, ndim=2] get_map_to_save(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_39get_map_to_save(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static PyArrayObject *__pyx_f_8worldmor_4game_4game_8Worldmor_get_map_to_save(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_v_i; int __pyx_v_j; PyArrayObject *__pyx_v_map_view = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_map_view; __Pyx_Buffer __pyx_pybuffer_map_view; PyArrayObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map_to_save", 0); __pyx_pybuffer_map_view.pybuffer.buf = NULL; __pyx_pybuffer_map_view.refcount = 0; __pyx_pybuffernd_map_view.data = NULL; __pyx_pybuffernd_map_view.rcbuffer = &__pyx_pybuffer_map_view; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_map_to_save); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_39get_map_to_save)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 727, __pyx_L1_error) __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_map_to_save", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_map_view); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_39get_map_to_save(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_38get_map_to_save[] = "Return map as numpy array for possibility save the game."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_39get_map_to_save(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map_to_save (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_38get_map_to_save(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_38get_map_to_save(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_map_to_save", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_8worldmor_4game_4game_8Worldmor_get_map_to_save(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 727, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_map_to_save", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
728: """Return map as numpy array for possibility save the game."""
729: cdef int i, j
+730: cdef np.ndarray[np.int64_t, ndim=2] map_view = np.zeros((self.rows, self.cols), dtype=np.int64)
__Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_zeros); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->rows); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->cols); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); __pyx_t_1 = 0; __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_int64); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 730, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 730, __pyx_L1_error) __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_map_view = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_map_view.rcbuffer->pybuffer.buf = NULL; __PYX_ERR(0, 730, __pyx_L1_error) } else {__pyx_pybuffernd_map_view.diminfo[0].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_view.diminfo[0].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_map_view.diminfo[1].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_map_view.diminfo[1].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[1]; } } __pyx_t_6 = 0; __pyx_v_map_view = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0;
+731: for i in range(self.rows):
__pyx_t_7 = __pyx_v_self->rows; __pyx_t_8 = __pyx_t_7; for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9;
+732: for j in range(self.cols):
__pyx_t_10 = __pyx_v_self->cols; __pyx_t_11 = __pyx_t_10; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_j = __pyx_t_12;
+733: map_view[i, j] = self.map[i][j]
__pyx_t_13 = __pyx_v_i; __pyx_t_14 = __pyx_v_j; *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_map_view.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_map_view.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_map_view.diminfo[1].strides) = ((__pyx_v_self->map[__pyx_v_i])[__pyx_v_j]); } }
+734: return map_view
__Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_map_view)); __pyx_r = ((PyArrayObject *)__pyx_v_map_view); goto __pyx_L0;
735:
+736: cpdef int get_pos_row(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_41get_pos_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_pos_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_row", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_pos_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_41get_pos_row)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_pos_row", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_41get_pos_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_40get_pos_row[] = "Return row position of player."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_41get_pos_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_row (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_40get_pos_row(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_40get_pos_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_row", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_pos_row(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 736, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_pos_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
737: """Return row position of player."""
+738: return self.pos_row
__pyx_r = __pyx_v_self->pos_row; goto __pyx_L0;
739:
+740: cpdef int get_pos_col(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_43get_pos_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_pos_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_col", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_pos_col); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_43get_pos_col)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_pos_col", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_43get_pos_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_42get_pos_col[] = "Return column position of player."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_43get_pos_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_col (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_42get_pos_col(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_42get_pos_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pos_col", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_pos_col(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 740, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_pos_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
741: """Return column position of player."""
+742: return self.pos_col
__pyx_r = __pyx_v_self->pos_col; goto __pyx_L0;
743:
+744: cpdef int get_mid_row(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_45get_mid_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_mid_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_row", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_mid_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_45get_mid_row)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 744, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_mid_row", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_45get_mid_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_44get_mid_row[] = "Return row position of start position."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_45get_mid_row(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_row (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_44get_mid_row(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_44get_mid_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_row", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_mid_row(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 744, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_mid_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
745: """Return row position of start position."""
+746: return self.mid_row
__pyx_r = __pyx_v_self->mid_row; goto __pyx_L0;
747:
+748: cpdef int get_mid_col(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_47get_mid_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_mid_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_col", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_mid_col); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_47get_mid_col)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_mid_col", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_47get_mid_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_46get_mid_col[] = "Return column position of start position."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_47get_mid_col(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_col (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_46get_mid_col(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_46get_mid_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mid_col", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_mid_col(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 748, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_mid_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
749: """Return column position of start position."""
+750: return self.mid_col
__pyx_r = __pyx_v_self->mid_col; goto __pyx_L0;
751:
+752: cpdef int get_ai_how_far_see(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_49get_ai_how_far_see(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_ai_how_far_see(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_ai_how_far_see", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_ai_how_far_see); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_49get_ai_how_far_see)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_ai_how_far_see", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_49get_ai_how_far_see(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_48get_ai_how_far_see[] = "Returns the value of how many boxes your enemies see."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_49get_ai_how_far_see(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_ai_how_far_see (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_48get_ai_how_far_see(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_48get_ai_how_far_see(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_ai_how_far_see", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_ai_how_far_see(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 752, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_ai_how_far_see", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
753: """Returns the value of how many boxes your enemies see."""
+754: return self.how_far_see_ai
__pyx_r = __pyx_v_self->how_far_see_ai; goto __pyx_L0;
755:
+756: cpdef int get_how_fast_ai_is(self):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_51get_how_fast_ai_is(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static int __pyx_f_8worldmor_4game_4game_8Worldmor_get_how_fast_ai_is(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_how_fast_ai_is", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_get_how_fast_ai_is); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_51get_how_fast_ai_is)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4) : __Pyx_PyObject_CallNoArg(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_5; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.get_how_fast_ai_is", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_51get_how_fast_ai_is(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_50get_how_fast_ai_is[] = "Returns the value how many time moment wait ai for next action."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_51get_how_fast_ai_is(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_how_fast_ai_is (wrapper)", 0); __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_50get_how_fast_ai_is(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_50get_how_fast_ai_is(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_how_fast_ai_is", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_8worldmor_4game_4game_8Worldmor_get_how_fast_ai_is(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 756, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.get_how_fast_ai_is", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
757: """Returns the value how many time moment wait ai for next action."""
+758: return self.how_long_between_turn_ai
__pyx_r = __pyx_v_self->how_long_between_turn_ai; goto __pyx_L0;
759:
+760: cpdef void set_pos_row(self, int pos_row):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_53set_pos_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_row); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_pos_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_pos_row, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_row", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_pos_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_53set_pos_row)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pos_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_pos_row", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_53set_pos_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_row); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_52set_pos_row[] = "Set row position of player."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_53set_pos_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_row) { int __pyx_v_pos_row; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_row (wrapper)", 0); assert(__pyx_arg_pos_row); { __pyx_v_pos_row = __Pyx_PyInt_As_int(__pyx_arg_pos_row); if (unlikely((__pyx_v_pos_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 760, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_pos_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_52set_pos_row(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_pos_row)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_52set_pos_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_pos_row) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_row", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_pos_row(__pyx_v_self, __pyx_v_pos_row, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 760, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_pos_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
761: """Set row position of player."""
+762: self.pos_row = pos_row
__pyx_v_self->pos_row = __pyx_v_pos_row;
763:
+764: cpdef void set_pos_col(self, int pos_col):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_55set_pos_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_col); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_pos_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_pos_col, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_col", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_pos_col); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_55set_pos_col)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_pos_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_pos_col", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_55set_pos_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_col); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_54set_pos_col[] = "Set column position of player."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_55set_pos_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_pos_col) { int __pyx_v_pos_col; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_col (wrapper)", 0); assert(__pyx_arg_pos_col); { __pyx_v_pos_col = __Pyx_PyInt_As_int(__pyx_arg_pos_col); if (unlikely((__pyx_v_pos_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 764, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_pos_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_54set_pos_col(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_pos_col)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_54set_pos_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_pos_col) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_pos_col", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_pos_col(__pyx_v_self, __pyx_v_pos_col, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 764, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_pos_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
765: """Set column position of player."""
+766: self.pos_col = pos_col
__pyx_v_self->pos_col = __pyx_v_pos_col;
767:
+768: cpdef void set_mid_row(self, int mid_row):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_57set_mid_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_row); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_mid_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_mid_row, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_row", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_mid_row); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_57set_mid_row)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_mid_row); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_mid_row", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_57set_mid_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_row); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_56set_mid_row[] = "Set row position of start position."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_57set_mid_row(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_row) { int __pyx_v_mid_row; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_row (wrapper)", 0); assert(__pyx_arg_mid_row); { __pyx_v_mid_row = __Pyx_PyInt_As_int(__pyx_arg_mid_row); if (unlikely((__pyx_v_mid_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 768, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_mid_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_56set_mid_row(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_mid_row)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_56set_mid_row(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_mid_row) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_row", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_mid_row(__pyx_v_self, __pyx_v_mid_row, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 768, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_mid_row", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
769: """Set row position of start position."""
+770: self.mid_row = mid_row
__pyx_v_self->mid_row = __pyx_v_mid_row;
771:
+772: cpdef void set_mid_col(self, int mid_col):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_59set_mid_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_col); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_mid_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_mid_col, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_col", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_mid_col); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_59set_mid_col)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_mid_col); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_mid_col", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_59set_mid_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_col); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_58set_mid_col[] = "Set column position of start position."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_59set_mid_col(PyObject *__pyx_v_self, PyObject *__pyx_arg_mid_col) { int __pyx_v_mid_col; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_col (wrapper)", 0); assert(__pyx_arg_mid_col); { __pyx_v_mid_col = __Pyx_PyInt_As_int(__pyx_arg_mid_col); if (unlikely((__pyx_v_mid_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 772, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_mid_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_58set_mid_col(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_mid_col)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_58set_mid_col(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_mid_col) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_mid_col", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_mid_col(__pyx_v_self, __pyx_v_mid_col, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 772, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_mid_col", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
773: """Set column position of start position."""
+774: self.mid_col = mid_col
__pyx_v_self->mid_col = __pyx_v_mid_col;
775:
+776: cpdef void set_ai_how_far_see(self, int how_far_see_ai):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_61set_ai_how_far_see(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_far_see_ai); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_ai_how_far_see(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_how_far_see_ai, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_ai_how_far_see", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_ai_how_far_see); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_61set_ai_how_far_see)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_how_far_see_ai); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_ai_how_far_see", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_61set_ai_how_far_see(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_far_see_ai); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_60set_ai_how_far_see[] = "Set the value of how many boxes your enemies see."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_61set_ai_how_far_see(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_far_see_ai) { int __pyx_v_how_far_see_ai; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_ai_how_far_see (wrapper)", 0); assert(__pyx_arg_how_far_see_ai); { __pyx_v_how_far_see_ai = __Pyx_PyInt_As_int(__pyx_arg_how_far_see_ai); if (unlikely((__pyx_v_how_far_see_ai == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 776, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_ai_how_far_see", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_60set_ai_how_far_see(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_how_far_see_ai)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_60set_ai_how_far_see(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_how_far_see_ai) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_ai_how_far_see", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_ai_how_far_see(__pyx_v_self, __pyx_v_how_far_see_ai, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 776, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_ai_how_far_see", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
777: """Set the value of how many boxes your enemies see."""
+778: self.how_far_see_ai = how_far_see_ai
__pyx_v_self->how_far_see_ai = __pyx_v_how_far_see_ai;
779:
+780: cpdef void set_how_fast_ai_is(self, int how_long_between_turn_ai):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_63set_how_fast_ai_is(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_long_between_turn_ai); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_set_how_fast_ai_is(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_how_long_between_turn_ai, int __pyx_skip_dispatch) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_how_fast_ai_is", 0); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_set_how_fast_ai_is); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_63set_how_fast_ai_is)) { __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_how_long_between_turn_ai); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_4, function); } } __pyx_t_2 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.set_how_fast_ai_is", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_63set_how_fast_ai_is(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_long_between_turn_ai); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_62set_how_fast_ai_is[] = "Set the value how many time moment wait ai for next action."; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_63set_how_fast_ai_is(PyObject *__pyx_v_self, PyObject *__pyx_arg_how_long_between_turn_ai) { int __pyx_v_how_long_between_turn_ai; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_how_fast_ai_is (wrapper)", 0); assert(__pyx_arg_how_long_between_turn_ai); { __pyx_v_how_long_between_turn_ai = __Pyx_PyInt_As_int(__pyx_arg_how_long_between_turn_ai); if (unlikely((__pyx_v_how_long_between_turn_ai == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 780, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_how_fast_ai_is", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_62set_how_fast_ai_is(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((int)__pyx_v_how_long_between_turn_ai)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_62set_how_fast_ai_is(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_how_long_between_turn_ai) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_how_fast_ai_is", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_set_how_fast_ai_is(__pyx_v_self, __pyx_v_how_long_between_turn_ai, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 780, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_AddTraceback("worldmor.game.game.Worldmor.set_how_fast_ai_is", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
781: """Set the value how many time moment wait ai for next action."""
+782: self.how_long_between_turn_ai = how_long_between_turn_ai
__pyx_v_self->how_long_between_turn_ai = __pyx_v_how_long_between_turn_ai;
783:
784: @cython.wraparound(False)
785: @cython.boundscheck(False)
+786: cpdef void put_map_to_game(self, np.ndarray[np.int64_t, ndim=2] map_view):
static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_65put_map_to_game(PyObject *__pyx_v_self, PyObject *__pyx_v_map_view); /*proto*/ static void __pyx_f_8worldmor_4game_4game_8Worldmor_put_map_to_game(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, PyArrayObject *__pyx_v_map_view, int __pyx_skip_dispatch) { int __pyx_v_i; int __pyx_v_j; __Pyx_LocalBuf_ND __pyx_pybuffernd_map_view; __Pyx_Buffer __pyx_pybuffer_map_view; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_map_to_game", 0); __pyx_pybuffer_map_view.pybuffer.buf = NULL; __pyx_pybuffer_map_view.refcount = 0; __pyx_pybuffernd_map_view.data = NULL; __pyx_pybuffernd_map_view.rcbuffer = &__pyx_pybuffer_map_view; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_view, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 786, __pyx_L1_error) } __pyx_pybuffernd_map_view.diminfo[0].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_view.diminfo[0].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_map_view.diminfo[1].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_map_view.diminfo[1].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely((Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0) || (Py_TYPE(((PyObject *)__pyx_v_self))->tp_flags & (Py_TPFLAGS_IS_ABSTRACT | Py_TPFLAGS_HEAPTYPE)))) { #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP static PY_UINT64_T tp_dict_version = 0, obj_dict_version = 0; if (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict && tp_dict_version == __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) && (!Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset || obj_dict_version == __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self)))))); else { PY_UINT64_T type_dict_guard = (likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict)) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; #endif __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_put_map_to_game); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)(void*)__pyx_pw_8worldmor_4game_4game_8Worldmor_65put_map_to_game)) { __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_4)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); } } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, ((PyObject *)__pyx_v_map_view)) : __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_map_view)); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP tp_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) ? __PYX_GET_DICT_VERSION(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dict) : 0; obj_dict_version = likely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset) ? __PYX_GET_DICT_VERSION(_PyObject_GetDictPtr(((PyObject *)__pyx_v_self))) : 0; if (unlikely(type_dict_guard != tp_dict_version)) { tp_dict_version = obj_dict_version = 0; } #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_PYTYPE_LOOKUP } #endif } /* … */ /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.put_map_to_game", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __pyx_L2:; __Pyx_RefNannyFinishContext(); } /* Python wrapper */ static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_65put_map_to_game(PyObject *__pyx_v_self, PyObject *__pyx_v_map_view); /*proto*/ static char __pyx_doc_8worldmor_4game_4game_8Worldmor_64put_map_to_game[] = "Load game from numpy array set the game map. \n For correctly load game need set other flags as the position of player and \n start middle of the map (for the distance from the start are count the difficulty and levels set need be set.\n "; static PyObject *__pyx_pw_8worldmor_4game_4game_8Worldmor_65put_map_to_game(PyObject *__pyx_v_self, PyObject *__pyx_v_map_view) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_map_to_game (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_map_view), __pyx_ptype_5numpy_ndarray, 1, "map_view", 0))) __PYX_ERR(0, 786, __pyx_L1_error) __pyx_r = __pyx_pf_8worldmor_4game_4game_8Worldmor_64put_map_to_game(((struct __pyx_obj_8worldmor_4game_4game_Worldmor *)__pyx_v_self), ((PyArrayObject *)__pyx_v_map_view)); /* function exit code */ goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyObject *__pyx_pf_8worldmor_4game_4game_8Worldmor_64put_map_to_game(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, PyArrayObject *__pyx_v_map_view) { __Pyx_LocalBuf_ND __pyx_pybuffernd_map_view; __Pyx_Buffer __pyx_pybuffer_map_view; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("put_map_to_game", 0); __pyx_pybuffer_map_view.pybuffer.buf = NULL; __pyx_pybuffer_map_view.refcount = 0; __pyx_pybuffernd_map_view.data = NULL; __pyx_pybuffernd_map_view.rcbuffer = &__pyx_pybuffer_map_view; { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer, (PyObject*)__pyx_v_map_view, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int64_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 786, __pyx_L1_error) } __pyx_pybuffernd_map_view.diminfo[0].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_map_view.diminfo[0].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_map_view.diminfo[1].strides = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_map_view.diminfo[1].shape = __pyx_pybuffernd_map_view.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_void_to_None(__pyx_f_8worldmor_4game_4game_8Worldmor_put_map_to_game(__pyx_v_self, __pyx_v_map_view, 1)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 786, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("worldmor.game.game.Worldmor.put_map_to_game", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_map_view.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; }
787: """Load game from numpy array set the game map.
788: For correctly load game need set other flags as the position of player and
789: start middle of the map (for the distance from the start are count the difficulty and levels set need be set.
790: """
+791: free_mem(self.map, self.rows)
__pyx_f_8worldmor_4game_4game_free_mem(__pyx_v_self->map, __pyx_v_self->rows);
792:
793: cdef int i, j
+794: self.rows = map_view.shape[0]
__pyx_v_self->rows = (__pyx_v_map_view->dimensions[0]);
+795: self.cols = map_view.shape[1]
__pyx_v_self->cols = (__pyx_v_map_view->dimensions[1]);
796:
+797: self.map = <unsigned long long **> PyMem_Malloc(self.rows * sizeof(unsigned long long*))
__pyx_v_self->map = ((unsigned PY_LONG_LONG **)PyMem_Malloc((__pyx_v_self->rows * (sizeof(unsigned PY_LONG_LONG *)))));
798: # generate the map
+799: for i in range(self.rows):
__pyx_t_5 = __pyx_v_self->rows; __pyx_t_6 = __pyx_t_5; for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7;
+800: self.map[i] = <unsigned long long *> PyMem_Malloc(self.cols * sizeof(unsigned long long))
(__pyx_v_self->map[__pyx_v_i]) = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_self->cols * (sizeof(unsigned PY_LONG_LONG)))));
+801: for j in range(self.cols):
__pyx_t_8 = __pyx_v_self->cols; __pyx_t_9 = __pyx_t_8; for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_j = __pyx_t_10;
+802: self.map[i][j] = map_view[i, j]
__pyx_t_11 = __pyx_v_i; __pyx_t_12 = __pyx_v_j; ((__pyx_v_self->map[__pyx_v_i])[__pyx_v_j]) = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_int64_t *, __pyx_pybuffernd_map_view.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_map_view.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_map_view.diminfo[1].strides)); } }
803:
804:
805: @cython.cdivision(True)
806: @cython.boundscheck(False)
+807: cdef unsigned long long generate_part_of_map(self, int row, int column):
static unsigned PY_LONG_LONG __pyx_f_8worldmor_4game_4game_8Worldmor_generate_part_of_map(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_column) { int __pyx_v_walls; double __pyx_v_distance; unsigned PY_LONG_LONG __pyx_v_to_set; unsigned PY_LONG_LONG __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("generate_part_of_map", 0); /* … */ /* function exit code */ __pyx_L1_error:; __Pyx_WriteUnraisable("worldmor.game.game.Worldmor.generate_part_of_map", __pyx_clineno, __pyx_lineno, __pyx_filename, 1, 0); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
808: """Function for generating a map based on some probabilities to add specific items or walls.
809:
810: :param row: row position to generate to map
811: :param column: column position to generate to map
812: :return:
813: """
814: # Not do garbage near player.
+815: cdef int walls = self.count_near_walls(row, column)
__pyx_v_walls = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->count_near_walls(__pyx_v_self, __pyx_v_row, __pyx_v_column);
+816: cdef double distance = self.e_distance(row, column, self.mid_row, self.mid_col)
__pyx_v_distance = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->e_distance(__pyx_v_self, __pyx_v_row, __pyx_v_column, __pyx_v_self->mid_row, __pyx_v_self->mid_col);
817: cdef unsigned long long to_set
+818: if distance < self.view_range:
__pyx_t_1 = ((__pyx_v_distance < __pyx_v_self->view_range) != 0); if (__pyx_t_1) { /* … */ goto __pyx_L3; }
+819: to_set = self.to_visible(1)
__pyx_v_to_set = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 1, 0);
820: else:
+821: to_set = self.to_visible(0)
/*else*/ { __pyx_v_to_set = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_visible(__pyx_v_self, 0, 0); } __pyx_L3:;
+822: if abs(row - self.pos_row) < self.view_range \
__pyx_t_2 = abs((__pyx_v_row - __pyx_v_self->pos_row)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 822, __pyx_L1_error)
__pyx_t_3 = ((__pyx_t_2 < __pyx_v_self->view_range) != 0);
if (__pyx_t_3) {
} else {
__pyx_t_1 = __pyx_t_3;
goto __pyx_L5_bool_binop_done;
}
/* … */
if (__pyx_t_1) {
/* … */
}
+823: and abs(column - self.pos_col) < self.view_range:
__pyx_t_2 = abs((__pyx_v_column - __pyx_v_self->pos_col)); if (unlikely(__pyx_t_2 == ((int)-1))) __PYX_ERR(0, 823, __pyx_L1_error)
__pyx_t_3 = ((__pyx_t_2 < __pyx_v_self->view_range) != 0);
__pyx_t_1 = __pyx_t_3;
__pyx_L5_bool_binop_done:;
+824: return to_set + GRASS
__pyx_r = (__pyx_v_to_set + __pyx_e_8worldmor_4game_4game_GRASS); goto __pyx_L0;
825:
+826: if (rand() / <float> RAND_MAX) <= (WALL_BASE_PROBABILITY / (WALL_DIVIDER_BASE ** abs(walls - 1))):
__pyx_t_4 = labs((__pyx_v_walls - 1)); if (unlikely(__pyx_t_4 == ((long)-1))) __PYX_ERR(0, 826, __pyx_L1_error)
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= (__pyx_v_8worldmor_4game_4game_WALL_BASE_PROBABILITY / pow(__pyx_v_8worldmor_4game_4game_WALL_DIVIDER_BASE, ((double)__pyx_t_4)))) != 0);
if (__pyx_t_1) {
/* … */
}
+827: return to_set + self.to_health(100) + WALL
__pyx_r = ((__pyx_v_to_set + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, 0x64, 0)) + __pyx_e_8worldmor_4game_4game_WALL); goto __pyx_L0;
828:
+829: if (rand() / <float> RAND_MAX) <= min(self.bullets_max_prob,
__pyx_t_6 = __pyx_v_self->bullets_max_prob; /* … */ __pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= __pyx_t_7) != 0); if (__pyx_t_1) { /* … */ }
+830: (1 / (distance ** self.bullets_exponent)) * self.bullets_multiply):
__pyx_t_5 = ((1.0 / pow(__pyx_v_distance, __pyx_v_self->bullets_exponent)) * __pyx_v_self->bullets_multiply); /* … */ if (((__pyx_t_5 < __pyx_t_6) != 0)) { __pyx_t_7 = __pyx_t_5; } else { __pyx_t_7 = __pyx_t_6; }
+831: return to_set + BULLET
__pyx_r = (__pyx_v_to_set + __pyx_e_8worldmor_4game_4game_BULLET); goto __pyx_L0;
832:
+833: if (rand() / <float> RAND_MAX) <= min(self.health_max_prob,
__pyx_t_5 = __pyx_v_self->health_max_prob; /* … */ __pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= __pyx_t_6) != 0); if (__pyx_t_1) { /* … */ }
+834: (1 / (distance ** self.health_exponent)) * self.health_multiply):
__pyx_t_7 = ((1.0 / pow(__pyx_v_distance, __pyx_v_self->health_exponent)) * __pyx_v_self->health_multiply); /* … */ if (((__pyx_t_7 < __pyx_t_5) != 0)) { __pyx_t_6 = __pyx_t_7; } else { __pyx_t_6 = __pyx_t_5; }
+835: return to_set + HEALTH
__pyx_r = (__pyx_v_to_set + __pyx_e_8worldmor_4game_4game_HEALTH); goto __pyx_L0;
836:
+837: if (rand() / <float> RAND_MAX) <= min(self.enemy_max_prob,
__pyx_t_7 = __pyx_v_self->enemy_max_prob; /* … */ __pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= __pyx_t_5) != 0); if (__pyx_t_1) { /* … */ }
+838: self.enemy_start_probability * (distance / self.enemy_distance_divider)):
__pyx_t_6 = (__pyx_v_self->enemy_start_probability * (__pyx_v_distance / __pyx_v_self->enemy_distance_divider)); /* … */ if (((__pyx_t_6 < __pyx_t_7) != 0)) { __pyx_t_5 = __pyx_t_6; } else { __pyx_t_5 = __pyx_t_7; }
+839: return to_set + self.to_health(100) + self.to_bullets(ENEMY_START_BULLETS)+ self.to_gun(GUN_B) + \
__pyx_r = ((((__pyx_v_to_set + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_health(__pyx_v_self, 0x64, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_bullets(__pyx_v_self, __pyx_v_8worldmor_4game_4game_ENEMY_START_BULLETS, 0)) + ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->to_gun(__pyx_v_self, __pyx_e_8worldmor_4game_4game_GUN_B, 0)) + (((rand() % (__pyx_e_8worldmor_4game_4game_ENEMY_E - __pyx_e_8worldmor_4game_4game_ENEMY_B)) + __pyx_e_8worldmor_4game_4game_ENEMY_B) + 1)); goto __pyx_L0;
840: ((rand() % (ENEMY_E - ENEMY_B)) + ENEMY_B + 1)
841:
+842: if (rand() / <float> RAND_MAX) <= min(self.guns_max_prob,
__pyx_t_6 = __pyx_v_self->guns_max_prob; /* … */ __pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= __pyx_t_7) != 0); if (__pyx_t_1) { /* … */ }
+843: (1 / (distance ** self.guns_exponent)) * self.guns_multiply):
__pyx_t_5 = ((1.0 / pow(__pyx_v_distance, __pyx_v_self->guns_exponent)) * __pyx_v_self->guns_multiply); /* … */ if (((__pyx_t_5 < __pyx_t_6) != 0)) { __pyx_t_7 = __pyx_t_5; } else { __pyx_t_7 = __pyx_t_6; }
+844: return to_set + ((rand() % (GUN_E - GUN_B)) + GUN_B + 1)
__pyx_r = (__pyx_v_to_set + (((rand() % (__pyx_e_8worldmor_4game_4game_GUN_E - __pyx_e_8worldmor_4game_4game_GUN_B)) + __pyx_e_8worldmor_4game_4game_GUN_B) + 1)); goto __pyx_L0;
845:
+846: if (rand() / <float> RAND_MAX) <= PROBABILITY_OF_FREE_POINTS:
__pyx_t_1 = (((rand() / ((float)RAND_MAX)) <= __pyx_v_8worldmor_4game_4game_PROBABILITY_OF_FREE_POINTS) != 0); if (__pyx_t_1) { /* … */ }
+847: return to_set + BLOOD
__pyx_r = (__pyx_v_to_set + __pyx_e_8worldmor_4game_4game_BLOOD); goto __pyx_L0;
848:
+849: return to_set + 0
__pyx_r = (__pyx_v_to_set + 0); goto __pyx_L0;
850:
851: @cython.cdivision(True)
852: @cython.boundscheck(False)
+853: cdef int count_near_walls(self, int row, int column):
static int __pyx_f_8worldmor_4game_4game_8Worldmor_count_near_walls(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_column) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_rows; int __pyx_v_cols; int __pyx_v_walls; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("count_near_walls", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
854: """Count number of walls in the neighborhood.
855:
856: :param row: row position on map
857: :param column: column position on map
858: :return: number of walls
859: """
860:
+861: cdef int i, j, rows, cols, walls = 0
__pyx_v_walls = 0;
+862: for i in range(-1, 2):
for (__pyx_t_1 = -1; __pyx_t_1 < 2; __pyx_t_1+=1) { __pyx_v_i = __pyx_t_1;
+863: rows = row + i
__pyx_v_rows = (__pyx_v_row + __pyx_v_i);
+864: if rows < 0 or rows >= self.rows:
__pyx_t_3 = ((__pyx_v_rows < 0) != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L6_bool_binop_done; } __pyx_t_3 = ((__pyx_v_rows >= __pyx_v_self->rows) != 0); __pyx_t_2 = __pyx_t_3; __pyx_L6_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+865: continue
goto __pyx_L3_continue;
+866: for j in range(-1, 2):
for (__pyx_t_4 = -1; __pyx_t_4 < 2; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4;
+867: if j == 0 and i == 0:
__pyx_t_3 = ((__pyx_v_j == 0) != 0); if (__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L11_bool_binop_done; } __pyx_t_3 = ((__pyx_v_i == 0) != 0); __pyx_t_2 = __pyx_t_3; __pyx_L11_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+868: continue
goto __pyx_L8_continue;
+869: cols = column + j
__pyx_v_cols = (__pyx_v_column + __pyx_v_j);
+870: if cols < 0 or cols >= self.cols:
__pyx_t_3 = ((__pyx_v_cols < 0) != 0); if (!__pyx_t_3) { } else { __pyx_t_2 = __pyx_t_3; goto __pyx_L14_bool_binop_done; } __pyx_t_3 = ((__pyx_v_cols >= __pyx_v_self->cols) != 0); __pyx_t_2 = __pyx_t_3; __pyx_L14_bool_binop_done:; if (__pyx_t_2) { /* … */ }
+871: continue
goto __pyx_L8_continue;
+872: if self.map[rows][cols] % 100 == 1:
__pyx_t_2 = (((((__pyx_v_self->map[__pyx_v_rows])[__pyx_v_cols]) % 0x64) == 1) != 0); if (__pyx_t_2) { /* … */ } __pyx_L8_continue:; } __pyx_L3_continue:; }
+873: walls += 1
__pyx_v_walls = (__pyx_v_walls + 1);
+874: return walls
__pyx_r = __pyx_v_walls; goto __pyx_L0;
875:
+876: cdef void refactor_cols_up(self):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_refactor_cols_up(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { int __pyx_v_new_cols; unsigned PY_LONG_LONG *__pyx_v_tmp; int __pyx_v_i; int __pyx_v_j; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("refactor_cols_up", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
877: """If the map end is reached in the columns to the right(direction) | up(array representation),
878: the method will reallocate the map so that it creates a double size of the map and generates the map.
879: """
+880: cdef int new_cols = self.cols * 2
__pyx_v_new_cols = (__pyx_v_self->cols * 2);
881: cdef unsigned long long *tmp
882: cdef int i, j
883:
+884: for i in range(self.rows):
__pyx_t_1 = __pyx_v_self->rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+885: tmp = <unsigned long long *> PyMem_Malloc(new_cols * sizeof(unsigned long long))
__pyx_v_tmp = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_new_cols * (sizeof(unsigned PY_LONG_LONG)))));
886: # first part is same
+887: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+888: tmp[j] = self.map[i][j]
(__pyx_v_tmp[__pyx_v_j]) = ((__pyx_v_self->map[__pyx_v_i])[__pyx_v_j]); }
889: # new second part is need to generate
+890: for j in range(self.cols, new_cols, 1):
__pyx_t_4 = __pyx_v_new_cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = __pyx_v_self->cols; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+891: tmp[j] = self.generate_part_of_map(i, j)
(__pyx_v_tmp[__pyx_v_j]) = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->generate_part_of_map(__pyx_v_self, __pyx_v_i, __pyx_v_j); }
+892: PyMem_Free(self.map[i])
PyMem_Free((__pyx_v_self->map[__pyx_v_i]));
+893: self.map[i] = tmp
(__pyx_v_self->map[__pyx_v_i]) = __pyx_v_tmp; }
+894: self.cols = new_cols
__pyx_v_self->cols = __pyx_v_new_cols;
895:
+896: cdef void refactor_cols_down(self):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_refactor_cols_down(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { int __pyx_v_new_cols; unsigned PY_LONG_LONG *__pyx_v_tmp; int __pyx_v_i; int __pyx_v_j; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("refactor_cols_down", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
897: """If the map end is reached in the columns to the left(direction)| down(array representation),
898: the method will reallocate the map so that it creates a double size of the map and generates the map.
899: The new part of map is created from 0, it needs shift data and shift the position of the player.
900: """
+901: cdef int new_cols = self.cols * 2
__pyx_v_new_cols = (__pyx_v_self->cols * 2);
902: cdef unsigned long long *tmp
903: cdef int i, j
+904: self.mid_col += self.cols
__pyx_v_self->mid_col = (__pyx_v_self->mid_col + __pyx_v_self->cols);
+905: for i in range(self.rows):
__pyx_t_1 = __pyx_v_self->rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+906: tmp = <unsigned long long *> PyMem_Malloc(new_cols * sizeof(unsigned long long))
__pyx_v_tmp = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_new_cols * (sizeof(unsigned PY_LONG_LONG)))));
907: # first part need to generate, down reach..
+908: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+909: tmp[j] = self.generate_part_of_map(i, j)
(__pyx_v_tmp[__pyx_v_j]) = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->generate_part_of_map(__pyx_v_self, __pyx_v_i, __pyx_v_j); }
910: # the next part only copy
+911: for j in range(self.cols, new_cols, 1):
__pyx_t_4 = __pyx_v_new_cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = __pyx_v_self->cols; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+912: tmp[j] = self.map[i][j - self.cols]
(__pyx_v_tmp[__pyx_v_j]) = ((__pyx_v_self->map[__pyx_v_i])[(__pyx_v_j - __pyx_v_self->cols)]); }
+913: PyMem_Free(self.map[i])
PyMem_Free((__pyx_v_self->map[__pyx_v_i]));
+914: self.map[i] = tmp
(__pyx_v_self->map[__pyx_v_i]) = __pyx_v_tmp; }
+915: self.pos_col += self.cols
__pyx_v_self->pos_col = (__pyx_v_self->pos_col + __pyx_v_self->cols);
+916: self.cols = new_cols
__pyx_v_self->cols = __pyx_v_new_cols;
917:
+918: cdef void refactor_rows_down(self):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_refactor_rows_down(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { int __pyx_v_new_rows; unsigned PY_LONG_LONG **__pyx_v_tmp; int __pyx_v_i; int __pyx_v_j; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("refactor_rows_down", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
919: """If the map end is reached in the rows to the up(direction)| down(array representation),
920: the method will reallocate the map so that it creates a double size of the map and generates the map.
921: The new part of map is created from 0, it needs shift data and shift the position of the player.
922: """
+923: cdef int new_rows = self.rows * 2
__pyx_v_new_rows = (__pyx_v_self->rows * 2);
924: cdef unsigned long long ** tmp
925: cdef int i, j
+926: self.mid_row += self.rows
__pyx_v_self->mid_row = (__pyx_v_self->mid_row + __pyx_v_self->rows);
+927: tmp = <unsigned long long **> PyMem_Malloc(new_rows * sizeof(unsigned long long*))
__pyx_v_tmp = ((unsigned PY_LONG_LONG **)PyMem_Malloc((__pyx_v_new_rows * (sizeof(unsigned PY_LONG_LONG *)))));
928: # first part need to generate, down reach..
+929: for i in range(self.rows):
__pyx_t_1 = __pyx_v_self->rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+930: tmp[i] = <unsigned long long *> PyMem_Malloc(self.cols * sizeof(unsigned long long))
(__pyx_v_tmp[__pyx_v_i]) = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_self->cols * (sizeof(unsigned PY_LONG_LONG)))));
+931: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+932: tmp[i][j] = self.generate_part_of_map(i, j)
((__pyx_v_tmp[__pyx_v_i])[__pyx_v_j]) = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->generate_part_of_map(__pyx_v_self, __pyx_v_i, __pyx_v_j); } }
933: # the next part only copy
+934: for i in range(self.rows, new_rows, 1):
__pyx_t_1 = __pyx_v_new_rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = __pyx_v_self->rows; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+935: tmp[i] = self.map[i - self.rows]
(__pyx_v_tmp[__pyx_v_i]) = (__pyx_v_self->map[(__pyx_v_i - __pyx_v_self->rows)]); }
+936: PyMem_Free(self.map)
PyMem_Free(__pyx_v_self->map);
+937: self.map = tmp
__pyx_v_self->map = __pyx_v_tmp;
+938: self.pos_row += self.rows
__pyx_v_self->pos_row = (__pyx_v_self->pos_row + __pyx_v_self->rows);
+939: self.rows = new_rows
__pyx_v_self->rows = __pyx_v_new_rows;
940:
+941: cdef void refactor_rows_up(self):
static void __pyx_f_8worldmor_4game_4game_8Worldmor_refactor_rows_up(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self) { int __pyx_v_new_rows; unsigned PY_LONG_LONG **__pyx_v_tmp; int __pyx_v_i; int __pyx_v_j; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("refactor_rows_up", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
942: """If the map end is reached in the rows to the down(direction)| up(array representation),
943: the method will reallocate the map so that it creates a double size of the map and generates the map.
944: """
+945: cdef int new_rows = self.rows * 2
__pyx_v_new_rows = (__pyx_v_self->rows * 2);
946: cdef unsigned long long ** tmp
947: cdef int i, j
+948: tmp = <unsigned long long **> PyMem_Malloc(new_rows * sizeof(unsigned long long*))
__pyx_v_tmp = ((unsigned PY_LONG_LONG **)PyMem_Malloc((__pyx_v_new_rows * (sizeof(unsigned PY_LONG_LONG *)))));
949: # first part is same
+950: for i in range(self.rows):
__pyx_t_1 = __pyx_v_self->rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+951: tmp[i] = self.map[i]
(__pyx_v_tmp[__pyx_v_i]) = (__pyx_v_self->map[__pyx_v_i]); }
952: # new second part is need to generate
+953: for i in range(self.rows, new_rows, 1):
__pyx_t_1 = __pyx_v_new_rows; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = __pyx_v_self->rows; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+954: tmp[i] = <unsigned long long *> PyMem_Malloc(self.cols * sizeof(unsigned long long))
(__pyx_v_tmp[__pyx_v_i]) = ((unsigned PY_LONG_LONG *)PyMem_Malloc((__pyx_v_self->cols * (sizeof(unsigned PY_LONG_LONG)))));
+955: for j in range(self.cols):
__pyx_t_4 = __pyx_v_self->cols; __pyx_t_5 = __pyx_t_4; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6;
+956: tmp[i][j] = self.generate_part_of_map(i, j)
((__pyx_v_tmp[__pyx_v_i])[__pyx_v_j]) = ((struct __pyx_vtabstruct_8worldmor_4game_4game_Worldmor *)__pyx_v_self->__pyx_vtab)->generate_part_of_map(__pyx_v_self, __pyx_v_i, __pyx_v_j); } }
+957: PyMem_Free(self.map)
PyMem_Free(__pyx_v_self->map);
+958: self.map = tmp
__pyx_v_self->map = __pyx_v_tmp;
+959: self.rows = new_rows
__pyx_v_self->rows = __pyx_v_new_rows;
960:
961: @cython.nonecheck(False)
962: @cython.cdivision(True)
+963: cdef coords get_cords_slides(self, int row, int col):
static struct __pyx_t_8worldmor_4game_4game_coords __pyx_f_8worldmor_4game_4game_8Worldmor_get_cords_slides(struct __pyx_obj_8worldmor_4game_4game_Worldmor *__pyx_v_self, int __pyx_v_row, int __pyx_v_col) { int __pyx_v_x1; int __pyx_v_x2; int __pyx_v_y1; int __pyx_v_y2; struct __pyx_t_8worldmor_4game_4game_coords __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_cords_slides", 0); /* … */ /* function exit code */ __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; }
964: """Method that determines the coordinates of the saved map to be displayed for the specified map size.
965:
966: :param row: number of row to display
967: :param col: number of columns to display
968: :return: min and max coordinates for both direction as structure
969: """
970: cdef int x1, x2, y1, y2
+971: x1 = self.pos_row - (row - 1) / 2
__pyx_v_x1 = (__pyx_v_self->pos_row - ((__pyx_v_row - 1) / 2));
+972: x2 = self.pos_row + row / 2 + 1
__pyx_v_x2 = ((__pyx_v_self->pos_row + (__pyx_v_row / 2)) + 1);
+973: y1 = self.pos_col - (col - 1) / 2
__pyx_v_y1 = (__pyx_v_self->pos_col - ((__pyx_v_col - 1) / 2));
+974: y2 = self.pos_col + col / 2 + 1
__pyx_v_y2 = ((__pyx_v_self->pos_col + (__pyx_v_col / 2)) + 1);
+975: return coords(x1, x2, y1, y2)
__pyx_t_1.row_min = __pyx_v_x1; __pyx_t_1.row_max = __pyx_v_x2; __pyx_t_1.col_min = __pyx_v_y1; __pyx_t_1.col_max = __pyx_v_y2; __pyx_r = __pyx_t_1; goto __pyx_L0;
976:
977: @cython.boundscheck(False)
+978: cdef void free_mem(unsigned long long ** array, int length):
static void __pyx_f_8worldmor_4game_4game_free_mem(unsigned PY_LONG_LONG **__pyx_v_array, int __pyx_v_length) { int __pyx_v_i; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("free_mem", 0); /* … */ /* function exit code */ __Pyx_RefNannyFinishContext(); }
979: """Free allocated memory using malloc.
980:
981: :param array: 2D array to free
982: :param length: length of first dimension
983: """
+984: for i in range(length):
__pyx_t_1 = __pyx_v_length; __pyx_t_2 = __pyx_t_1; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3;
+985: PyMem_Free(array[i])
PyMem_Free((__pyx_v_array[__pyx_v_i]));
}
+986: PyMem_Free(array)
PyMem_Free(__pyx_v_array);