updating repo

This commit is contained in:
Anja Freudenreich
2026-09-17 14:36:54 +02:00
parent eaa16ed84c
commit 93db739464
77 changed files with 240 additions and 28035 deletions
+42
View File
@@ -0,0 +1,42 @@
#include "game.h"
#include "input.h"
#include <stdio.h>
#include <stdlib.h>
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen);
int main()
{
const int searchFieldLen = 30;
if(searchFieldLen < MAX_SEARCH_FIELD_LEN)
{
const char words[][MAX_WORD_LEN] = {"Test", "NochEinTest", "WiederEinTest", "EinWeiteresTestWort", "UndSoWeiter"};
char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
int numberOfWords = sizeof(words)/sizeof(words[0]);
int placedWords = createWordSalad(salad, searchFieldLen, words, numberOfWords);
printf("Placed %d of %d words ...\n", placedWords, numberOfWords);
showWordSalad(salad, searchFieldLen);
return EXIT_SUCCESS;
}
else
{
fprintf(stderr, "Error: Selected search field must not be larger than maximum search field ...\n");
return EXIT_FAILURE;
}
}
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
{
for(int i = 0; i < searchFieldLen; i++)
{
for(int j = 0; j < searchFieldLen; j++)
printf("%c", salad[i][j]);
printf("\n");
}
}