diff --git a/src/main/c/Tim/hangman.c b/src/main/c/Tim/hangman.c index 799ceba..1a52a87 100644 --- a/src/main/c/Tim/hangman.c +++ b/src/main/c/Tim/hangman.c @@ -113,9 +113,10 @@ void hangman() break; } - if(!letterGuessed(userSelection, guessWord, length, displayWord)) + if(!letterGuessed(userSelection, guessWord, length)) { countWrongGuess++; + printf("Der von dir getippte Buchstabe war falsch! Du hast noch %d Versuche.\n", 6-countWrongGuess); } changeLetter(userSelection, guessWord, length, displayWord); drawHangman(countWrongGuess); @@ -152,7 +153,7 @@ bool wordGuessed(char x[], char y[]) } -bool letterGuessed(char x, char y[], int length, char ptr[]) +bool letterGuessed(char x, char y[], int length) { int counter = 0; for(int i = 0; i0) { - printf("Dein gewaehlter Buchstabe %c war ein Treffer!\n", x); + printf("Dein gewaehlter Buchstabe %c war ein Treffer! Du hast noch %d Versuche.\n", x); return true; } else diff --git a/src/main/c/Tim/hangman.h b/src/main/c/Tim/hangman.h index a258422..9a47b14 100644 --- a/src/main/c/Tim/hangman.h +++ b/src/main/c/Tim/hangman.h @@ -5,7 +5,7 @@ void hangman(); char* getWordFromList(int); bool wordGuessed(char[],char[]); -bool letterGuessed(char, char[], int, char[]); +bool letterGuessed(char, char[], int); void changeLetter(char, char[], int, char[]); void drawHangman(int); diff --git a/src/test/c/Tim/test_hangman.c b/src/test/c/Tim/test_hangman.c index e2b04da..757ed29 100644 --- a/src/test/c/Tim/test_hangman.c +++ b/src/test/c/Tim/test_hangman.c @@ -86,9 +86,8 @@ void test_letterGuessed_differentCaps_small_big() char x ='F'; char y[] ="Kartoffel"; int length = 9; - char z[] ="_________"; //assert - TEST_ASSERT_TRUE(letterGuessed(x,y,length,z)); + TEST_ASSERT_TRUE(letterGuessed(x,y,length)); } void test_letterGuessed_differentCaps_big_small() @@ -97,9 +96,8 @@ void test_letterGuessed_differentCaps_big_small() char x ='k'; char y[] ="Kartoffel"; int length = 9; - char z[] ="_________"; //assert - TEST_ASSERT_TRUE(letterGuessed(x,y,length,z)); + TEST_ASSERT_TRUE(letterGuessed(x,y,length)); } void test_letterGuessed_sameCaps_small() { @@ -107,9 +105,8 @@ void test_letterGuessed_sameCaps_small() char x ='f'; char y[] ="Kartoffel"; int length = 9; - char z[] ="_________"; //assert - TEST_ASSERT_TRUE(letterGuessed(x,y,length,z)); + TEST_ASSERT_TRUE(letterGuessed(x,y,length)); } void test_letterGuessed_sameCaps_big() @@ -118,8 +115,7 @@ void test_letterGuessed_sameCaps_big() char x ='K'; char y[] ="Kartoffel"; int length = 9; - char z[] ="_________"; //assert - TEST_ASSERT_TRUE(letterGuessed(x,y,length,z)); + TEST_ASSERT_TRUE(letterGuessed(x,y,length)); }