1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
for (rowIndex = 1; rowIndex < MAXROWS; rowIndex++)
for (columnIndex = 1; columnIndex < MAXCOLUMNS; columnIndex++)
if (blobArray[rowIndex][columnIndex] = ' ')
{
int count = 0; // count for the number of blobs
myArray [row][column] = ' ';
if (myArray[row-1][column+1] != ' ')//up and right
{
eraseAndTrack(myArray, row-1, column+1);
}
if (myArray[row][column+1] != ' ')//right
{
eraseAndTrack(myArray, row, column+1);
}
if (myArray[row+1][column+1] != ' ')//down and right
{
eraseAndTrack(myArray, row+1, column+1);
}
if (myArray[row+1][column] != ' ')//down
{
eraseAndTrack(myArray, row+1, column);
}
if (myArray[row+1][column-1] != ' ')//down and left
{
eraseAndTrack(myArray, row+1, column-1);
}
if (myArray[row][column-1] != ' ')//left
{
eraseAndTrack(myArray, row, column-1);
}
if (myArray[row+1][column-1] != ' ')//up and left
{
eraseAndTrack(myArray, row+1, column-1);
}
if (myArray[row+1][column] != ' ')//up
{
eraseAndTrack(myArray, row+1, column);
}
}
|