mancava srand

This commit is contained in:
Lorenzo Bianchi 2023-06-17 12:46:59 +02:00
parent 4fe93002e3
commit 32c578afd0
2 changed files with 11 additions and 8 deletions

View File

@ -9,6 +9,7 @@
#include <sys/shm.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <custom_sem.h>
#include <structures.h>
@ -22,7 +23,7 @@ void checkClientinput(int argc, char *argv[]);
int generateMove();
int main(int argc, char *argv[]){
srand(time(0));
printf("Il mio pid per killarmi: %d\n", getpid()); //TMP
setupClient(argc, argv);

View File

@ -155,13 +155,15 @@ void sigHandlerClient(int sig) {
game_end_t winner;
rcvGame_end(&winner);
printBoard();
if (winner.winner == ID) {
printf(PSERVER "YOU WIN!!!\n");
} else if (winner.winner == -1) {
printf(PSERVER "DRAW!!!\n");
} else {
printf(PSERVER "YOU LOSE!!!\n");
if (!clientBot) {
printBoard();
if (winner.winner == ID) {
printf(PSERVER "YOU WIN!!!\n");
} else if (winner.winner == -1) {
printf(PSERVER "DRAW!!!\n");
} else {
printf(PSERVER "YOU LOSE!!!\n");
}
}
// avviso server che ho ricevuto il messaggio