Browse Source

running error fixed

remotes/origin/Saba
Saba Fazlali 11 months ago
parent
commit
0ff75961c6
  1. 6
      CMakeLists.txt
  2. BIN
      cmake-build-debug/.ninja_deps
  3. 35
      cmake-build-debug/.ninja_log
  4. 4
      cmake-build-debug/Testing/Temporary/LastTest.log
  5. 30
      cmake-build-debug/build.ninja
  6. 19
      src/main/c/Hangman/Test/test_playHangman.c
  7. 7
      src/main/c/Hangman/currentState.c
  8. 5
      src/main/c/Hangman/currentState.h
  9. 6
      src/main/c/Hangman/drawHangman.c
  10. 5
      src/main/c/Hangman/initializeHangman.c
  11. 23
      src/main/c/Hangman/playHangman.h
  12. 7
      src/main/c/Hangman/rules.c
  13. 4
      src/main/c/Hangman/rules.h
  14. 5
      src/main/c/main.c
  15. 3
      src/main/c/main.h

6
CMakeLists.txt

@ -15,14 +15,8 @@ add_executable(pmuw_projekt_notebinder
src/main/c/main.h
src/main/c/Hangman/drawHangman.c
src/main/c/Hangman/drawHangman.h
src/main/c/Hangman/rules.c
src/main/c/Hangman/rules.h
src/main/c/Hangman/initializeHangman.c
src/main/c/Hangman/initializeHangman.h
src/main/c/Hangman/currentState.c
src/main/c/Hangman/currentState.h
src/main/c/Hangman/playHangman.c
src/main/c/Hangman/playHangman.h
src/main/c/Hangman/Test/test_drawHangman.c
src/main/c/Hangman/Test/test_drawHangman.h
)

BIN
cmake-build-debug/.ninja_deps

35
cmake-build-debug/.ninja_log

@ -1,13 +1,26 @@
# ninja log v5
0 40 1706867178156302406 build.ninja f2183aada2fc9ffc
1 214 1706706276607374928 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.c.o cdaff7b94c55641c
0 213 1706706276607336012 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421
1 214 1706706276607365429 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97
1 43 1706797998872539655 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o de5f7edc6c2379d7
1 44 1706122039878920765 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Template/game100.c.o 69a5bcd8c57a43b3
1 38 1706122217155672196 CMakeFiles/pmuw_projekt_notebinder.dir/test/Hangman/word_selector_test.c.o e932f546d59a9d76
106 195 1706551302079685763 pmuw_projekt_notebinder fbb48fd3bf0b96c1
0 32 1707224707015552741 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_playHangman.c.o c78eb198389ea64b
2 48 1707224297294010118 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_drawHangman.c.o b4d90a6b54ad1664
1 40 1707224901227175471 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
1 38 1706122372717341436 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o f1dbf76e6b4bc97d
2 56 1706797998885305995 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
1 115 1706866005935735539 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.c.o c4eef1ff589ab182
1 114 1706866005935734705 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_drawHangman.c.o b4d90a6b54ad1664
1 33 1707224901218890256 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.c.o c4eef1ff589ab182
106 195 1706551302079685763 pmuw_projekt_notebinder fbb48fd3bf0b96c1
1 38 1706122217155672196 CMakeFiles/pmuw_projekt_notebinder.dir/test/Hangman/word_selector_test.c.o e932f546d59a9d76
1 44 1706122039878920765 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Template/game100.c.o 69a5bcd8c57a43b3
1 38 1707224901221200228 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o de5f7edc6c2379d7
1 214 1706706276607365429 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97
0 213 1706706276607336012 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/word_selector.c.o fab41de4b8cc0421
2 47 1707224297291255019 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.c.o cdaff7b94c55641c
0 42 1707224957969670299 build.ninja f2183aada2fc9ffc
0 34 1707224957969670299 build.ninja f2183aada2fc9ffc
1 29 1707224958003312078 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o 7d64de4520ec9e97
1 34 1707224958007844146 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
0 32 1707225145761047265 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
1 31 1707225193573982892 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
0 34 1707225362817701877 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
0 45 1707225516452726019 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
1 32 1707225552742056223 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o f2e2af7048638ee6
32 62 1707225552772258606 pmuw_projekt_notebinder a5668107eb06d295
0 32 1707225688396107422 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o f1dbf76e6b4bc97d
0 28 1707225694194160949 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/main.c.o f1dbf76e6b4bc97d
28 61 1707225694227136765 pmuw_projekt_notebinder a5668107eb06d295

4
cmake-build-debug/Testing/Temporary/LastTest.log

@ -1,3 +1,3 @@
Start testing: Feb 06 11:59 CET
Start testing: Feb 06 14:23 CET
----------------------------------------------------------
End testing: Feb 06 11:59 CET
End testing: Feb 06 14:23 CET

30
cmake-build-debug/build.ninja

@ -70,13 +70,6 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o:
OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir
OBJECT_FILE_DIR = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/rules.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.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
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/initializeHangman.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o.d
FLAGS = -g -std=gnu11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fcolor-diagnostics
@ -84,13 +77,6 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangma
OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir
OBJECT_FILE_DIR = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/currentState.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.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
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/playHangman.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o.d
FLAGS = -g -std=gnu11 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk -fcolor-diagnostics
@ -98,20 +84,6 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o:
OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir
OBJECT_FILE_DIR = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_drawHangman.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/Test/test_drawHangman.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_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/Test
build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_currentState.c.o: C_COMPILER__pmuw_projekt_notebinder_unscanned_Debug /Users/saba/CLionProjects/pmuw_projekt_notebinder/src/main/c/Hangman/Test/test_currentState.c || cmake_object_order_depends_target_pmuw_projekt_notebinder
DEP_FILE = CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_currentState.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/Test
# =============================================================================
# Link build statements for EXECUTABLE target pmuw_projekt_notebinder
@ -120,7 +92,7 @@ build CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_curren
#############################################
# 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 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/drawHangman.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/rules.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/currentState.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_drawHangman.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/Test/test_currentState.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 CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/initializeHangman.c.o CMakeFiles/pmuw_projekt_notebinder.dir/src/main/c/Hangman/playHangman.c.o
FLAGS = -g -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk
OBJECT_DIR = CMakeFiles/pmuw_projekt_notebinder.dir
POST_BUILD = :

19
src/main/c/Hangman/Test/test_playHangman.c

@ -0,0 +1,19 @@
#include "playHangman.c"
#include <string.h>
#include <stdio.h>
// Custom assert function to compare expected and actual values
void assert_equal(const char *test_name, const char *expected, const char *actual) {
if (strcmp(expected, actual) == 0) {
printf("[PASS] %s\n", test_name);
} else {
printf("[FAIL] %s - Expected: \"%s\", Actual: \"%s\"\n", test_name, expected, actual);
}
}
// Test function for playHangman()
void test_playHangman() {
char wordToGuess[] = "test";
//playHangman(wordToGuess);
}

7
src/main/c/Hangman/currentState.c

@ -1,7 +0,0 @@
#include "currentState.h"
void currentState(char *currentGuess, int mistakes) {
printf("Current Word: %s \n", currentGuess);
printf("Mistakes Made: %d/6 \n", mistakes);
drawHangman(mistakes);
}

5
src/main/c/Hangman/currentState.h

@ -1,5 +0,0 @@
#ifndef PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H
#define PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H
#include <stdio.h>
#include "drawHangman.c"
#endif //PMUW_PROJEKT_NOTEBINDER_CURRENTSTATE_H

6
src/main/c/Hangman/drawHangman.c

@ -83,4 +83,10 @@ void drawHangman(int incorrectGuesses) {
" \n"
" \n");
}
}
void currentState(char *currentGuess, int mistakes) {
printf("Current Word: %s \n", currentGuess);
printf("Mistakes Made: %d/6 \n", mistakes);
drawHangman(mistakes);
}

5
src/main/c/Hangman/initializeHangman.c

@ -10,4 +10,9 @@ void initializeHangman(char *wordToGuess, char *currentGuess) {
}
}
currentGuess[wordLength] = '\0';
}
void printRules(){
printf("Rules: \n");
printf(" - You are allowed a maximum of 6 mistakes.\n");
}

23
src/main/c/Hangman/playHangman.h

@ -1,10 +1,21 @@
#ifndef PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H
#define PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H
#include <stdio.h>
// Include declarations from corresponding header files
#include "initializeHangman.h"
#include "drawHangman.h"
#include "word_selector.h"
// Include function implementations directly from .c files
void initializeHangman(char *wordToGuess, char *currentGuess);
void printRules();
void drawHangman(int incorrectGuesses);
void currentState(char *currentGuess, int mistakes);
const char* selectRandomWord();
const char wordsList[NUM_WORDS][MAX_WORD_LENGTH + 1];
#define MAX_MISTAKES 6
#include "initializeHangman.c"
#include "rules.c"
#include "currentState.c"
#include "drawHangman.c"
#include "word_selector.c"
#endif //PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H
#endif // PMUW_PROJEKT_NOTEBINDER_PLAYHANGMAN_H

7
src/main/c/Hangman/rules.c

@ -1,7 +0,0 @@
#include "rules.h"
void printRules(){
printf("Rules: \n");
printf(" - You are allowed a maximum of 6 mistakes.\n");
printf(" - All alphabet are in lower case.\n");
}

4
src/main/c/Hangman/rules.h

@ -1,4 +0,0 @@
#ifndef PMUW_PROJEKT_NOTEBINDER_RULES_H
#define PMUW_PROJEKT_NOTEBINDER_RULES_H
#include <stdio.h>
#endif //PMUW_PROJEKT_NOTEBINDER_RULES_H

5
src/main/c/main.c

@ -2,7 +2,10 @@
#include <stdlib.h>
#include <stdbool.h>
//#include "Template/game100.h"
#include "Hangman/playHangman.h"
#include "Hangman/word_selector.h"
#include "Hangman/drawHangman.h"
#include "Hangman/initializeHangman.h"
int main(){
bool running = true;

3
src/main/c/main.h

@ -1,7 +1,6 @@
#ifndef MAIN_H
#define MAIN_H
#include "playHangman.h"
#include "playHangman.c"
int main();
#endif // MAIN_H
Loading…
Cancel
Save