Compare commits

...
4 Commits
5 changed files with 11 additions and 24 deletions

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);
+4 -18
View File
@@ -1,14 +1,14 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "input.h"
#include "game.h"
#include "graphicalGame.h"
#define MAX_NUMBER_OF_WORDS 100
#define SALAD_SIZE 20
#define SALAD_SIZE 36
<<<<<<< HEAD
=======
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
int foundWords = 0;
@@ -45,7 +45,6 @@ int checkSalad(char words[][MAX_WORD_LEN], char wordSalad[MAX_SEARCH_FIELD_LEN][
return -1;
}
>>>>>>> 61221a5b8ddad53683e9cad057577a9e8b9ea958
int main(int argc, char *argv[])
{
int exitCode = EXIT_SUCCESS;
@@ -87,7 +86,6 @@ int main(int argc, char *argv[])
fprintf(stderr, "Fehler: Es konnten keine Wörter eingelesen werden (input.c Rückgabewert <= 0).\n");
exitCode = EXIT_FAILURE;
}
<<<<<<< HEAD
// Prüfen, ob game.c (createWordSalad) einen Fehler zurückgegeben hat (<= 0) oder ob nicht alle eingelesenen Wörter platziert werden konnten
else if (placedWords <= 0 || placedWords < wordCount)
@@ -95,21 +93,9 @@ int main(int argc, char *argv[])
fprintf(stderr, "Fehler: Nicht alle Wörter konnten im Wortsalat platziert werden (game.c Rückgabewert <= 0).\n");
exitCode = EXIT_FAILURE;
}
// Wenn alles erfolgreich war, wird das Spiel gestartet.
else
{
printf("Alle Wörter erfolgreich platziert! Starte das Spiel...\n");
// Übergabe an graphicalGame.c via startGame:
startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, 400); // Parameter: (wordSalad, searchFieldSize, words, numberOfWords, windowSize)
}
=======
//keine Ahnung wiegroß pixelSize sein soll
startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, SALAD_SIZE * SALAD_SIZE);
>>>>>>> 61221a5b8ddad53683e9cad057577a9e8b9ea958
startGame(wordSalad, MAX_SEARCH_FIELD_LEN, words, placedWords, MAX_SEARCH_FIELD_LEN * SALAD_SIZE);
}
else
{
// Print error message if file couldn't be opened