finish wordsalad
- remove printf for debugging and add startGame to main.c
This commit is contained in:
1 parent
cbf5f85caf
commit
596e0a5519
7 files changed
+8
-35
No files matched your search
+1
-23
@@ -15,30 +15,15 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
||||
{
|
||||
unsigned int placedWords = 0;
|
||||
|
||||
//printf("start game.c\n");
|
||||
|
||||
emptyField(searchFieldLen, salad);
|
||||
|
||||
for(int i = 0; i < wordCount; i++)
|
||||
{
|
||||
placedWords += placement(salad, searchFieldLen, words[i]);
|
||||
|
||||
//printf("[%d] of words: %s\n", i, words[i]);
|
||||
}
|
||||
|
||||
fillRandAlpha(searchFieldLen, salad);
|
||||
|
||||
printf("placedWords:%d\n", placedWords);
|
||||
|
||||
for(int i = 0; i < searchFieldLen; i++)
|
||||
{
|
||||
for(int j = 0; j < searchFieldLen; j++)
|
||||
{
|
||||
printf("%c", salad[j][i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
return placedWords;
|
||||
}
|
||||
|
||||
@@ -57,8 +42,6 @@ int placement(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned i
|
||||
int saladX = rand() % ( searchFieldLen - strlen(word) );
|
||||
int saladY = rand() % ( searchFieldLen - strlen(word) );
|
||||
|
||||
printf("%s\n", word);
|
||||
|
||||
if(rand() % 2)
|
||||
{
|
||||
for(int i = 0; i < strlen(word); i++)
|
||||
@@ -100,11 +83,8 @@ void emptyField(unsigned int searchFieldLen, char salad[MAX_SEARCH_FIELD_LEN][MA
|
||||
{
|
||||
for(size_t j = 0; j < searchFieldLen; j++)
|
||||
{
|
||||
//salad[i][j] = '\0';
|
||||
salad[i][j] = ' ';
|
||||
printf("%c", salad[i][j]);
|
||||
salad[i][j] = '\0';
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,10 +97,8 @@ char fillRandAlpha(unsigned int searchFieldLen, char salad[MAX_SEARCH_FIELD_LEN]
|
||||
if(!isalpha(salad[i][j]))
|
||||
{
|
||||
salad[i][j] = alphaRand();
|
||||
//printf("%c", salad[i][j]);
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user