public override int DrawBatch(int maxBlocksToDraw) { for (int j = 0; j < _maze.YSize; ++j) { for (int i = 0; i < _maze.XSize; ++i) { DrawAtXY(i * 2, j * 2); if (_maze.GetCell(i, j, 0).Wall(Direction.All[3])) { DrawAtXY(i * 2 + 1, j * 2); } if (_maze.GetCell(i, j, 0).Wall(Direction.All[2])) { DrawAtXY(i * 2, j * 2 + 1); } } DrawAtXY(_maze.XSize * 2, j * 2); if (_maze.GetCell(_maze.XSize - 1, j, 0).Wall(Direction.All[0])) { DrawAtXY(_maze.XSize * 2, j * 2 + 1); } } for (int i = 0; i < _maze.XSize; ++i) { DrawAtXY(i * 2, _maze.YSize * 2); if (_maze.GetCell(i, _maze.YSize - 1, 0).Wall(Direction.All[1])) { DrawAtXY(i * 2 + 1, _maze.YSize * 2); } } DrawAtXY(_maze.XSize * 2, _maze.YSize * 2); IsDone = true; return(_count); }
private void DrawCell(int xCell, int yCell, int zCell) { DrawWall(xCell, yCell, zCell, Direction.All[2]); DrawWall(xCell, yCell, zCell, Direction.All[3]); //here we always request a hint, and in DrawWall we will correct it to the necessary probability //only if we rally draw a wall there if (_drawHints && _maze.GetCell(xCell, yCell, zCell).IsOnSolutionPath()) { _needHint = true; } DrawWall(xCell, yCell, zCell, Direction.All[4]); _needHint = false; DrawColumn(xCell, yCell, zCell, Direction.All[0]); DrawColumn(xCell, yCell, zCell, Direction.All[1]); DrawColumn(xCell, yCell, zCell, Direction.All[4]); //special case: elevator if (_drawElevators && !_maze.GetCell(xCell, yCell, zCell).Wall(Direction.All[5])) { DrawElevator(xCell, yCell, zCell); } }
public bool TryExtend() //returns true if a cell was added to the path { Cell last = _cells.Last(); Direction[] dir = Direction.GetRndPermutation(); for (int i = 0; i < dir.Length; ++i) { Cell next = _maze.GetCell(dir[i].MoveX(last.X), dir[i].MoveY(last.Y), dir[i].MoveZ(last.Z)); if (null == next) //outside { continue; } if (next.Used()) //taken already { continue; } Add(dir[i], next); return(true); } //can not be extended Extendable = false; return(false); }