Generated by Cython 0.29.13
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: CACompute.cpp
+001: # distutils: language=c++
__pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
002: """
003: cdef extern from "Compute.cpp":
004: cdef struct compute_return:
005: int lower_x, lower_y, upper_x, upper_y
006: unordered_map[pair[int, int], int] dict_grid
007: unordered_set[pair[int, int]] cells_changed
008:
009: cdef compute_return compute(vector[pair[int, int]] neighbourhood, bool first,
010: unordered_set[pair[int, int]] cells_changed, int lower_x, int upper_x, int lower_y,
011: int upper_y, unordered_map[pair[int, int], int] copy_grid,
012: unordered_map[pair[int, int], int] dict_grid)
013:
014:
015: cpdef pycompute(vector[pair[int, int]] neighbourhood, bool first,
016: unordered_set[pair[int, int]] cells_changed, int lower_x, int upper_x, int lower_y,
017: int upper_y, unordered_map[pair[int, int], int] copy_grid,
018: unordered_map[pair[int, int], int] dict_grid):
019:
020: cdef compute_return ans = compute(neighbourhood, first, cells_changed, lower_x, upper_x, lower_y, upper_y,
021: copy_grid, dict_grid)
022:
023: return ans.lower_x, ans.lower_y, ans.upper_x, ans.upper_y, ans.cells_changed, ans.dict_grid
024:
025:
026: """
027:
028: from cython.parallel cimport prange
029: from libcpp.vector cimport vector
030: from libcpp.pair cimport pair
031: from libcpp.map cimport map
032: from libcpp.unordered_map cimport unordered_map
033: from libcpp.unordered_set cimport unordered_set
+034: from transFunc import transition_func, depend_on_neighbours, alternating_period
__pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_transition_func); __Pyx_GIVEREF(__pyx_n_s_transition_func); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_transition_func); __Pyx_INCREF(__pyx_n_s_depend_on_neighbours); __Pyx_GIVEREF(__pyx_n_s_depend_on_neighbours); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_depend_on_neighbours); __Pyx_INCREF(__pyx_n_s_alternating_period); __Pyx_GIVEREF(__pyx_n_s_alternating_period); PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_alternating_period); __pyx_t_2 = __Pyx_Import(__pyx_n_s_transFunc, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_transition_func, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_depend_on_neighbours, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_alternating_period); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_alternating_period, __pyx_t_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
035:
036: cdef extern from "compute.cpp":
037: pass
038:
039: cdef unordered_map[pair[int, int], int] depends_cache
040: cdef map[pair[vector[int], int], int] transition_func_cache
+041: cdef int alternating_period2 = alternating_period
__Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_alternating_period); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_9CACompute_alternating_period2 = __pyx_t_3;
+042: cpdef compute(vector[pair[int, int]] neighbourhood,
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_9CACompute_compute(std::vector<std::pair<int,int> > __pyx_v_neighbourhood, std::unordered_set<std::pair<int,int> > __pyx_v_cells_changed, std::unordered_map<std::pair<int,int> ,int> __pyx_v_copy_grid, std::unordered_map<std::pair<int,int> ,int> __pyx_v_dict_grid, int __pyx_v_generations, CYTHON_UNUSED int __pyx_skip_dispatch) {
std::vector<int> __pyx_v_neighbours;
std::unordered_set<std::pair<int,int> > __pyx_v_cells_to_check;
int __pyx_v_ans;
std::pair<int,int> __pyx_v_coordinates;
std::pair<int,int> __pyx_v_coordinates2;
std::pair<int,int> __pyx_v_neighbour;
std::pair<int,int> __pyx_v_coor;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("compute", 0);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_6);
__Pyx_XDECREF(__pyx_t_7);
__Pyx_XDECREF(__pyx_t_8);
__Pyx_XDECREF(__pyx_t_10);
__Pyx_XDECREF(__pyx_t_11);
__Pyx_AddTraceback("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_pw_9CACompute_1compute(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
std::vector<std::pair<int,int> > __pyx_v_neighbourhood;
std::unordered_set<std::pair<int,int> > __pyx_v_cells_changed;
std::unordered_map<std::pair<int,int> ,int> __pyx_v_copy_grid;
std::unordered_map<std::pair<int,int> ,int> __pyx_v_dict_grid;
int __pyx_v_generations;
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("compute (wrapper)", 0);
{
static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_neighbourhood,&__pyx_n_s_cells_changed,&__pyx_n_s_copy_grid,&__pyx_n_s_dict_grid,&__pyx_n_s_generations,0};
PyObject* values[5] = {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 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_neighbourhood)) != 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_cells_changed)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("compute", 1, 5, 5, 1); __PYX_ERR(0, 42, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 2:
if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_copy_grid)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("compute", 1, 5, 5, 2); __PYX_ERR(0, 42, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 3:
if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dict_grid)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("compute", 1, 5, 5, 3); __PYX_ERR(0, 42, __pyx_L3_error)
}
CYTHON_FALLTHROUGH;
case 4:
if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_generations)) != 0)) kw_args--;
else {
__Pyx_RaiseArgtupleInvalid("compute", 1, 5, 5, 4); __PYX_ERR(0, 42, __pyx_L3_error)
}
}
if (unlikely(kw_args > 0)) {
if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "compute") < 0)) __PYX_ERR(0, 42, __pyx_L3_error)
}
} else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
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);
}
__pyx_v_neighbourhood = __pyx_convert_vector_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(values[0]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 42, __pyx_L3_error)
__pyx_v_cells_changed = __pyx_convert_unordered_set_from_py_std_3a__3a_pair_3c_int_2c_int_3e___(values[1]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 43, __pyx_L3_error)
__pyx_v_copy_grid = __pyx_convert_unordered_map_from_py_std_3a__3a_pair_3c_int_2c_int_3e_____and_int(values[2]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L3_error)
__pyx_v_dict_grid = __pyx_convert_unordered_map_from_py_std_3a__3a_pair_3c_int_2c_int_3e_____and_int(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L3_error)
__pyx_v_generations = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_generations == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 45, __pyx_L3_error)
}
goto __pyx_L4_argument_unpacking_done;
__pyx_L5_argtuple_error:;
__Pyx_RaiseArgtupleInvalid("compute", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 42, __pyx_L3_error)
__pyx_L3_error:;
__Pyx_AddTraceback("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
__Pyx_RefNannyFinishContext();
return NULL;
__pyx_L4_argument_unpacking_done:;
__pyx_r = __pyx_pf_9CACompute_compute(__pyx_self, __pyx_v_neighbourhood, __pyx_v_cells_changed, __pyx_v_copy_grid, __pyx_v_dict_grid, __pyx_v_generations);
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_9CACompute_compute(CYTHON_UNUSED PyObject *__pyx_self, std::vector<std::pair<int,int> > __pyx_v_neighbourhood, std::unordered_set<std::pair<int,int> > __pyx_v_cells_changed, std::unordered_map<std::pair<int,int> ,int> __pyx_v_copy_grid, std::unordered_map<std::pair<int,int> ,int> __pyx_v_dict_grid, int __pyx_v_generations) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("compute", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_9CACompute_compute(__pyx_v_neighbourhood, __pyx_v_cells_changed, __pyx_v_copy_grid, __pyx_v_dict_grid, __pyx_v_generations, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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("CACompute.compute", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
043: unordered_set[pair[int, int]] cells_changed,
044: unordered_map[pair[int, int], int] copy_grid, unordered_map[pair[int, int], int] dict_grid,
045: int generations):
046:
047: cdef vector[int] neighbours
+048: neighbours.reserve(neighbourhood.size() + 1)
__pyx_v_neighbours.reserve((__pyx_v_neighbourhood.size() + 1));
049:
050: cdef unordered_set[pair[int, int]] cells_to_check
051:
052: cdef int i, j
053: cdef int ans
054: cdef pair[int, int] coordinates, coordinates2
055: cdef pair[int, int] neighbour
056:
+057: for coor in cells_changed:
__pyx_t_1 = __pyx_v_cells_changed.begin();
for (;;) {
if (!(__pyx_t_1 != __pyx_v_cells_changed.end())) break;
__pyx_t_2 = *__pyx_t_1;
++__pyx_t_1;
__pyx_v_coor = __pyx_t_2;
/* … */
}
+058: for neighbour in neighbourhood:
__pyx_t_3 = __pyx_v_neighbourhood.begin();
for (;;) {
if (!(__pyx_t_3 != __pyx_v_neighbourhood.end())) break;
__pyx_t_2 = *__pyx_t_3;
++__pyx_t_3;
__pyx_v_neighbour = __pyx_t_2;
/* … */
}
+059: coordinates.first = coor.first + neighbour.first
__pyx_v_coordinates.first = (__pyx_v_coor.first + __pyx_v_neighbour.first);
+060: coordinates.second = coor.second + neighbour.second
__pyx_v_coordinates.second = (__pyx_v_coor.second + __pyx_v_neighbour.second);
+061: cells_to_check.insert(coordinates)
(void)(__pyx_v_cells_to_check.insert(__pyx_v_coordinates));
062:
+063: cells_to_check.insert(coor)
(void)(__pyx_v_cells_to_check.insert(__pyx_v_coor));
064:
+065: if alternating_period2 > 1:
__pyx_t_4 = ((__pyx_v_9CACompute_alternating_period2 > 1) != 0);
if (__pyx_t_4) {
/* … */
goto __pyx_L7;
}
+066: if generations % (alternating_period2 - 1) == 0:
__pyx_t_4 = (((__pyx_v_generations % (__pyx_v_9CACompute_alternating_period2 - 1)) == 0) != 0);
if (__pyx_t_4) {
/* … */
}
+067: cells_changed.clear()
__pyx_v_cells_changed.clear();
068: else:
+069: cells_changed.clear()
/*else*/ {
__pyx_v_cells_changed.clear();
}
__pyx_L7:;
070:
+071: for coordinates in cells_to_check:
__pyx_t_1 = __pyx_v_cells_to_check.begin();
for (;;) {
if (!(__pyx_t_1 != __pyx_v_cells_to_check.end())) break;
__pyx_t_2 = *__pyx_t_1;
++__pyx_t_1;
__pyx_v_coordinates = __pyx_t_2;
/* … */
}
+072: neighbours.clear()
__pyx_v_neighbours.clear();
+073: ans = -1
__pyx_v_ans = -1;
074:
+075: if copy_grid.find(coordinates) == copy_grid.end():
__pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates) == __pyx_v_copy_grid.end()) != 0);
if (__pyx_t_4) {
/* … */
goto __pyx_L11;
}
+076: if depends_cache.find(pair[int, int] (0, generations % alternating_period2)) == \
try {
__pyx_t_2 = std::pair<int,int> (0, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 76, __pyx_L1_error)
}
/* … */
__pyx_t_4 = ((__pyx_v_9CACompute_depends_cache.find(__pyx_t_2) == __pyx_v_9CACompute_depends_cache.end()) != 0);
/* … */
if (__pyx_t_4) {
/* … */
goto __pyx_L12;
}
077: depends_cache.end():
+078: ans = depend_on_neighbours(0, generations % alternating_period2)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_generations % __pyx_v_9CACompute_alternating_period2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_int_0, __pyx_t_7}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_int_0, __pyx_t_7}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_int_0); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7); __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_ans = __pyx_t_9;
+079: depends_cache[pair[int, int] (0, generations % alternating_period2)] = ans
try {
__pyx_t_2 = std::pair<int,int> (0, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 79, __pyx_L1_error)
}
(__pyx_v_9CACompute_depends_cache[__pyx_t_2]) = __pyx_v_ans;
080: else:
+081: ans = depends_cache[pair[int, int] (0, generations % alternating_period2)]
/*else*/ {
try {
__pyx_t_2 = std::pair<int,int> (0, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 81, __pyx_L1_error)
}
__pyx_v_ans = (__pyx_v_9CACompute_depends_cache[__pyx_t_2]);
}
__pyx_L12:;
082: else:
+083: if depends_cache.find(pair[int, int] (copy_grid[coordinates], generations % alternating_period2)) == \
/*else*/ {
try {
__pyx_t_2 = std::pair<int,int> ((__pyx_v_copy_grid[__pyx_v_coordinates]), (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 83, __pyx_L1_error)
}
/* … */
__pyx_t_4 = ((__pyx_v_9CACompute_depends_cache.find(__pyx_t_2) == __pyx_v_9CACompute_depends_cache.end()) != 0);
/* … */
if (__pyx_t_4) {
/* … */
goto __pyx_L13;
}
084: depends_cache.end():
+085: ans = depend_on_neighbours(copy_grid[coordinates], generations % alternating_period2)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_depend_on_neighbours); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = __Pyx_PyInt_From_int((__pyx_v_copy_grid[__pyx_v_coordinates])); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_generations % __pyx_v_9CACompute_alternating_period2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_8)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_8); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, __pyx_t_7}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_8, __pyx_t_10, __pyx_t_7}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_11 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); if (__pyx_t_8) { __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL; } __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_7); __pyx_t_10 = 0; __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_ans = __pyx_t_9;
+086: depends_cache[pair[int, int] (copy_grid[coordinates], generations % alternating_period2)] = ans
try {
__pyx_t_2 = std::pair<int,int> ((__pyx_v_copy_grid[__pyx_v_coordinates]), (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 86, __pyx_L1_error)
}
(__pyx_v_9CACompute_depends_cache[__pyx_t_2]) = __pyx_v_ans;
087: else:
+088: ans = depends_cache[pair[int, int] (copy_grid[coordinates], generations % alternating_period2)]
/*else*/ {
try {
__pyx_t_2 = std::pair<int,int> ((__pyx_v_copy_grid[__pyx_v_coordinates]), (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 88, __pyx_L1_error)
}
__pyx_v_ans = (__pyx_v_9CACompute_depends_cache[__pyx_t_2]);
}
__pyx_L13:;
}
__pyx_L11:;
089:
+090: if ans == -1:
__pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
if (__pyx_t_4) {
/* … */
}
+091: for neighbour in neighbourhood:
__pyx_t_3 = __pyx_v_neighbourhood.begin();
for (;;) {
if (!(__pyx_t_3 != __pyx_v_neighbourhood.end())) break;
__pyx_t_2 = *__pyx_t_3;
++__pyx_t_3;
__pyx_v_neighbour = __pyx_t_2;
/* … */
}
+092: coordinates2 = pair[int, int] (coordinates.first + neighbour.first,
try {
__pyx_t_2 = std::pair<int,int> ((__pyx_v_coordinates.first + __pyx_v_neighbour.first), (__pyx_v_coordinates.second + __pyx_v_neighbour.second));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 92, __pyx_L1_error)
}
__pyx_v_coordinates2 = __pyx_t_2;
093: coordinates.second + neighbour.second)
+094: if copy_grid.find(coordinates2) != copy_grid.end():
__pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates2) != __pyx_v_copy_grid.end()) != 0);
if (__pyx_t_4) {
/* … */
goto __pyx_L17;
}
+095: neighbours.push_back(copy_grid[coordinates2])
try {
__pyx_v_neighbours.push_back((__pyx_v_copy_grid[__pyx_v_coordinates2]));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 95, __pyx_L1_error)
}
096: else:
+097: neighbours.push_back(0)
/*else*/ {
try {
__pyx_v_neighbours.push_back(0);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 97, __pyx_L1_error)
}
}
__pyx_L17:;
098:
+099: if copy_grid.find(coordinates) != copy_grid.end():
__pyx_t_4 = ((__pyx_v_copy_grid.find(__pyx_v_coordinates) != __pyx_v_copy_grid.end()) != 0);
if (__pyx_t_4) {
/* … */
goto __pyx_L18;
}
+100: neighbours.push_back(copy_grid[coordinates])
try {
__pyx_v_neighbours.push_back((__pyx_v_copy_grid[__pyx_v_coordinates]));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 100, __pyx_L1_error)
}
+101: if transition_func_cache.find(pair[vector[int], int] (neighbours, generations % alternating_period2)) == \
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 101, __pyx_L1_error)
}
/* … */
__pyx_t_4 = ((__pyx_v_9CACompute_transition_func_cache.find(__pyx_t_12) == __pyx_v_9CACompute_transition_func_cache.end()) != 0);
/* … */
if (__pyx_t_4) {
/* … */
goto __pyx_L19;
}
102: transition_func_cache.end():
+103: if ans == -1:
__pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
if (__pyx_t_4) {
/* … */
}
+104: ans = transition_func(neighbours, generations % alternating_period2)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_11 = __pyx_convert_vector_to_py_int(__pyx_v_neighbours); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_generations % __pyx_v_9CACompute_alternating_period2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_10 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_10)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_10); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_11, __pyx_t_7}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_10, __pyx_t_11, __pyx_t_7}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_8 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); if (__pyx_t_10) { __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_10); __pyx_t_10 = NULL; } __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_9, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_9, __pyx_t_7); __pyx_t_11 = 0; __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_8, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_ans = __pyx_t_9;
+105: transition_func_cache[pair[vector[int], int] (neighbours, generations % alternating_period2)] = ans
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 105, __pyx_L1_error)
}
(__pyx_v_9CACompute_transition_func_cache[__pyx_t_12]) = __pyx_v_ans;
106: else:
+107: if ans == -1: ans = transition_func_cache[pair[vector[int], int] (neighbours, generations % alternating_period2)]
/*else*/ {
__pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
if (__pyx_t_4) {
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 107, __pyx_L1_error)
}
__pyx_v_ans = (__pyx_v_9CACompute_transition_func_cache[__pyx_t_12]);
}
}
__pyx_L19:;
108:
+109: if ans == 0:
__pyx_t_4 = ((__pyx_v_ans == 0) != 0);
if (__pyx_t_4) {
/* … */
goto __pyx_L22;
}
+110: dict_grid.erase(coordinates)
(void)(__pyx_v_dict_grid.erase(__pyx_v_coordinates));
+111: cells_changed.insert(coordinates)
(void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
+112: elif ans != copy_grid[coordinates]:
__pyx_t_4 = ((__pyx_v_ans != (__pyx_v_copy_grid[__pyx_v_coordinates])) != 0);
if (__pyx_t_4) {
/* … */
}
__pyx_L22:;
+113: dict_grid[coordinates] = ans
(__pyx_v_dict_grid[__pyx_v_coordinates]) = __pyx_v_ans;
+114: cells_changed.insert(coordinates)
(void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
115: else:
+116: neighbours.push_back(0)
/*else*/ {
try {
__pyx_v_neighbours.push_back(0);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 116, __pyx_L1_error)
}
+117: if transition_func_cache.find(pair[vector[int], int] (neighbours, generations % alternating_period2)) == \
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 117, __pyx_L1_error)
}
/* … */
__pyx_t_4 = ((__pyx_v_9CACompute_transition_func_cache.find(__pyx_t_12) == __pyx_v_9CACompute_transition_func_cache.end()) != 0);
/* … */
if (__pyx_t_4) {
/* … */
goto __pyx_L23;
}
118: transition_func_cache.end():
+119: if ans == -1:
__pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
if (__pyx_t_4) {
/* … */
}
+120: ans = transition_func(neighbours, generations % alternating_period2)
__Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_transition_func); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_8 = __pyx_convert_vector_to_py_int(__pyx_v_neighbours); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_7 = __Pyx_PyInt_From_int((__pyx_v_generations % __pyx_v_9CACompute_alternating_period2)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_11 = NULL; __pyx_t_9 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_6); if (likely(__pyx_t_11)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); __Pyx_INCREF(__pyx_t_11); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); __pyx_t_9 = 1; } } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_7}; __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) { PyObject *__pyx_temp[3] = {__pyx_t_11, __pyx_t_8, __pyx_t_7}; __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-__pyx_t_9, 2+__pyx_t_9); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } else #endif { __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); if (__pyx_t_11) { __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_11); __pyx_t_11 = NULL; } __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_t_7); __pyx_t_8 = 0; __pyx_t_7 = 0; __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_9 = __Pyx_PyInt_As_int(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_ans = __pyx_t_9;
+121: transition_func_cache[pair[vector[int], int] (neighbours, generations % alternating_period2)] = ans
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 121, __pyx_L1_error)
}
(__pyx_v_9CACompute_transition_func_cache[__pyx_t_12]) = __pyx_v_ans;
122: else:
+123: if ans == -1: ans = transition_func_cache[pair[vector[int], int] (neighbours, generations % alternating_period2)]
/*else*/ {
__pyx_t_4 = ((__pyx_v_ans == -1L) != 0);
if (__pyx_t_4) {
try {
__pyx_t_12 = std::pair<std::vector<int> ,int> (__pyx_v_neighbours, (__pyx_v_generations % __pyx_v_9CACompute_alternating_period2));
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 123, __pyx_L1_error)
}
__pyx_v_ans = (__pyx_v_9CACompute_transition_func_cache[__pyx_t_12]);
}
}
__pyx_L23:;
124:
+125: if ans != 0:
__pyx_t_4 = ((__pyx_v_ans != 0) != 0);
if (__pyx_t_4) {
/* … */
}
}
__pyx_L18:;
+126: dict_grid.insert(pair[pair[int, int], int] (coordinates, ans))
try {
__pyx_t_13 = std::pair<std::pair<int,int> ,int> (__pyx_v_coordinates, __pyx_v_ans);
} catch(...) {
__Pyx_CppExn2PyErr();
__PYX_ERR(0, 126, __pyx_L1_error)
}
(void)(__pyx_v_dict_grid.insert(__pyx_t_13));
+127: cells_changed.insert(coordinates)
(void)(__pyx_v_cells_changed.insert(__pyx_v_coordinates));
128:
129: """
130: if coordinates.second < lower_x:
131: lower_x = coordinates.second
132: elif coordinates.second > upper_x:
133: upper_x = coordinates.second
134:
135: if coordinates.first < lower_y:
136: lower_y = coordinates.first
137: elif coordinates.first > upper_y:
138: upper_y = coordinates.first
139: """
140:
+141: return cells_changed, dict_grid
__Pyx_XDECREF(__pyx_r); __pyx_t_5 = __pyx_convert_unordered_set_to_py_std_3a__3a_pair_3c_int_2c_int_3e___(__pyx_v_cells_changed); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = __pyx_convert_unordered_map_to_py_std_3a__3a_pair_3c_int_2c_int_3e_______int(__pyx_v_dict_grid); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_6); __pyx_t_5 = 0; __pyx_t_6 = 0; __pyx_r = __pyx_t_10; __pyx_t_10 = 0; goto __pyx_L0;