|
@ -10,6 +10,7 @@ |
|
|
#define MAX_WORD_LENGTH 30 |
|
|
#define MAX_WORD_LENGTH 30 |
|
|
#define STAGENUM 7 |
|
|
#define STAGENUM 7 |
|
|
#define ASCII_ART_SIZE 1000 |
|
|
#define ASCII_ART_SIZE 1000 |
|
|
|
|
|
#define POSSIBLE_TRYS 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { |
|
|
char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { |
|
@ -87,7 +88,6 @@ void hangman() |
|
|
int countWrongGuess=0; |
|
|
int countWrongGuess=0; |
|
|
strcpy(guessWord,getWordFromList(rand() % LISTSIZE)); |
|
|
strcpy(guessWord,getWordFromList(rand() % LISTSIZE)); |
|
|
length = strlen(guessWord); |
|
|
length = strlen(guessWord); |
|
|
printf("%s %d\n",guessWord, length); |
|
|
|
|
|
|
|
|
|
|
|
char displayWord[MAX_WORD_LENGTH]; |
|
|
char displayWord[MAX_WORD_LENGTH]; |
|
|
drawHangman(countWrongGuess); |
|
|
drawHangman(countWrongGuess); |
|
@ -112,7 +112,7 @@ void hangman() |
|
|
if(!letterGuessed(userSelection, guessWord, length)) |
|
|
if(!letterGuessed(userSelection, guessWord, length)) |
|
|
{ |
|
|
{ |
|
|
countWrongGuess++; |
|
|
countWrongGuess++; |
|
|
printf("Der von dir getippte Buchstabe war falsch! Du hast noch %d Versuche.\n", 6-countWrongGuess); |
|
|
|
|
|
|
|
|
printf("Der von dir getippte Buchstabe war falsch! Du hast noch %d Versuche.\n", POSSIBLE_TRYS-countWrongGuess); |
|
|
} |
|
|
} |
|
|
if(userSelection == '0'||wordGuessed(guessWord, displayWord)||noTrysLeft(countWrongGuess)) |
|
|
if(userSelection == '0'||wordGuessed(guessWord, displayWord)||noTrysLeft(countWrongGuess)) |
|
|
{ |
|
|
{ |
|
@ -224,7 +224,7 @@ void drawHangman(int x) |
|
|
|
|
|
|
|
|
bool noTrysLeft(int x) |
|
|
bool noTrysLeft(int x) |
|
|
{ |
|
|
{ |
|
|
if(x == 6) |
|
|
|
|
|
|
|
|
if(x == POSSIBLE_TRYS) |
|
|
{ |
|
|
{ |
|
|
printf("Du hast verloren!\n\n"); |
|
|
printf("Du hast verloren!\n\n"); |
|
|
return true; |
|
|
return true; |
|
|