avancemet

This commit is contained in:
Raphael BEAU 2023-12-07 12:34:24 +01:00
parent d5f556dce5
commit 4c9197a2d1

View File

@ -76,23 +76,23 @@ int CliqueTouche(int tab[H][L],int direction){
}
int DepXTete(unsigned long suivant2,int sxmax,int symax,int direction,int tab[H][L]){
int DepXTete(int* sxmax,int* symax,int direction,int tab[H][L]){
/*haut*/
if(direction==2){
sxmax=sxmax-1;
tab[sxmax][symax]=1;
return sxmax;
*sxmax=*sxmax-1;
tab[*sxmax][*symax]=1;
return *sxmax;
}
/*bas*/
if(direction==0){
sxmax=sxmax+1;
tab[sxmax][symax]=1;
return sxmax;
*sxmax=*sxmax+1;
tab[*sxmax][*symax]=1;
return *sxmax;
}
}
int DepYTete(unsigned long suivant2,int sxmax,int symax,int direction,int tab[H][L]){
int DepYTete(int* sxmax,int* symax,int* direction,int tab[H][L]){
/*droite*/
if(direction==3){
symax=symax+1;
@ -117,11 +117,11 @@ void Serpent(int tab[H][L], int* psxmax, int* psxmin, int* psymax, int* psymin,
/*deplacement tete*/
if(Microsecondes()>=suivant2){
if(pdirection==0||pdirection==2){
*psxmax=DepXTete(suivant2,psxmax,psymax,pdirection,tab);
if(*pdirection==0||*pdirection==2){
*psxmax=DepXTete(psxmax,psymax,pdirection,tab);
}
else if(pdirection==1||pdirection==3){
*psymax=DepYTete(suivant2,psxmax,psymax,pdirection,tab);
else if(*pdirection==1||*pdirection==3){
*psymax=DepYTete(psxmax,psymax,pdirection,tab);
}
suivant2=Microsecondes()+DELTO;
}
@ -195,4 +195,4 @@ int main(void){
}