|
@ -14,6 +14,7 @@ |
|
|
printf("%d = %c\n", a , a); |
|
|
printf("%d = %c\n", a , a); |
|
|
a++;} */ |
|
|
a++;} */ |
|
|
int score = 0; |
|
|
int score = 0; |
|
|
|
|
|
void RealU(int realU1[N][N]); |
|
|
void Score(int score); |
|
|
void Score(int score); |
|
|
void Apfel(int realU[N][N]); |
|
|
void Apfel(int realU[N][N]); |
|
|
void Umgebung(int str[N][N]); |
|
|
void Umgebung(int str[N][N]); |
|
@ -23,31 +24,17 @@ int main(){ |
|
|
|
|
|
|
|
|
srand(time(0));// damit wir ein Zufallszahl haben. |
|
|
srand(time(0));// damit wir ein Zufallszahl haben. |
|
|
|
|
|
|
|
|
int realU[N][N];// für eine Schlange |
|
|
|
|
|
for (int i=0;i<N;i++){ |
|
|
|
|
|
for(int j=0;j<N;j++){ |
|
|
|
|
|
|
|
|
|
|
|
realU[i][j]=0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
realU[0][0]=1;// Ende der Schlange |
|
|
|
|
|
realU[0][1]=2; |
|
|
|
|
|
realU[0][2]=3; |
|
|
|
|
|
realU[0][3]=4;// Köpf der Schlange |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int realU[N][N]; |
|
|
|
|
|
RealU(realU); |
|
|
printf("geben Sie die Richtung: ") ; |
|
|
printf("geben Sie die Richtung: ") ; |
|
|
char g=getchar(); |
|
|
char g=getchar(); |
|
|
Apfel(realU); |
|
|
Apfel(realU); |
|
|
|
|
|
|
|
|
if(g!=EOF){ |
|
|
if(g!=EOF){ |
|
|
while(true){ |
|
|
|
|
|
|
|
|
//while(true){ |
|
|
|
|
|
|
|
|
Umgebung(realU); |
|
|
Umgebung(realU); |
|
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
|
}//} |
|
|
/*if (win(realU)) { |
|
|
/*if (win(realU)) { |
|
|
printf("you win\n"); |
|
|
printf("you win\n"); |
|
|
printf("Score: %d\n", score); |
|
|
printf("Score: %d\n", score); |
|
@ -59,6 +46,21 @@ int main(){ |
|
|
Score(score); |
|
|
Score(score); |
|
|
re 0; |
|
|
re 0; |
|
|
} |
|
|
} |
|
|
|
|
|
void RealU(int realU1[N][N]){ |
|
|
|
|
|
// für eine Schlange |
|
|
|
|
|
for (int i=0;i<N;i++){ |
|
|
|
|
|
for(int j=0;j<N;j++){ |
|
|
|
|
|
|
|
|
|
|
|
realU1[i][j]=0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
realU1[0][0]=1;// Ende der Schlange |
|
|
|
|
|
realU1[0][1]=2; |
|
|
|
|
|
realU1[0][2]=3; |
|
|
|
|
|
realU1[0][3]=4;// Köpf der Schlange |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void Score(int score){ |
|
|
void Score(int score){ |
|
|
if (score == 0) { |
|
|
if (score == 0) { |
|
|