D
egal hat sich erledigt wurde anderst programmiert ! viel findet ja noch jemand den fehler??
habe ein Riesenproblem wenn ich zb so vom ersten Stern Anfange und rek hinuntersteige
-> ***
* --> komm ich nur zu diesem Stern
* --> und nicht bis zu diesem den nimmts mir einfach nicht?
***
*
* --> wenn ein weiterer Stern hier ist komm ich aber runter ?? wieso??
*
Matrix ist mit einser initialisiert worden und aus Sternen an denen ich entlang gehe!
int CheckMatr( Matrix &matrix, int i, int j, int tempi , int tempj, int &count) {
if (matr.matr[i][j] == '*'){
matr.matr[i][j] = '2';
matr.matr[tempi][tempj]= '3';
if ( matr.matr[i][j+1] != '1' && tempj != j+1 && CheckMatr(matrix, i, j+1, i , j, count)) {
return 1;
} else if (matr.matr[i-1][j+1] != '1' && tempi != i-1 && tempj != j+1 && CheckMatr(matrix, i-1, j+1, i , j, count)) {
return 1;
} else if (matr.matr[i-1][j-1] != '1' && tempi != i-1 && tempj != j-1 && CheckMatr(matrix, i-1, j-1, i , j, count)) {
return 1;
} else if ( matr.matr[i+1][j] != '1' && tempi != i+1 && CheckMatr(matrix, i+1, j, i , j, count)) {
return 1;
} else if (matr.matr[i-1][j] != '1' && tempi != i-1 && CheckMatr(matrix, i-1, j, i , j, count)) {
return 1;
}else if ( matr.matr[i][j-1] != '1' && tempj != j-1 && CheckMatr(matrix, i, j-1, i , j, count)) {
return 1;
}else if (matr.matr[i+1][j-1] != '1' && tempi != i+1 && tempj != j-1 && CheckMatr(matrix, i+1, j-1, i , j, count)) {
return 1;
}else if (matr.matr[i+1][j+1] != '1' && tempi != i+1 && tempj != j+1 && CheckMatr(matrix, i+1, j+1, i , j, count)) {
return 1;
}
matr.matr[i][j] = '3';
++count;
}return 0;
}