|
|
@ -139,4 +139,43 @@ void Apfel(int realU[N][N]){ |
|
|
|
re; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int lose(int realU[N][N], int realU1[N-1][N-1], char richtung){ |
|
|
|
int groesste = 0; //Suche den Kopf der Schlange |
|
|
|
int ii, jj; |
|
|
|
for(int i = 0; i < N ; i++){ |
|
|
|
for(int j = 0; j < N; j++){ |
|
|
|
if (realU1[i][j] > groesste){ |
|
|
|
groesste = realU1[i][j]; |
|
|
|
ii = i; |
|
|
|
jj = j; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(richtung == 'u'){ |
|
|
|
if(realU[ii - 1][jj] != 0){ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if(richtung == 'd'){ |
|
|
|
if(realU[ii + 1][jj] != N){ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if(richtung == 'l'){ |
|
|
|
if(realU[ii][jj-1] != 0){ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
if(richtung == 'r'){ |
|
|
|
if(realU[ii][jj + 1] > N){ |
|
|
|
return 1; |
|
|
|
} |
|
|
|
} |
|
|
|
return 0; |
|
|
|
|
|
|
|
|
|
|
|
} |