Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pingouins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Felton Samuel
pingouins
Commits
781d5847
Commit
781d5847
authored
7 years ago
by
Salard Xavier
Browse files
Options
Downloads
Patches
Plain Diff
Cleaning of the general heuristic
parent
321e7bb3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AI/src/heuristics/generalization_heuristic.hpp
+4
-20
4 additions, 20 deletions
AI/src/heuristics/generalization_heuristic.hpp
with
4 additions
and
20 deletions
AI/src/heuristics/generalization_heuristic.hpp
+
4
−
20
View file @
781d5847
...
...
@@ -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_
turn
s
=
0
;
int
nbr_
obstacle
s
=
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_
turn
s
++
;
if
((
obstacles
>>
i
)
&
1
)
nbr_
obstacle
s
++
;
}
return
(
1
000
/
nbr_
turns
);
return
(
(
int
)
ceil
(
5
00
.
0
/
nbr_
obstacles
)
);
}
private
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment