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

13
README.md Normal file
View File

@@ -0,0 +1,13 @@
# To Do List
## Principale
[x] (1) chargement et affichage d'un plateau de jeu
[x] (2) Positionnement et gestion du personnage
[x] (3) Positionnement des points a couvrir
[x] (4) Positionnement des caisse et leurs déplacements
## Pour aller plus loin
[ ] (1) Txt to map # mur, P player, C caisse, I boutons
[ ] (2) Affichage du scord en fonction du temps passé, nbr mouvement player , nbr caisse bien placées
[ ] (3) Gestion de niveaux et de difficultés
[x] (5) Detection de partie perdu
[ ] (6) Strategie de résolution
[ ] (7) Conception des niveaux pour garentir la faisabilité d'un plateau

View File

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

View File

@@ -23,7 +23,7 @@ void screenDisplay( unsigned short int **tab,int size);
void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets); void inGameLoop (unsigned short int **tab2d, int N, vect *playerPos, vect *targets, int nbr_targets);
bool isWin(unsigned short int **tab2d, vect *targets, int nbr_targets); bool isWin(unsigned short int **tab2d, vect *targets, int nbr_targets);
bool islose(unsigned short int ** tab2d,const int N); bool islose(unsigned short int ** tab2d,const int N);
bool blockBox(unsigned short int **tab2d, const int N, vect box_coor); bool blockBox(unsigned short int **tab2d, vect box_coor);
#endif // FONCTION_H #endif // FONCTION_H