diff --git a/.vscode/settings.json b/.vscode/settings.json index 18aa7c8..83b3762 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,7 @@ { "files.associations": { "errexit.h": "c", - "structures.h": "c" + "structures.h": "c", + "custom_msgq.h": "c" } } \ No newline at end of file diff --git a/Makefile b/Makefile index 1ca8818..e0f1deb 100644 --- a/Makefile +++ b/Makefile @@ -69,17 +69,15 @@ MKFILE_DIR := $(dir $(mkfile_path)) ARGSSERVER := 6 7 O X ARGSCLIENT1 := Test1 ARGSCLIENT2 := Test2 -OPEN_NEW_TERMINAL := x-terminal-emulator TERMINAL_ARGS1 := --geometry=90x30 -e TERMINAL_ARGS2 := --geometry=10x30 -e -# OPEN_NEW_TERMINAL := kitty +# OPEN_NEW_TERMINAL := x-terminal-emulator +OPEN_NEW_TERMINAL := kitty -test: comp run - -run: - @ ipcrm --all=sem - @ ipcrm --all=msg - @ ipcrm --all=shm +test: comp + ipcrm --all=sem + ipcrm --all=msg + ipcrm --all=shm $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS1) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT1) $(OPEN_NEW_TERMINAL) $(TERMINAL_ARGS2) $(MKFILE_DIR) $(TARGET2) $(ARGSCLIENT2) ./$(TARGET1) $(ARGSSERVER) diff --git a/src/F4Client.c b/src/F4Client.c index d92ca3b..ad4d317 100644 --- a/src/F4Client.c +++ b/src/F4Client.c @@ -100,14 +100,10 @@ int main(int argc, char *argv[]){ } int generateMove() { - int cont = 0; - int arr[_COLLUMS]; - for (int i=0; i<_COLLUMS; i++) { - if (checkMove(i)) { - arr[cont] = i; - cont++; - } - } - - return arr[rand()%cont]; + int collums; + do { + collums = rand() % _COLLUMS; + } while (_BOARD[collums] != 0); + + return collums; } \ No newline at end of file diff --git a/src/F4Server.c b/src/F4Server.c index eabc7da..9a68471 100644 --- a/src/F4Server.c +++ b/src/F4Server.c @@ -108,6 +108,7 @@ int main(int argc, char *argv[]) { } else { printf(PSERVER "%s won\n", name[result]); } + printf("winner %d\n", result); end_game(result);