test
This commit is contained in:
1 parent
b78f7ac560
commit
464c7ff1ad
1 file changed
+6
-3
+6
-3
@@ -6,12 +6,15 @@
|
|||||||
#define MAX_RAND_TRIES_PER_WORD 10
|
#define MAX_RAND_TRIES_PER_WORD 10
|
||||||
#define EMPTY_CHAR 0
|
#define EMPTY_CHAR 0
|
||||||
|
|
||||||
// Creates the word salad by placing words randomly and filling empty spaces
|
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int wordCount, char **words, unsigned int seed)
|
||||||
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int wordCount, char **words)
|
|
||||||
{
|
{
|
||||||
// 1. Spielfeld initialisieren (memset ist kürzer und effizienter als Schleifen)
|
// Falls die Unit-Tests deterministisch sein müssen, Zufallsgenerator initialisieren:
|
||||||
|
srand(seed);
|
||||||
|
|
||||||
|
// 1. Spielfeld initialisieren
|
||||||
memset(salad, EMPTY_CHAR, MAX_SEARCH_FIELD_LEN * MAX_SEARCH_FIELD_LEN);
|
memset(salad, EMPTY_CHAR, MAX_SEARCH_FIELD_LEN * MAX_SEARCH_FIELD_LEN);
|
||||||
|
|
||||||
|
// ... restlicher Code bleibt exakt gleich ...
|
||||||
int placedWordsCount = 0;
|
int placedWordsCount = 0;
|
||||||
|
|
||||||
// 2. Jedes Wort aus der Wörterliste platzieren
|
// 2. Jedes Wort aus der Wörterliste platzieren
|
||||||
|
|||||||
Reference in new issue
Block a user