You are on page 1of 1

Bryan Poole

CSC 321
Algorithm Description
The algorithm will search through each position. If it finds a safe area, 0, it will store
the position into an array. If the safe area is on the edge the array will be cleared.
If a danger area, 1, is encountered after a safe area the counter will go back to the
column which it started and move down one row. If danger areas are encountered
after that it will end that isolated safe area and look for another. If a danger area is
encountered first nothing is stored.
For(each column){
For(each row){
Checking = true
While(checking) {
If(map[column][row] = 0) {
Scol = column
Srow = row
If(column!=0and column!=size-1 and row!=0 and row!=size-1){
String str=column + row
Array[a][b] = str
B++
Column++
}
Else {
Array[a]=null
B=0;
}
If(map[column][row]=1){
Column = scol
Row++
}
If(map[column][row]=1){
Checking =false
}
}
Else {
Checking = false
}
}
A++
}
}

You might also like