generated from freudenreichan/info2Praktikum-Wortsalat
fixed bugs occurring with the macro function in game
This commit is contained in:
parent
e135756db5
commit
34e5f347ef
@ -7,7 +7,7 @@
|
|||||||
#define MAX_RAND_TRIES_PER_WORD 10
|
#define MAX_RAND_TRIES_PER_WORD 10
|
||||||
#define EMPTY_CHAR 0
|
#define EMPTY_CHAR 0
|
||||||
|
|
||||||
#define RANDOMNUMBER(minimum, maximum) rand() % (maximum – minimum + 1) + minimum //Macro to generate a Number between minimum and maximum (both are possibly rolled)
|
#define RANDOMNUMBER(minimum, maximum) ((rand() % ((maximum)-(minimum)+1))+cd minimum) //Macro to generate a Number between minimum and maximum (both are possibly rolled)
|
||||||
|
|
||||||
//TODO: Spiellogik implementieren:
|
//TODO: Spiellogik implementieren:
|
||||||
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren --> Vorher eingabe festlegen!
|
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren --> Vorher eingabe festlegen!
|
||||||
@ -34,11 +34,13 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
{
|
{
|
||||||
for(int j = 0; j < searchFieldLen; j++)
|
for(int j = 0; j < searchFieldLen; j++)
|
||||||
{
|
{
|
||||||
if((salad[i][j] == 63)//checks if there is already a letter of a word placed in here
|
if((salad[i][j] == 63))//checks if there is already a letter of a word placed in here
|
||||||
|
{
|
||||||
salad[i][j] = RANDOMNUMBER(65, 90);//fills "empty" chars in word salad with a random upper case letter
|
salad[i][j] = RANDOMNUMBER(65, 90);//fills "empty" chars in word salad with a random upper case letter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prints the word salad to console
|
// Prints the word salad to console
|
||||||
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen)
|
||||||
|
|||||||
@ -8,5 +8,4 @@
|
|||||||
// Read words from file and store in 'words' array
|
// Read words from file and store in 'words' array
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user