int read_a_move(int socket) {
    int move = -1;
    while (move < 1 || move > 3) {
        char line[MAX_BUF];
        int num_chars = read(socket, line, MAX_BUF - 1);
        line[num_chars] = '\0';
        while (strstr(line, "\r\n") == NULL) {
            num_chars += read(socket, &line[num_chars], MAX_BUF - num_chars);
            line[num_chars] = '\0';
        }
        line[num_chars - 2] = '\0';
        move = strtol(line, NULL, 10);
        if (move < 1 || move > 3) {
            char *msg = "Your move is not allowed. Please enter a move between 1-
                3.\r\n ";
                write(socket, msg, strlen(msg));
        }
    }
    return move;
}