|
|
@ -179,13 +179,26 @@ namespace IdaStar |
|
|
|
if (!neighbour.IsInsideBox(_board.Count, _board[0].Count)) { |
|
|
|
if (!neighbour.IsInsideBox(_board.Count, _board[0].Count)) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (_board[neighbour.Row][neighbour.Column] == CellState.OBSTACLE) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_board[neighbour.Row][neighbour.Column] == CellState.EMPTY) { |
|
|
|
|
|
|
|
_board[neighbour.Row][neighbour.Column] = CellState.PATH; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
AlgorithmStep?.Invoke(this); |
|
|
|
var neighbourF = search(neighbour, cost + increment, threshold); |
|
|
|
var neighbourF = search(neighbour, cost + increment, threshold); |
|
|
|
|
|
|
|
|
|
|
|
if (neighbourF < min) { |
|
|
|
if (neighbourF < min) { |
|
|
|
min = neighbourF; |
|
|
|
min = neighbourF; |
|
|
|
} |
|
|
|
} |
|
|
|
if (min == zero) { |
|
|
|
if (min == zero) { |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (_board[neighbour.Row][neighbour.Column] == CellState.PATH) { |
|
|
|
|
|
|
|
_board[neighbour.Row][neighbour.Column] = CellState.EMPTY; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return min; |
|
|
|
return min; |
|
|
|