From 9bc84202a262eea1df1266edd42b6a8ef9d9f737 Mon Sep 17 00:00:00 2001 From: genique Date: Tue, 15 Oct 2024 11:25:09 +0200 Subject: [PATCH 1/4] =?UTF-8?q?fonctionnalit=C3=A9=20diff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- a.out | Bin 0 -> 16112 bytes pendu.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100755 a.out diff --git a/a.out b/a.out new file mode 100755 index 0000000000000000000000000000000000000000..801e735d436d6ed1b8beb94799a8a21c4d44897e GIT binary patch literal 16112 zcmeHOe{dAneSde7Z21Q|nE_j|W3#p)1;;uhEHH!+pO6k#9WV|C*Y!9#mb;a-=5#0D z?GfQZtW?3}a?yk&W0z(;Q<6X0kTf$SZ832@$$>Bemv)r+A2R8TWl!x&fuy)e8tmG> ze!g$N-($6woJ{`7bb4=Y_xrw|?~nI=-+j0HcK7X*@l6}Tp^%bNr#_*GD>r*cj0J=D zas?!&R;zi~-==O=SAnnBm?w{U1X8b@56`5HjMssZT?eUTx3NVxAg}xyCJp<(r(rlN^MYi@O3x!`?U7}+fCl#`3cev z4^~2@y-&i94-sp8FplgRhclc52?@$KFmB+bRpdZ*eLB}pLu=B%ddQR__h2K5C6;J z&+VJO`1HLEq(l86pQJ;DFxsS$Og6!O7kU?z=Fg(|EHGmhoZ6U8pZ=e-;dHEK!#_C( z{_#2RAU!EzIT+5A5|2Y%-q_&9I_Td=GLz(aI~i2jbVwW|gTZeAr4dDlwrN+kPt zC3-C{&YZCdSmFZPvN`r8f+PJA_eOF>d^xkT%qgq=LU0JQ))1eYQ+cqascFyi|@~)lR zwz(^v&Dh(looO5X`v$TZjwa!$&Z>xhV+>=w)?xh7p6U%uiK|zA(2@V$O^!2<{vD4q zwm|ds>d%-j-0a{?U8nXl{|{e&216#Sz6_pUcE%3{@MVl24&befe=~ruW&CIW?_vCS0N=uRIe@99UFiQ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<_6V%Olv|noYtijF=s%R$b+R?sDA&N)Oc!KBd z@j*Ka4!*o`QVeyj?`d_dKBd+Bt$e?VruJmegh$<+C)sW1^7Qmtt1**+EN7=JGT_=^ z+Eq~VtaBK}YNwk`UFYKba z0nZr@jfy6-1NsrT?{D*aS7|HoyH4+Y6=Vp#CD~QNifC<+p#9?S&em$TVpGC&2$3b1I2n=9xmJ|2+Mw&P&Cu zg$m6v#a`y2LiI{U$SFq3o%CPkgAOnXS?pzAEA&;!{3V$G$04LSqu9$lQRr=KEb)t; z(9c3nb5P-B9xC(!whzY7uo^{$aw_&R4;Cu(U}-xe*pp-JAB%x&ZDc} z%TjVsX#7(VJ2{TO0!AugFW)njmy@= 3) { + const char *word; + int word_length; + + do { + word = words[rand() % MAX_WORDS]; + word_length = strlen(word); + for(i;i taille); + + choisis[compteur_mot] = word; + compteur_mot++; + + strcat(word_finale, word); + + + taille -= word_length; + if(taille > 3){ + strcat(word_finale, "-"); + } + } + + return word_finale; +} + int main() { + srand(time(NULL)); - const char *word = words[rand() % MAX_WORDS]; + char *word = choix_diff(); int word_length = strlen(word); char guessed[word_length]; int tries = 0; -- 2.47.0 From 99bf671e61d8f5b620fe46ec3efca5a9cd435354 Mon Sep 17 00:00:00 2001 From: MatthisFauvet Date: Tue, 15 Oct 2024 11:48:19 +0200 Subject: [PATCH 2/4] Translated all function and vars in english, removed useless vars, added some comments --- pendu.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/pendu.c b/pendu.c index 6f165b0..1843e1f 100644 --- a/pendu.c +++ b/pendu.c @@ -36,43 +36,46 @@ void display_hangman(int tries) { } +/* Choix_diff + +this function allow user to play with multiple at the same time after user said amount of playable chars +*/ char* choix_diff(){ - int compteur_mot = 0; - int taille = 0; - int i =0; - printf("Choisissez la difficulté du jeu en choisissant la taille : "); - scanf(" %d", &taille); + int word_account = 0; //word_count + int size = 0; //size + int i = 0; + + printf("chosed_wordsez la difficulté du jeu en chosed_wordsant la size : "); + scanf(" %d", &size); //&size static char word_finale[100] = ""; - const char *choisis[MAX_WORDS]; - - + const char *chosed_word[MAX_WORDS]; //chosed_word word_finale[0] = '\0'; - while (taille >= 3) { + while (size >= 3) { const char *word; int word_length; do { word = words[rand() % MAX_WORDS]; word_length = strlen(word); - for(i;i taille); + } while (word_length > size); - choisis[compteur_mot] = word; - compteur_mot++; + chosed_word[word_account] = word; + word_account++; strcat(word_finale, word); - taille -= word_length; - if(taille > 3){ + size -= word_length; + if(size > 3){ strcat(word_finale, "-"); } } @@ -81,8 +84,6 @@ char* choix_diff(){ } int main() { - - srand(time(NULL)); char *word = choix_diff(); int word_length = strlen(word); char guessed[word_length]; -- 2.47.0 From 9125414f5a5bf185af8073c5611762aa6cbeacca Mon Sep 17 00:00:00 2001 From: Matthis FAUVET Date: Tue, 15 Oct 2024 11:51:57 +0200 Subject: [PATCH 3/4] Delete a.out --- a.out | Bin 16112 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 a.out diff --git a/a.out b/a.out deleted file mode 100755 index 801e735d436d6ed1b8beb94799a8a21c4d44897e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16112 zcmeHOe{dAneSde7Z21Q|nE_j|W3#p)1;;uhEHH!+pO6k#9WV|C*Y!9#mb;a-=5#0D z?GfQZtW?3}a?yk&W0z(;Q<6X0kTf$SZ832@$$>Bemv)r+A2R8TWl!x&fuy)e8tmG> ze!g$N-($6woJ{`7bb4=Y_xrw|?~nI=-+j0HcK7X*@l6}Tp^%bNr#_*GD>r*cj0J=D zas?!&R;zi~-==O=SAnnBm?w{U1X8b@56`5HjMssZT?eUTx3NVxAg}xyCJp<(r(rlN^MYi@O3x!`?U7}+fCl#`3cev z4^~2@y-&i94-sp8FplgRhclc52?@$KFmB+bRpdZ*eLB}pLu=B%ddQR__h2K5C6;J z&+VJO`1HLEq(l86pQJ;DFxsS$Og6!O7kU?z=Fg(|EHGmhoZ6U8pZ=e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*{@1`M55eR6ZQzE_UaBtwze5-wodiBVjH^oE zJn$NHX3HC%_+{|0CaFGyXN=xzcRSjq65W4#f9K|&F04n#e=`v`6C1X6ZjL9+?yV}Z zanqLdotqL{Hf(q>zAdq>bN!|`R;mY=(Z^&({BK$DP7C#`y0lV0VW%wDQWT8CYxQT! z1B?2r!VX@fUj@jUUd%rONhHX>x5Qr2v$LTDJy(0*()&azpH1}RQvh0)-?IeT-0V@Lq|0e`hH}~=f2~|MnB7v_1 z67l=H6Cd;~z|2n-W;#F;U8SP=Jp-<_6V%Olv|noYtijF=s%R$b+R?sDA&N)Oc!KBd z@j*Ka4!*o`QVeyj?`d_dKBd+Bt$e?VruJmegh$<+C)sW1^7Qmtt1**+EN7=JGT_=^ z+Eq~VtaBK}YNwk`UFYKba z0nZr@jfy6-1NsrT?{D*aS7|HoyH4+Y6=Vp#CD~QNifC<+p#9?S&em$TVpGC&2$3b1I2n=9xmJ|2+Mw&P&Cu zg$m6v#a`y2LiI{U$SFq3o%CPkgAOnXS?pzAEA&;!{3V$G$04LSqu9$lQRr=KEb)t; z(9c3nb5P-B9xC(!whzY7uo^{$aw_&R4;Cu(U}-xe*pp-JAB%x&ZDc} z%TjVsX#7(VJ2{TO0!AugFW)njmy@ Date: Tue, 15 Oct 2024 12:01:11 +0200 Subject: [PATCH 4/4] Merge master and modified some line due to merge --- pendu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pendu.c b/pendu.c index 42dfe9e..78e223b 100644 --- a/pendu.c +++ b/pendu.c @@ -87,10 +87,9 @@ char* choix_diff(){ // main function which starts the game and calculates time and points int main() { char *word = choix_diff(); - int word_length = strlen(word); + int word_length = strlen(word), guessed_correctly = 0, score=0, past_time=0; char guessed[word_length]; int tries = 0; - int guessed_correctly = 0; bool is_time_ecouled; for (int i = 0; i < word_length; i++) { -- 2.47.0