From a1088740d18f68243add614f8422288f5337fdd0 Mon Sep 17 00:00:00 2001 From: Aubin DORIVAL Date: Thu, 12 Dec 2024 23:14:17 +0100 Subject: [PATCH] rm print debug + readme --- README.md | 13 +++++++++++++ function.c | 13 +++---------- function.h | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7bc5a93 --- /dev/null +++ b/README.md @@ -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 diff --git a/function.c b/function.c index b0d228d..ff2a33c 100644 --- a/function.c +++ b/function.c @@ -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"); diff --git a/function.h b/function.h index 198f8fc..38513b0 100644 --- a/function.h +++ b/function.h @@ -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); bool isWin(unsigned short int **tab2d, vect *targets, int nbr_targets); 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