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
a8a03539
Commit
a8a03539
authored
8 years ago
by
Bariatti Francesco
Browse files
Options
Downloads
Patches
Plain Diff
Added settings file for mcts
parent
2aeb9047
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
AI/src/mcts/MCTS_SETTINGS.hpp
+8
-0
8 additions, 0 deletions
AI/src/mcts/MCTS_SETTINGS.hpp
AI/src/mcts/allocator.hpp
+2
-1
2 additions, 1 deletion
AI/src/mcts/allocator.hpp
AI/src/mcts/test_mcts_two_players.hpp
+7
-6
7 additions, 6 deletions
AI/src/mcts/test_mcts_two_players.hpp
with
17 additions
and
7 deletions
AI/src/mcts/MCTS_SETTINGS.hpp
0 → 100644
+
8
−
0
View file @
a8a03539
#ifndef __MCTS_SETTINGS_HPP__
#define __MCTS_SETTINGS_HPP__
// Allocated memory for the mcts. If not enough the program may crash
#define MCTS_ALLOCATOR_SIZE 1000000U
// Reflection time for every turn of the mcts (in ms)
#define MCTS_TURN_TIME 5000
#endif
This diff is collapsed.
Click to expand it.
AI/src/mcts/allocator.hpp
+
2
−
1
View file @
a8a03539
...
...
@@ -2,6 +2,7 @@
#define __ALLOCATOR_HPP__
#include
"node.hpp"
#include
"MCTS_SETTINGS.hpp"
namespace
mcts
{
...
...
@@ -15,7 +16,7 @@ namespace mcts
void
copy
(
node
*
n1
,
node
*
n2
,
unsigned
int
prunning
=
0
);
public:
allocator
(
unsigned
int
size
=
40000000U
);
allocator
(
unsigned
int
size
=
MCTS_ALLOCATOR_SIZE
);
~
allocator
();
node
*
allocate
(
unsigned
int
size
);
void
clear
();
...
...
This diff is collapsed.
Click to expand it.
AI/src/mcts/test_mcts_two_players.hpp
+
7
−
6
View file @
a8a03539
...
...
@@ -3,6 +3,7 @@
#include
"openings.hpp"
#include
"mcts_two_players.hpp"
#include
"MCTS_SETTINGS.hpp"
#include
<string>
#include
<iostream>
#include
<map>
...
...
@@ -21,10 +22,10 @@ namespace mcts
void
self_play
(
Game
g
);
void
self_play
(
Game
g
,
int
n
,
bool
with_openings
=
false
);
void
self_play_learn_openings
(
Game
g
,
int
n
);
void
test_openings
(
Game
g
,
int
nb_learning
,
int
nb_testing
);
void
test_openings
(
Game
g
,
int
nb_learning
,
int
nb_testing
);
int
select_move
(
Game
&
game
);
public:
test_mcts_two_players
(
const
Game
&
g
);
test_mcts_two_players
(
const
Game
&
g
);
};
template
<
typename
Game
>
...
...
@@ -69,7 +70,7 @@ namespace mcts
void
test_mcts_two_players
<
Game
>::
play
(
Game
g
)
{
// ProfilerStart("theturk.prof");
auto
the_turk
=
make_mcts_two_players
(
g
,
5000
,
0.4
,
8
);
auto
the_turk
=
make_mcts_two_players
(
g
,
MCTS_TURN_TIME
,
0.4
,
8
);
std
::
cout
<<
"play one game"
<<
std
::
endl
;
std
::
cout
<<
"who's first? (h)uman/(c)omputer "
;
std
::
string
ans
;
...
...
@@ -155,7 +156,7 @@ namespace mcts
g
.
set_state
(
state
);
openings_
.
update
(
g
,
moves
,
v
);
g
.
set_state
(
state
);
for
(
std
::
uint16_t
m
:
moves
)
for
(
std
::
uint16_t
m
:
moves
)
{
g
.
play
(
m
);
v
=
-
v
;
...
...
@@ -174,10 +175,10 @@ namespace mcts
}
std
::
cout
<<
"number of learning examples: "
<<
learning_examples
.
size
()
<<
std
::
endl
;
std
::
ofstream
output
(
"learning_examples.txt"
);
for
(
const
auto
&
example
:
learning_examples
)
for
(
const
auto
&
example
:
learning_examples
)
{
output
<<
example
.
second
.
second
;
for
(
int
index
:
example
.
first
)
for
(
int
index
:
example
.
first
)
{
output
<<
" "
<<
index
<<
":"
<<
1
;
}
...
...
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