Skip to content

Commit aed1fc9

Browse files
AlexisOlsonmooskagh
authored andcommitted
Centipawn conversion (#860)
* Non-tangent Centipawn Conversion This conversion formula should be a better match near the asymptotes. * Added coefficient to the denominator This coefficient makes the max score top out near +128 (12826 cp, more precisely). This also fixes the divide-by-zero problem at x = +/- 1. * Exponent tweak and coefficient precision The coefficient 0.976953125 = 1 - 295/12800.
1 parent 90625aa commit aed1fc9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mcts/search.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ void Search::SendUciInfo() REQUIRES(nodes_mutex_) {
126126
uci_infos.emplace_back(common_info);
127127
auto& uci_info = uci_infos.back();
128128
if (score_type == "centipawn") {
129-
uci_info.score = 111.714640912 * tan(1.5620688421 * edge.GetQ(default_q));
129+
uci_info.score = 295 * edge.GetQ(default_q) /
130+
(1 - 0.976953125 * std::pow(edge.GetQ(default_q), 14));
130131
} else if (score_type == "centipawn_2018") {
131132
uci_info.score = 290.680623072 * tan(1.548090806 * edge.GetQ(default_q));
132133
} else if (score_type == "win_percentage") {

0 commit comments

Comments
 (0)