public void SetItem(int row, int col, MazeStates value) { if (value == MazeStates.Finish || value == MazeStates.Start) { FindAndReplace(value, MazeStates.Empty); } maze[row, col] = value; }
private void FindAndReplace(MazeStates findValue, MazeStates replaceValue) { for (var i = 0; i < _rows; i++) { for (var j = 0; j < _cols; j++) { if (GetItem(i, j) == findValue) { SetItem(i, j, replaceValue); } } } }
public bool ExistState(MazeStates findValue) { for (var i = 0; i < _rows; i++) { for (var j = 0; j < _cols; j++) { if (GetItem(i, j) == findValue) { return(true); } } } return(false); }
public Point GetFirstItemByType(MazeStates findValue) { for (var i = 0; i < _rows; i++) { for (var j = 0; j < _cols; j++) { if (GetItem(i, j) == findValue) { return(new Point(j, i)); } } } return(null); }