#include "game.h" #include #include #include #define MAX_RAND_TRIES_PER_WORD 10 #define EMPTY_CHAR 0 #define FILLER '.' #define SIZE 20 //TODO: Spiellogik implementieren: /* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren * restliche Felder mit zufälligen Buchstaben füllen */ int can_Place(char grid[SIZE][SIZE], const char *word, int row, int col, int orient) { srand(time(NULL)); //Zufallsgenerator orient = rand() % 2; int len = strlen(word); //Wortlänge best. if (orient == 0) //Horizontal { if (col + len > SIZE) //Rand return 0; for (int i = 0; i < len; i++) if (grid[row][col + i] != FILLER && grid[row][col + i] != word[i]) return 0; } else //Vertikal { if (row + len > SIZE) //Rand return 0; for (int i = 0; i < len; i++) if (grid[row + i][col] != FILLER && grid[row + i][col] != word[i]) return 0; } return 1; } // 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) { } // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { }