fixed spielfeldgröße und groß/kleinschreibung
This commit is contained in:
1 parent
61221a5b8d
commit
a48f1b961e
5 files changed
+9
-8
No files matched your search
+3
-2
@@ -1,4 +1,5 @@
|
|||||||
#include "game.h"
|
#include "game.h"
|
||||||
|
#include "input.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -40,11 +41,11 @@ int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsi
|
|||||||
|
|
||||||
int dir = rand() % 2;
|
int dir = rand() % 2;
|
||||||
// cant place vertically
|
// cant place vertically
|
||||||
if(dir == 1 && MAX_SEARCH_FIELD_LEN < (y + (int) len -1)){
|
if(dir == 1 && MAX_SEARCH_FIELD_LEN < (y + (int) len)){
|
||||||
dir = 0;
|
dir = 0;
|
||||||
}
|
}
|
||||||
//cant place horizontally
|
//cant place horizontally
|
||||||
if((x + (int) len -1) > MAX_SEARCH_FIELD_LEN){
|
if((x + (int) len) > MAX_SEARCH_FIELD_LEN){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define MAX_SEARCH_FIELD_LEN 100
|
#define MAX_SEARCH_FIELD_LEN 20
|
||||||
|
|
||||||
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount);
|
int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -27,7 +27,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|||||||
|
|
||||||
strncpy(words[count], copy, len);
|
strncpy(words[count], copy, len);
|
||||||
words[count][len] = '\0';
|
words[count][len] = '\0';
|
||||||
count++;
|
|
||||||
|
|
||||||
//schaue ob auch alles groß geschrieben ist
|
//schaue ob auch alles groß geschrieben ist
|
||||||
for(int i = 0; i < len; i++){
|
for(int i = 0; i < len; i++){
|
||||||
@@ -36,7 +36,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|||||||
words[count][i] -= 32;
|
words[count][i] -= 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
count++;
|
||||||
token = strtok(NULL, delimit);
|
token = strtok(NULL, delimit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define MAX_WORD_LEN 100
|
#define MAX_WORD_LEN 20
|
||||||
#define MAX_LINE_LEN 1024
|
#define MAX_LINE_LEN 1024
|
||||||
|
|
||||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
|
||||||
|
|||||||
+2
-2
@@ -6,7 +6,7 @@
|
|||||||
#include "graphicalGame.h"
|
#include "graphicalGame.h"
|
||||||
|
|
||||||
#define MAX_NUMBER_OF_WORDS 100
|
#define MAX_NUMBER_OF_WORDS 100
|
||||||
#define SALAD_SIZE 20
|
#define SALAD_SIZE 36
|
||||||
|
|
||||||
int checkSalad(char words[][MAX_WORD_LEN], char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], int placedWords, int wordCount){
|
int checkSalad(char words[][MAX_WORD_LEN], char wordSalad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], int placedWords, int wordCount){
|
||||||
//Iteriere über alle verfügbaren Wörter
|
//Iteriere über alle verfügbaren Wörter
|
||||||
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
|
|||||||
exitCode = EXIT_FAILURE;
|
exitCode = EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
//keine Ahnung wiegroß pixelSize sein soll
|
//keine Ahnung wiegroß pixelSize sein soll
|
||||||
startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, SALAD_SIZE * SALAD_SIZE);
|
startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, MAX_SEARCH_FIELD_LEN * SALAD_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user