src/strategies/minimax.c
// Returns a mark indicating wether the board is in our favor.
Returns a mark indicating wether the board is in our favor.
Returns a mark indicating wether the board is in our favor .
int board_value(struct strat_board *b, int p) {
    if (b->players[p].l == ((p == 0) ? 0 : (N - 1))) {
        if (p == get_current_player(&b->board)) {
            return 200;
        } else {
            return -200;
        }
    } else {
        int path_value = shortest_path(b, (p + 1) % 2) - shortest_path(b, p);
        if (p == get_current_player(&b->board))
            return path_value;
        else
            return -path_value;
    }
}
int board_value ( struct strat_board * b , int p ) { if ( b -> players [ p ] . l == ( ( p == 0 ) ? 0 : ( N - 1 ) ) ) { if ( p == get_current_player ( & b -> board ) ) { return 200 ; } else { return -200 ; } } else { int path_value = shortest_path ( b , ( p + 1 ) % 2 ) - shortest_path ( b , p ) ; if ( p == get_current_player ( & b -> board ) ) return path_value ; else return - path_value ; } }
Returns a mark indicating wether the board is in our favor.
Returns a mark indicating wether the board is in our favor .