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
9ceaa2ef
Commit
9ceaa2ef
authored
8 years ago
by
Felton Samuel
Browse files
Options
Downloads
Patches
Plain Diff
number of direction freedom possible fix ????
parent
0e9b9ede
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AI.conf
+1
-6
1 addition, 6 deletions
AI.conf
AI/src/heuristics/number_direction_freedom_heuristic.cpp
+11
-51
11 additions, 51 deletions
AI/src/heuristics/number_direction_freedom_heuristic.cpp
AI/src/mcts/test_mcts_two_players.hpp
+1
-1
1 addition, 1 deletion
AI/src/mcts/test_mcts_two_players.hpp
with
13 additions
and
58 deletions
AI.conf
+
1
−
6
View file @
9ceaa2ef
ai_vs_ai
=
1
ai_think_time
=
5000
<<<<<<<
HEAD
ai_vs_ai_game_count
=
100
heuristic_ai_1
=
movement_freedom
=======
ai_vs_ai_game_count
=
10
heuristic_ai_1
=
points
>>>>>>>
26387090
f3eb3945d1382de1d372737abf83c5d0
heuristic_ai_1
=
direction_freedom
heuristic_ai_2
=
default
send_game_to_gui
=
1
This diff is collapsed.
Click to expand it.
AI/src/heuristics/number_direction_freedom_heuristic.cpp
+
11
−
51
View file @
9ceaa2ef
...
...
@@ -25,62 +25,22 @@ namespace mcts
played
->
play
(
move
);
game
::
penguin_state
after_state
=
played
->
get_state
();
uint32_t
*
penguins_r
;
uint32_t
*
penguins_b
;
/*if(before_state.current_player_red){ //If the player is red
penguins = before_state.peng_red;
}else{ //if the player is blue
penguins = before_state.peng_blue;
}
//For each penguins, count the number of direction it can move
int8_t number_of_direction_before = 0;
for(int8_t i=0; i< 4; i++) {
number_of_direction_before+= number_of_direction_penguin(penguins[i]);
}*/
/*if(!after_state.current_player_red){ //If the player was red
penguins = after_state.peng_red;
}else{ //if the player was blue
penguins = after_state.peng_blue;
}
uint8_t number_of_direction_after = 0;
for(uint8_t i=0; i< 4; i++) {
number_of_direction_after+= number_of_direction_penguin(penguins[i]);
}
//std::cout << "number of direction : " << "("+std::to_string(number_of_direction_after)+" : "
// + std::to_string((number_of_direction_after - 12.0)/12.0)+")" <<std::endl;
// Return a float between -1.0 and 1.0 related to the change of the number of direction in which you can play before and after the move
return (-(number_of_direction_after - 12.0)/12.0);*/
//return (-(number_of_direction_after - number_of_direction_before)/12.0);
int8_t
number_of_direction_after
=
0
;
penguins_r
=
after_state
.
peng_red
;
penguins_b
=
after_state
.
peng_blue
;
for
(
uint8_t
i
=
0
;
i
<
4
;
i
++
)
{
number_of_direction_after
+=
number_of_direction_penguin
(
penguins_r
[
i
])
-
number_of_direction_penguin
(
penguins_b
[
i
]);
}
if
(
!
after_state
.
current_player_red
){
//If the player was red
}
else
{
//if the player was blue
number_of_direction_after
=
-
number_of_direction_after
;
}
//std::cout << "("+std::to_string(number_of_direction_after)+")" <<std::endl;
return
(
-
(
float
)
number_of_direction_after
/
24.0
);
uint32_t
*
tab_peng
=
after_state
.
peng_red
;
uint8_t
nb
=
0
;
if
(
!
after_state
.
current_player_red
)
{
tab_peng
=
after_state
.
peng_blue
;
}
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
nb
+=
number_of_direction_penguin
(
tab_peng
[
i
]);
}
return
-
((
float
)
nb
/
12.0
);
}
int
number_direction_freedom_heuristic
::
get_count
(
const
game
::
penguin
&
game
,
uint8_t
move
)
const
{
return
100
;
return
100
00000
;
}
}
This diff is collapsed.
Click to expand it.
AI/src/mcts/test_mcts_two_players.hpp
+
1
−
1
View file @
9ceaa2ef
...
...
@@ -206,7 +206,7 @@ void test_mcts_two_players<Game>::self_play(Game g, const heuristic<Game>& h1, c
game
::
config
&
c
=
game
::
config
::
get_config
();
auto
state
=
g
.
get_state
();
auto
the_turk_v1
=
make_mcts_two_players
(
g
,
c
.
get_think_time
(),
1.0
,
4
,
h1
);
auto
the_turk_v1
=
make_mcts_two_players
(
g
,
c
.
get_think_time
(),
0.6
,
2
,
h1
);
auto
the_turk_v2
=
make_mcts_two_players
(
g
,
c
.
get_think_time
(),
0.6
,
2
,
h2
);
std
::
string
result_directory
(
get_test_results_directory
());
int
nb_win_v1
=
0
,
nb_win_v2
=
0
,
nb_draw
=
0
;
...
...
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