diff --git a/CMakeLists.txt b/CMakeLists.txt index 55c5ea3..5538ad5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,4 +13,6 @@ add_executable(pmuw_projekt_notebinder src/main/c/Hangman/word_selector.h src/main/c/main.c src/main/c/main.h - ) + src/main/c/Hangman/drawHangman.c + src/main/c/Hangman/drawHangman.h +) diff --git a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-c6ffc0b664e1b12e7dfc.json b/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-c6ffc0b664e1b12e7dfc.json deleted file mode 100644 index a13cb3d..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-c6ffc0b664e1b12e7dfc.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "configurations" : - [ - { - "directories" : - [ - { - "build" : ".", - "jsonFile" : "directory-.-Debug-f5ebdc15457944623624.json", - "minimumCMakeVersion" : - { - "string" : "3.26" - }, - "projectIndex" : 0, - "source" : ".", - "targetIndexes" : - [ - 0 - ] - } - ], - "name" : "Debug", - "projects" : - [ - { - "directoryIndexes" : - [ - 0 - ], - "name" : "pmuw_projekt_notebinder", - "targetIndexes" : - [ - 0 - ] - } - ], - "targets" : - [ - { - "directoryIndex" : 0, - "id" : "pmuw_projekt_notebinder::@6890427a1f51a3e7e1df", - "jsonFile" : "target-pmuw_projekt_notebinder-Debug-439d4177ec694957d283.json", - "name" : "pmuw_projekt_notebinder", - "projectIndex" : 0 - } - ] - } - ], - "kind" : "codemodel", - "paths" : - { - "build" : "/Users/saba/CLionProjects/pmuw_projekt_notebinder/cmake-build-debug", - "source" : "/Users/saba/CLionProjects/pmuw_projekt_notebinder" - }, - "version" : - { - "major" : 2, - "minor" : 5 - } -} diff --git a/cmake-build-debug/.cmake/api/v1/reply/index-2024-01-24T18-53-34-0975.json b/cmake-build-debug/.cmake/api/v1/reply/index-2024-01-24T18-53-34-0975.json deleted file mode 100644 index 21c2ccd..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/index-2024-01-24T18-53-34-0975.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "cmake" : - { - "generator" : - { - "multiConfig" : false, - "name" : "Ninja" - }, - "paths" : - { - "cmake" : "/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake", - "cpack" : "/Applications/CLion.app/Contents/bin/cmake/mac/bin/cpack", - "ctest" : "/Applications/CLion.app/Contents/bin/cmake/mac/bin/ctest", - "root" : "/Applications/CLion.app/Contents/bin/cmake/mac/share/cmake-3.26" - }, - "version" : - { - "isDirty" : false, - "major" : 3, - "minor" : 26, - "patch" : 4, - "string" : "3.26.4", - "suffix" : "" - } - }, - "objects" : - [ - { - "jsonFile" : "codemodel-v2-c6ffc0b664e1b12e7dfc.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 5 - } - }, - { - "jsonFile" : "cache-v2-797367ee73be0946ea69.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - { - "jsonFile" : "cmakeFiles-v1-9ac3996b5bf98606de02.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - { - "jsonFile" : "toolchains-v1-e0f424cc4383644d699f.json", - "kind" : "toolchains", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - ], - "reply" : - { - "cache-v2" : - { - "jsonFile" : "cache-v2-797367ee73be0946ea69.json", - "kind" : "cache", - "version" : - { - "major" : 2, - "minor" : 0 - } - }, - "cmakeFiles-v1" : - { - "jsonFile" : "cmakeFiles-v1-9ac3996b5bf98606de02.json", - "kind" : "cmakeFiles", - "version" : - { - "major" : 1, - "minor" : 0 - } - }, - "codemodel-v2" : - { - "jsonFile" : "codemodel-v2-c6ffc0b664e1b12e7dfc.json", - "kind" : "codemodel", - "version" : - { - "major" : 2, - "minor" : 5 - } - }, - "toolchains-v1" : - { - "jsonFile" : "toolchains-v1-e0f424cc4383644d699f.json", - "kind" : "toolchains", - "version" : - { - "major" : 1, - "minor" : 0 - } - } - } -} diff --git a/cmake-build-debug/.cmake/api/v1/reply/target-pmuw_projekt_notebinder-Debug-439d4177ec694957d283.json b/cmake-build-debug/.cmake/api/v1/reply/target-pmuw_projekt_notebinder-Debug-439d4177ec694957d283.json deleted file mode 100644 index b84f699..0000000 --- a/cmake-build-debug/.cmake/api/v1/reply/target-pmuw_projekt_notebinder-Debug-439d4177ec694957d283.json +++ /dev/null @@ -1,159 +0,0 @@ -{ - "artifacts" : - [ - { - "path" : "pmuw_projekt_notebinder" - } - ], - "backtrace" : 1, - "backtraceGraph" : - { - "commands" : - [ - "add_executable", - "include_directories" - ], - "files" : - [ - "CMakeLists.txt" - ], - "nodes" : - [ - { - "file" : 0 - }, - { - "command" : 0, - "file" : 0, - "line" : 10, - "parent" : 0 - }, - { - "command" : 1, - "file" : 0, - "line" : 6, - "parent" : 0 - }, - { - "command" : 1, - "file" : 0, - "line" : 7, - "parent" : 0 - }, - { - "command" : 1, - "file" : 0, - "line" : 8, - "parent" : 0 - } - ] - }, - "compileGroups" : - [ - { - "compileCommandFragments" : - [ - { - "fragment" : "-g -std=gnu11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fcolor-diagnostics" - } - ], - "includes" : - [ - { - "backtrace" : 2, - "path" : "/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c" - }, - { - "backtrace" : 3, - "path" : "/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman" - }, - { - "backtrace" : 4, - "path" : "/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Template" - } - ], - "language" : "C", - "languageStandard" : - { - "backtraces" : - [ - 1 - ], - "standard" : "11" - }, - "sourceIndexes" : - [ - 0, - 2 - ] - } - ], - "id" : "pmuw_projekt_notebinder::@6890427a1f51a3e7e1df", - "link" : - { - "commandFragments" : - [ - { - "fragment" : "-g", - "role" : "flags" - }, - { - "fragment" : "", - "role" : "flags" - } - ], - "language" : "C" - }, - "name" : "pmuw_projekt_notebinder", - "nameOnDisk" : "pmuw_projekt_notebinder", - "paths" : - { - "build" : ".", - "source" : "." - }, - "sourceGroups" : - [ - { - "name" : "Source Files", - "sourceIndexes" : - [ - 0, - 2 - ] - }, - { - "name" : "Header Files", - "sourceIndexes" : - [ - 1, - 3 - ] - } - ], - "sources" : - [ - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/main/c/Hangman/word_selector.c", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/main/c/Hangman/word_selector.h", - "sourceGroupIndex" : 1 - }, - { - "backtrace" : 1, - "compileGroupIndex" : 0, - "path" : "src/main/c/main.c", - "sourceGroupIndex" : 0 - }, - { - "backtrace" : 1, - "path" : "src/main/c/main.h", - "sourceGroupIndex" : 1 - } - ], - "type" : "EXECUTABLE" -} diff --git a/cmake-build-debug/.ninja_deps b/cmake-build-debug/.ninja_deps index 6c9cd66..5e1fdca 100644 Binary files a/cmake-build-debug/.ninja_deps and b/cmake-build-debug/.ninja_deps differ diff --git a/cmake-build-debug/.ninja_log b/cmake-build-debug/.ninja_log index 8ff0b30..eb76abb 100644 --- a/cmake-build-debug/.ninja_log +++ b/cmake-build-debug/.ninja_log @@ -1,10 +1,9 @@ # ninja log v5 1 38 1706122217155672196 CMakeFiles/pmuw_projekt_notebinder.dir/test/Hangman/word_selector_test.c.o e932f546d59a9d76 -1 38 1706122217155215603 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 +2 168 1706178769260469565 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 +0 40 1706549371890997682 build.ninja f2183aada2fc9ffc 1 38 1706122372717341436 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o f1dbf76e6b4bc97d -0 40 1706122414971396759 build.ninja f2183aada2fc9ffc 1 44 1706122039878920765 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Template/game100.c.o 69a5bcd8c57a43b3 -0 40 1706122414971396759 build.ninja f2183aada2fc9ffc -1 28 1706122415002971947 pmuw_projekt_notebinder d4d2c5136dd5469e -2 168 1706178769260469565 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 168 257 1706178769348509184 pmuw_projekt_notebinder d4d2c5136dd5469e +1 145 1706549408123039155 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421 +1 145 1706549408123027405 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o de5f7edc6c2379d7 diff --git a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt index 8ac5c4d..7126f32 100644 --- a/cmake-build-debug/CMakeFiles/clion-Debug-log.txt +++ b/cmake-build-debug/CMakeFiles/clion-Debug-log.txt @@ -1,10 +1,4 @@ /Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MAKE_PROGRAM=/Applications/CLion.app/Contents/bin/ninja/mac/ninja -G Ninja -S /Users/saba/CLionProjects/pmuw_projekt_notebinder -B /Users/saba/CLionProjects/pmuw_projekt_notebinder/cmake-build-debug --- The C compiler identification is AppleClang 15.0.0.15000100 --- Detecting C compiler ABI info --- Detecting C compiler ABI info - done --- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped --- Detecting C compile features --- Detecting C compile features - done --- Configuring done (0.5s) +-- Configuring done (0.0s) -- Generating done (0.0s) -- Build files have been written to: /Users/saba/CLionProjects/pmuw_projekt_notebinder/cmake-build-debug diff --git a/cmake-build-debug/Testing/Temporary/LastTest.log b/cmake-build-debug/Testing/Temporary/LastTest.log index bd8e2b9..e29350d 100644 --- a/cmake-build-debug/Testing/Temporary/LastTest.log +++ b/cmake-build-debug/Testing/Temporary/LastTest.log @@ -1,3 +1,3 @@ -Start testing: Jan 25 11:32 CET +Start testing: Jan 29 18:29 CET ---------------------------------------------------------- -End testing: Jan 25 11:32 CET +End testing: Jan 29 18:29 CET diff --git a/cmake-build-debug/build.ninja b/cmake-build-debug/build.ninja index 083feea..46fbc18 100644 --- a/cmake-build-debug/build.ninja +++ b/cmake-build-debug/build.ninja @@ -63,6 +63,13 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o: C_COMPILER__pm OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir OBJECT_FILE_DIR = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c +build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/drawHangman.c || cmake_object_order_depends_target_pmuw_projekt_notebinder + DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o.d + FLAGS = -g -std=gnu11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fcolor-diagnostics + INCLUDES = -I/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c -I/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman -I/Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Template + OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir + OBJECT_FILE_DIR = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman + # ============================================================================= # Link build statements for EXECUTABLE target pmuw_projekt_notebinder @@ -71,7 +78,7 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o: C_COMPILER__pm ############################################# # Link the executable pmuw_projekt_notebinder -build pmuw_projekt_notebinder: C_EXECUTABLE_LINKER__pmuw_projekt_notebinder_Debug CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o +build pmuw_projekt_notebinder: C_EXECUTABLE_LINKER__pmuw_projekt_notebinder_Debug CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o FLAGS = -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir POST_BUILD = : diff --git a/cmake-build-debug/pmuw_projekt_notebinder b/cmake-build-debug/pmuw_projekt_notebinder deleted file mode 100755 index 03a987c..0000000 Binary files a/cmake-build-debug/pmuw_projekt_notebinder and /dev/null differ diff --git a/src/main/c/Hangman/drawHangman.c b/src/main/c/Hangman/drawHangman.c new file mode 100644 index 0000000..a4ae31f --- /dev/null +++ b/src/main/c/Hangman/drawHangman.c @@ -0,0 +1,84 @@ +#include + +void drawHangman(int incorrectGuesses) { + + if (incorrectGuesses == 0) { + printf(" +---+\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 1) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 2) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" O |\n"); + printf(" |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 3) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" O |\n"); + printf(" | |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 4) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" O |\n"); + printf(" /| |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 5) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" O |\n"); + printf(" /|\\ |\n"); + printf(" |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses == 6) { + printf(" +---+\n"); + printf(" | |\n"); + printf(" O |\n"); + printf(" /|\\ |\n"); + printf(" / \\ |\n"); + printf(" |\n"); + printf("=========\n"); + } + + if (incorrectGuesses >= 7) { + printf(" \n"); + printf(" __ _ __ _ _ __ ___ ___ _____ _____ _ __ \n"); + printf(" / _` |/ _` | '_ ` _ \\ / _ \\ / _ \\ \\ / / _ \\ '__|\n"); + printf(" | (_| | (_| | | | | | | __/ | (_) \\ V / __/ | \n"); + printf(" \\__, |\\__,_|_| |_| |_|\\___| \\___/ \\_/ \\___|_| \n"); + printf(" |___/ \n"); + + } +} \ No newline at end of file diff --git a/src/main/c/Hangman/drawHangman.h b/src/main/c/Hangman/drawHangman.h new file mode 100644 index 0000000..6c6334f --- /dev/null +++ b/src/main/c/Hangman/drawHangman.h @@ -0,0 +1,8 @@ +// +// Created by Saba Fazlali on 29.01.24. +// + +#ifndef PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H +#define PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H + +#endif //PMUW_PROJEKT_NOTEBINDER_DRAWHANGMAN_H