diff --git a/.vscode/configurationCache.log b/.vscode/configurationCache.log new file mode 100644 index 0000000..bab9054 --- /dev/null +++ b/.vscode/configurationCache.log @@ -0,0 +1 @@ +{"buildTargets":[],"launchTargets":[],"customConfigurationProvider":{"workspaceBrowse":{"browsePath":[],"compilerArgs":[]},"fileIndex":[]}} \ No newline at end of file diff --git a/.vscode/dryrun.log b/.vscode/dryrun.log new file mode 100644 index 0000000..7b3f5a8 --- /dev/null +++ b/.vscode/dryrun.log @@ -0,0 +1,6 @@ +make.exe --dry-run --always-make --keep-going --print-directory +make: Entering directory 'c:/Users/Moritz/Documents/Informatik 2 Praktikum/info2Praktikum-WortsalatGruppe1_richtig' +make: Leaving directory 'c:/Users/Moritz/Documents/Informatik 2 Praktikum/info2Praktikum-WortsalatGruppe1_richtig' + +make: *** No targets specified and no makefile found. Stop. + diff --git a/.vscode/targets.log b/.vscode/targets.log new file mode 100644 index 0000000..56fc81c --- /dev/null +++ b/.vscode/targets.log @@ -0,0 +1,282 @@ +make.exe all --print-data-base --no-builtin-variables --no-builtin-rules --question +# GNU Make 4.4.1 +# Built for Windows32 +# Copyright (C) 1988-2023 Free Software Foundation, Inc. +# License GPLv3+: GNU GPL version 3 or later +# This is free software: you are free to change and redistribute it. +# There is NO WARRANTY, to the extent permitted by law. + +# Make data base, printed on Tue Oct 28 13:38:15 2025 + +# Variables + +# environment +SYSTEMDRIVE = C: +# environment +LC_ALL = C +# environment +USERPROFILE = C:\Users\Moritz +# environment +LOCALAPPDATA = C:\Users\Moritz\AppData\Local +# environment +VSCODE_CRASH_REPORTER_PROCESS_TYPE = extensionHost +# environment +VSCODE_CWD = C:\Program Files\Microsoft VS Code +# environment +CHOCOLATEYINSTALL = C:\ProgramData\chocolatey +# environment +SYSTEMROOT = C:\Windows +# environment +PROCESSOR_LEVEL = 25 +# environment +PSMODULEPATH = C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules +# default +MAKE_COMMAND := C:/ProgramData/chocolatey/lib/make/tools/install/bin/make.exe +# automatic +@D = $(patsubst %/,%,$(patsubst %\,%,$(dir $@))) +# environment +CHROME_CRASHPAD_PIPE_NAME = \\.\pipe\crashpad_9148_ARFCBCRJZHAKAMQX +# environment +VSCODE_HANDLES_UNCAUGHT_ERRORS = true +# default +.VARIABLES := +# automatic +%D = $(patsubst %/,%,$(patsubst %\,%,$(dir $%))) +# automatic +^D = $(patsubst %/,%,$(patsubst %\,%,$(dir $^))) +# automatic +%F = $(notdir $%) +# environment +VSCODE_CODE_CACHE_PATH = C:\Users\Moritz\AppData\Roaming\Code\CachedData\7d842fb85a0275a4a8e4d7e040d2625abbf7f084 +# environment +LANG = C +# default +.L +make: *** No rule to make target 'all'. Stop. + +OADED := +# environment +TMP = C:\Users\Moritz\AppData\Local\Temp +# default +.INCLUDE_DIRS := . +# environment +PROCESSOR_ARCHITEW6432 = AMD64 +# makefile +MAKEFLAGS = pqrR +# environment +ONEDRIVE = C:\Users\Moritz\OneDrive +# makefile +CURDIR := c:/Users/Moritz/Documents/Informatik 2 Praktikum/info2Praktikum-WortsalatGruppe1_richtig +# environment +APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL = true +# automatic +*D = $(patsubst %/,%,$(patsubst %\,%,$(dir $*))) +# environment +PROGRAMFILES = C:\Program Files (x86) +# environment +MFLAGS = -pqrR +# default +.SHELLFLAGS := -c +# environment +COMMONPROGRAMW6432 = C:\Program Files\Common Files +# automatic ++D = $(patsubst %/,%,$(patsubst %\,%,$(dir $+))) +# makefile +MAKEFILE_LIST := +# automatic +@F = $(notdir $@) +# environment +VSCODE_PID = 9148 +# automatic +?D = $(patsubst %/,%,$(patsubst %\,%,$(dir $?))) +# environment +__PSLOCKDOWNPOLICY = 0 +# automatic +*F = $(notdir $*) +# automatic + searchFieldLen) continue; + int conflict = 0; + for(size_t i = 0; i < len; i++){ + if(salad[row][col+i] != EMPTY_CHAR && salad[row][col+i] != words[w][i]){ + conflict = 1; + break; + } + } + if(conflict) continue; + for(size_t i = 0; i < len; i++){ + salad[row][col+i] = words[w][i]; + } + placed = 1; + } + else{ + if(row + len > searchFieldLen) continue; + + int conflict = 0; + for(size_t i = 0; i < len; i++){ + if(salad[row+1][col] != EMPTY_CHAR && salad[row+1][col] != words[w][i]){ + conflict = 1; + break; + } + } + if(conflict) continue; + for(size_t i = 0; i < len; i++){ + salad[row+1][col] = words[w][i]; + } + placed = 1; + } + } + } + + + /* code */ + + + //leere Felder mit zufälligen Buchstaben befüllen + for(unsigned int i = 0; i < searchFieldLen; i++ ){ + for(unsigned int j = 0; j < searchFieldLen; j++ ){ + if (salad[i][j] == EMPTY_CHAR) { + salad[i][j] = 'A' + rand() % 26; + + + } + + } + +} } // Prints the word salad to console void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen) { - -} + for (int i=0; i < searchFieldLen; i++) { + for (int j=0; j < searchFieldLen; j++) { + printf("$c",salad[i][j]); + printf(" "); + } + printf ("\n"); + } +} \ No newline at end of file diff --git a/Start_Mac/runTests.exe b/Start_Mac/runTests.exe new file mode 100644 index 0000000..8a3a77b Binary files /dev/null and b/Start_Mac/runTests.exe differ diff --git a/Start_Windows/game.c b/Start_Windows/game.c index 60ef3b3..cb725df 100644 --- a/Start_Windows/game.c +++ b/Start_Windows/game.c @@ -13,7 +13,70 @@ // Creates the word salad by placing words randomly and filling empty spaces int createWordSalad(char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], unsigned int searchFieldLen, const char words[][MAX_WORD_LEN], unsigned int wordCount) { + //Spielfeld vorbereiten +for(unsigned int i = 0; i < searchFieldLen; i++ ){ + for(unsigned int j = 0; j < searchFieldLen; j++ ){ + salad[i][j] = EMPTY_CHAR; + } +} +for (unsigned int w = 0; w < wordCount; w++){ + size_t len = strlen(words[w]); + int placed = 0; + for(int attempt = 0; attempt < MAX_RAND_TRIES_PER_WORD && !placed; attempt++){ + int horizontal = rand() % 2; + int row = rand() % searchFieldLen; + int col = rand() % searchFieldLen; + if(horizontal){ + if(col + len > searchFieldLen) continue; + int conflict = 0; + for(size_t i = 0; i < len; i++){ + if(salad[row][col+i] != EMPTY_CHAR && salad[row][col+i] != words[w][i]){ + conflict = 1; + break; + } + } + if(conflict) continue; + for(size_t i = 0; i < len; i++){ + salad[row][col+i] = words[w][i]; + } + placed = 1; + } + else{ + if(row + len > searchFieldLen) continue; + + int conflict = 0; + for(size_t i = 0; i < len; i++){ + if(salad[row+1][col] != EMPTY_CHAR && salad[row+1][col] != words[w][i]){ + conflict = 1; + break; + } + } + if(conflict) continue; + for(size_t i = 0; i < len; i++){ + salad[row+1][col] = words[w][i]; + } + placed = 1; + } + } + } + + + /* code */ + + + //leere Felder mit zufälligen Buchstaben befüllen + for(unsigned int i = 0; i < searchFieldLen; i++ ){ + for(unsigned int j = 0; j < searchFieldLen; j++ ){ + if (salad[i][j] == EMPTY_CHAR) { + salad[i][j] = 'A' + rand() % 26; + + + } + + } + +} } // Prints the word salad to console @@ -26,5 +89,4 @@ void showWordSalad(const char salad[MAX_SEARCH_FIELD_LEN][MAX_SEARCH_FIELD_LEN], } printf ("\n"); } -} - +} \ No newline at end of file diff --git a/Start_Windows/wordsalad_initial.exe b/Start_Windows/wordsalad_initial.exe new file mode 100644 index 0000000..8e4ebd7 Binary files /dev/null and b/Start_Windows/wordsalad_initial.exe differ