fix seed generator for game
This commit is contained in:
1 parent
ab558de8b3
commit
cbf5f85caf
9 files changed
+27
-10
No files matched your search
+2
-6
@@ -1,5 +1,4 @@
|
||||
#include "game.h"
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
@@ -14,7 +13,6 @@
|
||||
// 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 searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount)
|
||||
{
|
||||
srand(time(NULL));
|
||||
unsigned int placedWords = 0;
|
||||
|
||||
//printf("start game.c\n");
|
||||
@@ -28,7 +26,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
//printf("[%d] of words: %s\n", i, words[i]);
|
||||
}
|
||||
|
||||
//fillRandAlpha(searchFieldLen, salad);
|
||||
fillRandAlpha(searchFieldLen, salad);
|
||||
|
||||
printf("placedWords:%d\n", placedWords);
|
||||
|
||||
@@ -61,9 +59,7 @@ int placement(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned i
|
||||
|
||||
printf("%s\n", word);
|
||||
|
||||
int verhor = rand() % 2;
|
||||
|
||||
if(verhor == 1)
|
||||
if(rand() % 2)
|
||||
{
|
||||
for(int i = 0; i < strlen(word); i++)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user