public Solver(Vec2i gridSize, State state) { this.heap = new CellHeap(gridSize.area); this.nUnSolved = gridSize.area; this.propagator = new Propagator(); // make all the cells pickable for (int y = 0; y < gridSize.y; y++) { for (int x = 0; x < gridSize.x; x++) { this.heap.add(x, y, state.entropies[x, y].entropyWithNoise()); } } }
static void solveCellWithPattern(int x, int y, PatternId idToLockin, State state, PatternStorage patterns, Propagator propagator) { state.solveCellWithPattern(x, y, patterns[idToLockin.asIndex].weight); // setup next propagation for (int i = 0; i < patterns.len; i++) { var idToRemove = new PatternId(i); if (!state.isPossible(x, y, idToRemove) || i == idToLockin.asIndex) { continue; } state.removePattern(x, y, idToRemove); propagator.onSolve(x, y, idToRemove); } }