Tests benutzt und Fehler in game.c behoben
This commit is contained in:
1 parent
ce17403a1b
commit
ce4be9f902
2 files changed
+6
-6
No files matched your search
@@ -60,3 +60,6 @@ dkms.conf
|
|||||||
|
|
||||||
# macOS
|
# macOS
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
Startcode/testwords_delims.txt
|
||||||
|
Startcode/testwords_empty.txt
|
||||||
|
Startcode/testwords_simple.txt
|
||||||
+3
-6
@@ -6,10 +6,7 @@
|
|||||||
#define MAX_RAND_TRIES_PER_WORD 10
|
#define MAX_RAND_TRIES_PER_WORD 10
|
||||||
#define EMPTY_CHAR 0
|
#define EMPTY_CHAR 0
|
||||||
|
|
||||||
typedef enum Richtung {
|
|
||||||
VERTIKAL = 0;
|
|
||||||
HORIZONTAL = 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
//TODO: Spiellogik implementieren:
|
//TODO: Spiellogik implementieren:
|
||||||
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren
|
/* * Wörter aus der Wortliste zufällig horizontal oder vertikal platzieren
|
||||||
@@ -51,7 +48,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
int dir = rand() % 2;
|
int dir = rand() % 2;
|
||||||
|
|
||||||
if ((MAX_SEARCH_FIELD_LEN - x) < len){
|
if ((MAX_SEARCH_FIELD_LEN - x) < len){
|
||||||
if((MAX_SEARCH_FIELD_LEN - )y < len){
|
if((MAX_SEARCH_FIELD_LEN - y) < len){
|
||||||
// cant place word here (too far in the bottom right corner)
|
// cant place word here (too far in the bottom right corner)
|
||||||
try++;
|
try++;
|
||||||
continue;
|
continue;
|
||||||
@@ -59,7 +56,7 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
//place word vertically
|
//place word vertically
|
||||||
if(dir == HORIZONTAL){
|
if(dir == 1){
|
||||||
//see if all neccessary spaces are empty
|
//see if all neccessary spaces are empty
|
||||||
bool cont = false;
|
bool cont = false;
|
||||||
for (int i = 0; i < (int)len; i++){
|
for (int i = 0; i < (int)len; i++){
|
||||||
|
|||||||
Reference in new issue
Block a user