Browse Source

Erweiterung der Wortliste für Hangman

remotes/origin/tim
fdai7727 11 months ago
parent
commit
3a2ef63aba
  1. 11
      src/main/c/Tim/hangman.c
  2. 1
      src/main/c/Tim/hangman.h
  3. 2
      src/test/c/Tim/test_hangman.c

11
src/main/c/Tim/hangman.c

@ -6,7 +6,7 @@
#include <stdbool.h> #include <stdbool.h>
#include <ctype.h> #include <ctype.h>
#define LISTSIZE 10
#define LISTSIZE 30
#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
@ -15,8 +15,13 @@
char wordlist[LISTSIZE][MAX_WORD_LENGTH] = { char wordlist[LISTSIZE][MAX_WORD_LENGTH] = {
"Kartoffel", "Zigarette", "Haus", "Fenster", "Kartenleseettiketiergeraet", "Kartoffel", "Zigarette", "Haus", "Fenster", "Kartenleseettiketiergeraet",
"Kleiderschrank", "Schnee","Wasserhahn",
"Fernbedienung", "Computertastatur"
"Kleiderschrank", "Schnee","Wasserhahn","Fernbedienung",
"Computertastatur", "Verlies","Zucchini","lizenzieren",
"Portemonnaie","brillant","Rückgrat","Toilettenpapier",
"Dachpappe","Hund","Zwiebelsuppe","Zebra",
"Kruzifix","Anschnallgurt","Bügeleisen","Fliesenleger",
"Adventskranz","Weihnachtsbaum","Autoreifen","Waschbecken",
"Busfahrkarte"
}; };
char hangmanStages[STAGENUM][ASCII_ART_SIZE]={ char hangmanStages[STAGENUM][ASCII_ART_SIZE]={

1
src/main/c/Tim/hangman.h

@ -2,6 +2,7 @@
#ifndef HANGMAN_H #ifndef HANGMAN_H
#define HANGMAN_H #define HANGMAN_H
void hangman(); void hangman();
char* getWordFromList(int); char* getWordFromList(int);
bool wordGuessed(char[],char[]); bool wordGuessed(char[],char[]);

2
src/test/c/Tim/test_hangman.c

@ -43,7 +43,7 @@ void test_getWordFromList_Kleiderschrank_5()
void test_getWordFromList_IndexOutOfList() void test_getWordFromList_IndexOutOfList()
{ {
//arrange //arrange
int pos = 15;
int pos = 60;
char expectedResult[] = "Index nicht vorhanden"; char expectedResult[] = "Index nicht vorhanden";
//act //act
char actualResult[30]; char actualResult[30];

Loading…
Cancel
Save