From 705f20406ca6fa001744da7802c72d12669f6dc8 Mon Sep 17 00:00:00 2001 From: Saba Fazlali Date: Mon, 29 Jan 2024 18:52:24 +0100 Subject: [PATCH] Draw Hangman in ASCII art --- CMakeLists.txt | 4 +- .../codemodel-v2-c6ffc0b664e1b12e7dfc.json | 60 ------- .../reply/index-2024-01-24T18-53-34-0975.json | 108 ------------ ...notebinder-Debug-439d4177ec694957d283.json | 159 ------------------ cmake-build-debug/.ninja_deps | Bin 11160 -> 10288 bytes cmake-build-debug/.ninja_log | 9 +- .../CMakeFiles/clion-Debug-log.txt | 8 +- .../Testing/Temporary/LastTest.log | 4 +- cmake-build-debug/build.ninja | 9 +- cmake-build-debug/pmuw_projekt_notebinder | Bin 34520 -> 0 bytes src/main/c/Hangman/drawHangman.c | 84 +++++++++ src/main/c/Hangman/drawHangman.h | 8 + 12 files changed, 110 insertions(+), 343 deletions(-) delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/codemodel-v2-c6ffc0b664e1b12e7dfc.json delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/index-2024-01-24T18-53-34-0975.json delete mode 100644 cmake-build-debug/.cmake/api/v1/reply/target-pmuw_projekt_notebinder-Debug-439d4177ec694957d283.json delete mode 100755 cmake-build-debug/pmuw_projekt_notebinder create mode 100644 src/main/c/Hangman/drawHangman.c create mode 100644 src/main/c/Hangman/drawHangman.h 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 6c9cd667e0ac75eb9e3472fe5dfca889d2226340..5e1fdca1799d8b8b7eb21c0b7194a018e361620e 100644 GIT binary patch delta 808 zcmaiyOH30{6o&6X3R5XzN*}yREh185GD#P1Of=vIl9telrYP2NoRW654A_>K7!xsZ z;f6#w8y6;mg7_-7f^Sjrjf#T!T)61g9ea{`X21w57jx#^f6l%Cch21N!L;98>rxf< zh!pPZNvzLjj5Q3Hw-t3siYmxLH)A<0F7ak2lf`(*?k$KZhlS`*l=53~sf2?cxL6Rx z13U-cDQm|mz7W1?UyTVRqDnC#`jzxnjG1}(f~WJmI8?#moSB0K%vAiV`i!1Z5$18A zv;*c)s&2vU7CU^xfJKCln6Vs%S**53-~(p4cKl^6g7+9G3}S=L1n)EkW3LhxlR}iu zXfA_!`M6{=8Q$h{IX_BJk7=jNsHj>2V{b5IZ-dvEv5W8u&1E9I#A6g+;5^0W=qVRr z8V4vo!^LtLp00rN@Pwd)Ftu!9zb6yv>Wrw)A&8yzCt#bJjGcXT&@H4l?C2pJ~y5j&h5+}5*` zPR@{7)tB3rrd2brK5C6E{odl)6-t!>2I|nTnUs3W){Ws=mk(~Cr)GbiJWj6;NMV0X z8{8xk8E)tYU)adOb!xa{u$F^sG^3WnxS~dc=v8gh#qor4Vwsk)F`TZI;R^j|pDC#o zCG^3L(m6hy*<^tcy$N?6UvZh>dI-)>C_6$nWB<8SS%C80YXC1A+eq6(&tB}>y218$ z$3$wuIhq~+{|-Fk+Gz>LrQ^+#8tIZ&?k>ATz54hyI%C6{=w2<-tr#NC5ytvL#4vkm L+4UghqQ?0LK&KmW delta 1037 zcmZ`&OH30{6n)oFY;{^%G88H_`QAB0{I=bU5r`dxEh)^l3q-t)5?6XTQ-@D)^L+Z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m9?u>?T{K~&1%A7w;xxp$BU9(f)o?DlCK>tbWpZ@x4OaJt< zvh|raUYR;|^=~gW>znIdeDsBLL)Nda4$swJo}V8J9Uf{}K5_oU!_&Y0`BVE&-u~Q2 z^*{FbSI(BUUe + +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