insertNodeOnMatrix method

void insertNodeOnMatrix(
  1. NodeOutput item,
  2. State state,
  3. bool checkCollision
)

Implementation

void insertNodeOnMatrix(NodeOutput item, State state, bool checkCollision) {
  var mtx = state.mtx;
  // check occupied here
  if (checkCollision &&
      (mtx.hasHorizontalCollision(state.x, state.y) ||
          mtx.cellBusyForItem(item, state.x, state.y))) {
    mtx.insertRowBefore(state.y);
  }
  mtx.insert(state.x, state.y, item);
  this.markIncomesAsPassed(mtx, item);
  return;
}