Skip to content
Snippets Groups Projects
Commit 781d5847 authored by Salard Xavier's avatar Salard Xavier
Browse files

Cleaning of the general heuristic

parent 321e7bb3
No related branches found
No related tags found
No related merge requests found
......@@ -29,31 +29,15 @@ namespace mcts
float get_value(const game::penguin& game, uint8_t move) const
{
float X_free_move=0.35, X_num_dir=0.15, X_points=0.2, X_zone=0.3;
//float A_free_move=0.1*10, A_num_dir=0.1*10, A_points=0.05*10, A_zone=0.15*10;
//uint64_t obstacles = game.create_obstacles_bitboard();
game::penguin g = *(game::copy(game));
auto old_state = g.get_state();
g.play(move);
auto played_state = g.get_state();
/*
uint64_t obstacles = (~(played_state.one_fish | played_state.two_fish | played_state.three_fish));
for(int i = 0; i < 4; i++){
obstacles |= ((uint64_t) 1) << PENGUIN_POS(played_state.peng_red[i]);
obstacles |= ((uint64_t) 1) << PENGUIN_POS(played_state.peng_blue[i]);
}
*/
uint32_t* penguins = played_state.current_player_red ? played_state.peng_red : played_state.peng_blue;
uint32_t* other_peng = played_state.current_player_red ? played_state.peng_blue : played_state.peng_red;
/*
int nbr_turns = 0; // It count also the penguins so in this implementation it start at 10
for (int i =0; i<60; i++){
if((obstacles >> i) & 1) nbr_turns++;
}
*/
//Movement Freedom Heuristic
//uint32_t* penguins_r = played_state.peng_red;
//uint32_t* penguins_b = played_state.peng_blue;
float nb_moves_us = 0;
float nb_moves_other = 0;
......@@ -129,12 +113,12 @@ namespace mcts
obstacles |= ((uint64_t) 1) << PENGUIN_POS(old_state.peng_red[i]);
obstacles |= ((uint64_t) 1) << PENGUIN_POS(old_state.peng_blue[i]);
}
int nbr_turns = 0;
int nbr_obstacles = 0;
// It count also the penguins so in this implementation it start at 8 + 1 for each move done
for (int i =0; i<60; i++){
if((obstacles >> i) & 1) nbr_turns++;
if((obstacles >> i) & 1) nbr_obstacles++;
}
return (1000/nbr_turns);
return ((int)ceil(500.0/nbr_obstacles));
}
private:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment