private void solveMaze() { bool changed; do { changed = false; for (int x = 0; x < _width; x++) { for (int y = 0; y < _height; y++) { Block block = _maze[x, y]; block.revealMaze = true; if (!block.inMaze) { continue; } if (block.countEffectiveWalls() != 3) { continue; } block.inMaze = false; changed = true; } } } while (changed); for (int x = 0; x < _width; x++) { for (int y = 0; y < _height; y++) { if (_maze[x, y].inMaze) { _maze[x, y].currentState = Block.State.Current; _maze[x, y].Invalidate(); } else { //if(_maze[x,y].currentState == Block.State.Visited) _maze[x, y].Invalidate(); } } } }
public void solve() { bool changed; isSolved = true; do { changed = false; for (int x = 0; x < this.Width; x++) { for (int y = 0; y < this.Height; y++) { Block block = this.mazeBlocks[x, y]; if (!block.inMaze) { continue; } if (block.countEffectiveWalls() != 3) { continue; } block.inMaze = false; block.hidden = false; changed = true; } } } while (changed); for (int x = 0; x < this.Width; x++) { for (int y = 0; y < this.Height; y++) { if (mazeBlocks[x, y].inMaze) { mazeBlocks[x, y].currentState = Block.State.Current; } } } Program.app.performRender(); }