Translated all function and vars in english, removed useless vars, added some comments

This commit is contained in:
Matthis FAUVET 2024-10-15 11:48:19 +02:00
parent 9bc84202a2
commit 99bf671e61

39
pendu.c
View File

@ -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<compteur_mot;i++){
if(word == choisis[i]){
word_length = taille + 1;
for(i;i<word_account;i++){
if(word == chosed_word[i]){ //chosed_word
word_length = size + 1; //size
}
}
} while (word_length > 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];