test
This commit is contained in:
1 parent
b78f7ac560
commit
464c7ff1ad
1 file changed
+7
-4
+7
-4
@@ -6,12 +6,15 @@
|
||||
#define MAX_RAND_TRIES_PER_WORD 10
|
||||
#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)
|
||||
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int wordCount, char **words, unsigned int seed)
|
||||
{
|
||||
// 1. Spielfeld initialisieren (memset ist kürzer und effizienter als Schleifen)
|
||||
memset(salad, EMPTY_CHAR, MAX_SEARCH_FIELD_LEN * MAX_SEARCH_FIELD_LEN);
|
||||
// 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);
|
||||
|
||||
// ... restlicher Code bleibt exakt gleich ...
|
||||
int placedWordsCount = 0;
|
||||
|
||||
// 2. Jedes Wort aus der Wörterliste platzieren
|
||||
|
||||
Reference in new issue
Block a user