From 99bf671e61d8f5b620fe46ec3efca5a9cd435354 Mon Sep 17 00:00:00 2001 From: MatthisFauvet Date: Tue, 15 Oct 2024 11:48:19 +0200 Subject: [PATCH] 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];