fixed spielfeldgröße und groß/kleinschreibung

This commit is contained in:
sengpielto106561 committed 2026-10-29 15:21:43 +01:00
1 parent 61221a5b8d
commit a48f1b961e
5 files changed
+9 -8

No files matched your search

+3 -2
View File
@@ -1,4 +1,5 @@
#include "game.h"
#include "input.h"
#include <time.h>
#include <stdlib.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;
// 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;
}
//cant place horizontally
if((x + (int) len -1) > MAX_SEARCH_FIELD_LEN){
if((x + (int) len) > MAX_SEARCH_FIELD_LEN){
continue;
}
+1 -1
View File
@@ -3,7 +3,7 @@
#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);
+2 -2
View File
@@ -27,7 +27,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
strncpy(words[count], copy, len);
words[count][len] = '\0';
count++;
//schaue ob auch alles groß geschrieben ist
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;
}
}
count++;
token = strtok(NULL, delimit);
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
#include <stdio.h>
#define MAX_WORD_LEN 100
#define MAX_WORD_LEN 20
#define MAX_LINE_LEN 1024
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount);
+2 -2
View File
@@ -6,7 +6,7 @@
#include "graphicalGame.h"
#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){
//Iteriere über alle verfügbaren Wörter
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
exitCode = EXIT_FAILURE;
}
//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
{