insert move

This commit is contained in:
Edi De Candido 2023-05-18 12:07:19 +02:00
parent 9ecee70798
commit 964575d46d
2 changed files with 9 additions and 4 deletions

View File

@ -14,7 +14,6 @@ void warningMsg(char *msg) {
}
void errExitMsg(char *msg) {
fprintf(stderr, "\033[91m<Error>\033[39m\n");
perror(msg);
fprintf(stderr, "\033[91m<Error>\033[39m %s\n", msg);
exit(1);
}

View File

@ -135,6 +135,12 @@ int checkMove(tile_t *board, int collums) {
return pos;
}
void insertCoin() {
void insertMove(tile_t *board, int pos, int turn) {
if (board[pos] != EMPTY) {
char buf[100];
sprintf(buf, "The position %d indicated isn't empty", pos);
errExitMsg(buf);
}
board[pos] = (turn == 0) ? PLAYER1 : PLAYER2;
}