game
This commit is contained in:
parent
0d192b71fd
commit
f9da187cb2
@ -33,7 +33,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|||||||
//Speichere das Wort im Array, falls es nicht leer ist
|
//Speichere das Wort im Array, falls es nicht leer ist
|
||||||
if (len > 0){
|
if (len > 0){
|
||||||
//Wandel das Wort in Großbuchstaben um
|
//Wandel das Wort in Großbuchstaben um
|
||||||
for (size_t = 0; i < len; i++ ){
|
for (size_t i = 0; i < len; i++ ){
|
||||||
token[i] = toupper ((unsigned char)token[i]);
|
token[i] = toupper ((unsigned char)token[i]);
|
||||||
}
|
}
|
||||||
strncpy(words[word_count], token, MAX_WORD_LEN -1);
|
strncpy(words[word_count], token, MAX_WORD_LEN -1);
|
||||||
|
|||||||
BIN
Start_Windows/input.o
Normal file
BIN
Start_Windows/input.o
Normal file
Binary file not shown.
19
game.c
19
game.c
@ -70,21 +70,22 @@ unsigned int erfolgreichGesetzt = 0;
|
|||||||
fprintf(stderr, "Warnung: Konnte Wort nicht platzieren: %s\n", words[w]);
|
fprintf(stderr, "Warnung: Konnte Wort nicht platzieren: %s\n", words[w]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
//Leere Felder mit Zufallsbuchstaben füllen
|
//Leere Felder mit Zufallsbuchstaben füllen
|
||||||
for (unsigned int i = 0; i < searchFieldLen; i++)
|
for (unsigned int i = 0; i < searchFieldLen; i++)
|
||||||
{
|
|
||||||
for (unsigned int j = 0; j < searchFieldLen; j++)
|
|
||||||
{
|
{
|
||||||
if (salad[i][j] == EMPTY_CHAR)
|
for (unsigned int j = 0; j < searchFieldLen; j++)
|
||||||
salad[i][j] = 'A' + rand() % 26;
|
{
|
||||||
}
|
if (salad[i][j] == EMPTY_CHAR)
|
||||||
|
salad[i][j] = 'A' + rand() % 26;
|
||||||
|
}
|
||||||
|
|
||||||
return erfolgreichGesetzt;
|
return erfolgreichGesetzt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen);
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < searchFieldLen; i++){
|
for (unsigned int i = 0; i < searchFieldLen; i++){
|
||||||
for (unsigned int j = 0; j < searchFieldLen; j++)
|
for (unsigned int j = 0; j < searchFieldLen; j++)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user