rm print debug + readme

This commit is contained in:
2024-12-12 23:14:17 +01:00
parent 14777da370
commit a1088740d1
3 changed files with 17 additions and 11 deletions

View File

@@ -200,7 +200,7 @@ inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets,
direction.y = 0;
}
//system ("clear");
system ("clear");
move (tab2d, playerPos, direction);
printf ("\n");
@@ -248,12 +248,11 @@ islose (unsigned short int **tab2d, const int N)
vect box;
box.x = x;
box.y = y;
isblock = blockBox (tab2d, N, box);
isblock = blockBox (tab2d, box);
}
if (isblock)
{
printf("%d %d", x, y);
return true;
}
}
@@ -277,7 +276,7 @@ lengthVect (vect vector)
}
bool
blockBox (unsigned short int **tab2d, const int N, vect box_coor)
blockBox (unsigned short int **tab2d, vect box_coor)
{
int nbr_touch = 0;
vect card[4] = { { 0, -1 }, { 1, 0 }, { 0, 1 }, { -1, 0 } };
@@ -299,10 +298,8 @@ blockBox (unsigned short int **tab2d, const int N, vect box_coor)
indice_card = realloc (indice_card, sizeof (int) * nbr_touch);
indice_card[nbr_touch - 1] = i;
printf("i = %d, (%d, %d)\n", i, test.x, test.y);
}
}
printf("nbr_touch = %d\n", nbr_touch);
if (nbr_touch == 0)
return false;
@@ -328,7 +325,6 @@ blockBox (unsigned short int **tab2d, const int N, vect box_coor)
if (id_box == -1) return true;
vect test = plusVect(card[indice_card[id_box]], card[indice_card[(id_box+1) %2]]);
test = plusVect(test, box_coor);
printf("Vect test : %d %d\n", test.x, test.y);
if (tab2d[test.x][test.y] == WALL) return true;
}
return false;
@@ -340,7 +336,6 @@ blockBox (unsigned short int **tab2d, const int N, vect box_coor)
vect dir_test[2] = { director1, director2 };
bool wall = false;
vect current = plusVect (box_coor, director1);
for (int i = 0; i < 2; ++i)
{
@@ -355,12 +350,10 @@ blockBox (unsigned short int **tab2d, const int N, vect box_coor)
val = tab2d[cur_nor.x][cur_nor.y];
if (val != WALL || val != BOX || val != BOX_ON_TARGET)
{
puts("false");
return false;
}
}
puts("fait");
}
return true;
perror("error in blockBox");