propagate method

bool propagate()

propogate

Implementation

bool propagate() {
  while (stacksize > 0) {
    Pair stackItem = stack[stacksize - 1];
    stacksize--;
    int i1 = stackItem.x;
    int t1 = stackItem.y;
    int x1 = i1 % mX;
    int y1 = i1 ~/ mX;

    for (int d = 0; d < 4; d++) {
      int x2 = x1 + dx[d];
      int y2 = y1 + dy[d];
      if (!periodic && (x2 < 0 || y2 < 0 || x2 + N > mX || y2 + N > mY)) {
        continue;
      }

      if (x2 < 0) {
        x2 += mX;
      } else if (x2 >= mX) {
        x2 -= mX;
      }
      if (y2 < 0) {
        y2 += mY;
      } else if (y2 >= mY) {
        y2 -= mY;
      }

      int i2 = x2 + y2 * mX;
      List<int> p = propagator![d][t1];
      List<List<int>> compat = compatible![i2];

      for (int l = 0; l < p.length; l++) {
        int t2 = p[l];
        List<int> comp = compat[t2];

        comp[d]--;
        if (comp[d] == 0) {
          ban(i2, t2);
        }
      }
    }
  }
  return sumsOfOnes[0] > 0;
}