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 46
|
char symboy = 'a';
for(int i = 0; i < 8; i++){
for(int j = 0; j < 8; j++){
if ( grid[i][j][0].isAsterik()){
defineBlob(i,j,symbol);
}
}
}
defineBlob(int i, int j, char symbol){
/*
There comes all the logic
Im to lazy to write logic for you but I will try to explain.
so first you check if grid[i][j][1] is defined as Letter if it is you do nothing
if it is not you set a letter to it and check surroundings
(ofcourse you check if it is in array first i-1 >= 0 and so on)
and then check if it has a letter(if it dont have call defineBlob(i-1,j,symbol))
it would look something like this:
if(..........)
defineBlob(i-1,j,symbol);
if(..........)
defineBlob(i+1,j,symbol);
if(..........)
defineBlob(i,j-1,symbol);
if(..........)
defineBlob(i,j+1,symbol);
symbol++;
return
*/
}
|