Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tarot
tarot
Commits
54d49710
Commit
54d49710
authored
Nov 28, 2019
by
Vivien Kraus
Browse files
Also use the perceptron for the initial bid instead of the stacking predictor
parent
979d9a0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/libtarot/features/tarot/features_private_impl.h
View file @
54d49710
...
...
@@ -2034,14 +2034,14 @@ strategy_play_points (const TarotGame * game,
}
static
double
features_strongest_player_try_bid
(
const
Tarot
Predictor
*
predictor
)
features_strongest_player_try_bid
(
const
Tarot
Game
*
game
)
{
double
scores
[
4
];
TarotGameEvent
candidates
[
4
];
TarotGameEvent
*
pointers
[
4
];
size_t
i
;
size_t
n
;
double
max
=
-
DBL_MAX
;
TarotPerceptron
*
perceptron
=
tarot_perceptron_static_default
();
for
(
i
=
0
;
i
<
4
;
i
++
)
{
candidates
[
i
].
t
=
TAROT_BID_EVENT
;
...
...
@@ -2051,8 +2051,10 @@ features_strongest_player_try_bid (const TarotPredictor * predictor)
candidates
[
1
].
u
.
bid
=
TAROT_PUSH
;
candidates
[
2
].
u
.
bid
=
TAROT_STRAIGHT_KEEP
;
candidates
[
3
].
u
.
bid
=
TAROT_DOUBLE_KEEP
;
n
=
predictor_eval
(
predictor
,
4
,
pointers
,
0
,
4
,
scores
);
assert
(
n
==
4
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
scores
[
i
]
=
tarot_perceptron_predict
(
perceptron
,
game
,
pointers
[
i
]);
}
for
(
i
=
0
;
i
<
4
;
i
++
)
{
if
(
scores
[
i
]
>
max
)
...
...
@@ -2060,6 +2062,7 @@ features_strongest_player_try_bid (const TarotPredictor * predictor)
max
=
scores
[
i
];
}
}
tarot_perceptron_free
(
perceptron
);
return
max
;
}
...
...
@@ -2073,8 +2076,6 @@ features_strongest_player_aux (size_t n_players,
TarotGameEvent
deal_all
;
TarotPlayer
my_owners
[
78
];
size_t
i
;
TarotPredictor
predictor
;
size_t
unused
;
assert
(
n_cards
==
78
);
for
(
i
=
0
;
i
<
78
;
i
++
)
{
...
...
@@ -2096,15 +2097,7 @@ features_strongest_player_aux (size_t n_players,
/* Petit sec */
return
-
DBL_MAX
;
}
if
(
predictor_construct
(
sizeof
(
TarotPredictor
),
(
char
*
)
&
predictor
,
&
unused
)
!=
sizeof
(
TarotPredictor
))
{
assert
(
0
);
}
(
void
)
unused
;
predictor_set_game
(
&
predictor
,
&
game
);
return
features_strongest_player_try_bid
(
&
predictor
);
return
features_strongest_player_try_bid
(
&
game
);
}
static
int
predictor_perceptron_select_call
(
const
TarotGame
*
game
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment