Browse Source

refactoring: attempts --> versuche

remotes/origin/peter^2
Peter Wiebe 11 months ago
parent
commit
8c50077839
  1. 12
      src/main/c/hangman.c

12
src/main/c/hangman.c

@ -170,7 +170,7 @@ void levelauswahl(){
void hauptSpiel(int level){ void hauptSpiel(int level){
char secret_word[100]; char secret_word[100];
int attempts = 0;
int versuche = 0;
char guessed_letter; char guessed_letter;
char guessed_letters[100]; char guessed_letters[100];
char path[] = "hangman_words.txt"; char path[] = "hangman_words.txt";
@ -179,8 +179,8 @@ void hauptSpiel(int level){
lade_secret_word(secret_word, level, path); lade_secret_word(secret_word, level, path);
while (attempts < 6 && won == 0) {
draw_hangman(attempts);
while (versuche < 6 && won == 0) {
draw_hangman(versuche);
show_letters(secret_word, guessed_letters); show_letters(secret_word, guessed_letters);
guessed_letter = eingabe_buchstabe(); guessed_letter = eingabe_buchstabe();
result = letter_in_secret_word(guessed_letter, secret_word); result = letter_in_secret_word(guessed_letter, secret_word);
@ -188,7 +188,7 @@ void hauptSpiel(int level){
add_guessed_letter(guessed_letters, guessed_letter); add_guessed_letter(guessed_letters, guessed_letter);
} }
else { else {
attempts++;
versuche++;
} }
won = has_won(secret_word, guessed_letters); won = has_won(secret_word, guessed_letters);
} }
@ -197,12 +197,12 @@ void hauptSpiel(int level){
} }
} }
void draw_hangman(int attempts) {
void draw_hangman(int versuche) {
clear_screen(); clear_screen();
printf("Galgenmann!\n"); printf("Galgenmann!\n");
printf("v.1.0.2\n\n"); printf("v.1.0.2\n\n");
switch(attempts) {
switch(versuche) {
case 0: case 0:
printf(" _______\n"); printf(" _______\n");
printf(" | |\n"); printf(" | |\n");

Loading…
Cancel
Save