public void TraverseLabyrinth(Cell currentCell, int step)
        {
            if (!this.IsInRange(currentCell))
            {
                return;
            }

            if (this.IsTaken(currentCell))
            {
                return;
            }

            if (this.IsNotForUpdate(currentCell, step))
            {
                return;
            }

            if (this.Labirynth[currentCell.X, currentCell.Y] != CellMarkStart)
            {
                this.Labirynth[currentCell.X, currentCell.Y] = step.ToString();
            }

            var left = new Cell(currentCell.X - 1, currentCell.Y);
            var right = new Cell(currentCell.X + 1, currentCell.Y);
            var top = new Cell(currentCell.X, currentCell.Y - 1);
            var bottom = new Cell(currentCell.X, currentCell.Y + 1);

            this.TraverseLabyrinth(left, step + 1);
            this.TraverseLabyrinth(right, step + 1);
            this.TraverseLabyrinth(top, step + 1);
            this.TraverseLabyrinth(bottom, step + 1);

            return;
        }
        public void Start()
        {
            var startCell = new Cell(2, 1);
            var step = 0;

            this.BuildLabirynth();
            this.TraverseLabyrinth(startCell, step);
            this.PrintLabirynth();
        }
 private bool IsNotForUpdate(Cell cell, int step)
 {
     return (this.Labirynth[cell.X, cell.Y] != CellMarkStart &&
             this.Labirynth[cell.X, cell.Y] != CellMarkFree &&
             int.Parse(this.Labirynth[cell.X, cell.Y]) < step);
 }
 private bool IsTaken(Cell cell)
 {
     return (this.Labirynth[cell.X, cell.Y] == CellMarkTaken);
 }
 private bool IsInRange(Cell cell)
 {
     return (cell.X >= 0 && cell.X < this.Labirynth.GetLength(0) &&
             cell.Y >= 0 && cell.Y < this.Labirynth.GetLength(1));
 }