forked from freudenreichan/info2Praktikum-Wortsalat
Merge branch 'Worteinlesen' of https://git.efi.th-nuernberg.de/gitea/perschkema103633/info2Praktikum-Wortsalat into Worteinlesen
This commit is contained in:
commit
ed3b2e797c
3 files changed
+15
-34
No files matched your search
@@ -0,0 +1,14 @@
|
|||||||
|
# Wortsalat Projekt
|
||||||
|
|
||||||
|
Ein GeneDas Programm liest eine Liste von Wörtern aus einer übergebenen Textdatei (z.B. `words.txt`), versteckt diese zufällig in einem Raster und füllt die restlichen leeren Felder mit zufälligen Buchstaben auf, sodass ein Wortsuchrätsel entsteht.
|
||||||
|
|
||||||
|
Code frisch bauen
|
||||||
|
make clean
|
||||||
|
make wordsalad_myversion
|
||||||
|
|
||||||
|
Das Spiel starten
|
||||||
|
./wordsalad_myversion words.txt
|
||||||
|
|
||||||
|
Uni-Tests ausführen
|
||||||
|
make test
|
||||||
|
./runTests
|
||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define MAX_SEARCH_FIELD_LEN 20
|
#define MAX_SEARCH_FIELD_LEN 100
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "graphicalGame.h"
|
|
||||||
#include "game.h"
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN];
|
|
||||||
|
|
||||||
char words[][MAX_WORD_LEN] = {
|
|
||||||
"HALLO",
|
|
||||||
"WELT",
|
|
||||||
"AUTO",
|
|
||||||
"BIRNE",
|
|
||||||
"APFEL",
|
|
||||||
"BANANE",
|
|
||||||
"LANGESWORT",
|
|
||||||
"REITSPORT",
|
|
||||||
"APFELBAUM",
|
|
||||||
"DRACULA",
|
|
||||||
"LAPTOP",
|
|
||||||
"BILDSCHRIM",
|
|
||||||
"HAUS"
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned int wordCount = sizeof(words) / sizeof(words[0]);
|
|
||||||
|
|
||||||
int placedWords = createWordSalad(salad, MAX_SEARCH_FIELD_LEN, words, wordCount);
|
|
||||||
startGame(salad, MAX_SEARCH_FIELD_LEN, words, wordCount, 1000);
|
|
||||||
printf("Placed words: %d\n", placedWords);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user