update dumbeval weights
This commit is contained in:
parent
8822af81e6
commit
28b82e8228
|
@ -4,54 +4,49 @@ static PyObject* DumbevalError;
|
||||||
|
|
||||||
static float x[122];
|
static float x[122];
|
||||||
|
|
||||||
|
|
||||||
|
/* With apologies to Gerry Tesauro */
|
||||||
|
|
||||||
|
/* Weights generated by weights.py */
|
||||||
static const float wc[122] = {
|
static const float wc[122] = {
|
||||||
5.6477, 6.316649999999999, 7.05515, 6.65315, 9.3171, 17.9777, 2.0235499999999993, 5.1129500000000005, 7.599200000000001, 9.68525, 3.1762, 8.05335, 16.153499999999998, 8.02445, 10.55345, 15.489600000000001, 10.525199999999998, 16.438850000000002, 12.27405, 9.6362, 12.7152, 13.2859, 1.6932499999999995, 26.79045, 10.521899999999999, 6.79635, 5.28135, 6.2059, 10.2306, 10.5485, 3.6000500000000004, 4.07825, 6.951700000000001, 4.413749999999999, 11.271450000000002, 12.9361, 11.087299999999999, 13.10085, 10.411999999999999, 8.084050000000001, 12.4893, 5.96055, 4.69195, 18.9482, 9.0946, 9.1954, 6.2592, 16.180300000000003, 8.3376, 23.24915, 14.32525, -2.6699000000000006, 19.156, 5.81445, 4.7214, 7.63055, 7.039, 5.88075, 2.00765, 14.596800000000002, 11.5208, -3.79, -3.8541000000000003, 5.358499999999999, 14.4516, 2.49015, 11.284799999999999, 14.1066, 16.2306, 5.82875, 9.34505, 16.13685, 8.1893, 2.93145, 7.83185, 12.86765, 6.90115, 20.07255, 8.93355, -0.12434999999999974, 12.0587, 11.83985, 6.34155, 7.1963, 10.571200000000001, 22.38365, 6.50745, 8.94595, 12.0434, 10.79885, 14.055800000000001, 0.022100000000000453, 10.39255, 4.088850000000001, 3.6421499999999996, 38.1298, 6.8957, 0.9804999999999997, 5.9599, 13.16055, 11.55305, 10.65015, 4.6673, 15.770999999999999, 27.700050000000005, 4.4329, 12.6349, 7.037800000000001, 3.4897, 18.91945, 10.239899999999999, 5.4625, 10.29705, 10.492799999999999, 8.850900000000001, -10.575999999999999, 10.6893, 15.30845, 17.8083, 31.88275, 11.225000000000001, 4.4806};
|
-1.91222, 1.45979, 0.40657, -1.39159, 3.64558, -0.45381, -0.03157,
|
||||||
|
0.14539, 0.80232, 0.87558, 2.36202, -2.01887, -0.88918, 2.65871,
|
||||||
|
-1.31587, 1.07476, 0.30491, -1.32892, 0.38018, -0.30714, -1.16178,
|
||||||
/*
|
0.71481, -1.01334, -0.44373, 0.51255, -0.17171, -0.88886, 0.02071,
|
||||||
1.5790816238841092, 1.6374860177130541, -1.7131823639980923, -0.9286186784962336, -1.0732080528763888,
|
-0.53279, -0.22139, -1.02436, 0.17948, 0.95697, 0.49272, 0.31848,
|
||||||
-0.33851674519289876, 1.5798155080270462, 2.3161915581553414, 1.5625330782392322, 0.9397141260075461,
|
-0.58293, 0.14484, 0.22063, 1.0336 , -1.90554, 1.10291, -2.05589,
|
||||||
0.8386342522957442, 1.2380864901133144, -2.803703105809909, -1.6033863837759044, -1.9297462408169208,
|
-0.16964, -0.82442, 1.27217, -1.24968, -0.90372, 0.05546, 0.2535 ,
|
||||||
2.804924084193149, 0.9270839975087402, 0.9877927467766145, -1.0075116465703597, -0.9456578829797895,
|
-0.03533, -0.31773, 0.43704, 0.21699, 0.10519, 2.12775, -0.48196,
|
||||||
-2.592017567014881, 0.6309857231907587, 2.04590249003744, -0.7982917574924828, -1.4539868823698936,
|
-0.08445, -0.13156, -0.68362, 0.64765, 0.32537, 0.79493, 1.94577,
|
||||||
1.0841407450630234, 0.45211788236898887, -1.2713606178159307, 0.8688872440724307, -0.6732738151904405,
|
-0.63827, 0.97057, -0.46039, 1.51801, -0.62955, -0.43632, 0.25876,
|
||||||
2.2362742485632294, -0.6581729637609781, -1.7948051663967473, 2.1883788452643564, 2.1598171424723214,
|
-0.46623, -0.46963, 1.3532 , -0.07362, -1.53211, 0.69676, -0.92407,
|
||||||
0.40802272166662146, -0.9708789129385202, -0.28407011999124165, 1.132858480655588, 0.35009713673111253,
|
0.07153, 0.67173, 0.27661, -0.51579, -0.49019, 1.06603, -0.97673,
|
||||||
2.396877030228498, -2.9621397724422653, 1.607067798976531, 1.0644990486021744, 0.31954763526104113,
|
-1.21231, -1.54966, -0.07795, 0.32697, 0.02873, 1.38703, 0.41725,
|
||||||
1.3044736141405133, -2.7454899725805606, -2.7379143210889545, -1.803990720175892, 0.46979843403681576,
|
0.78326, -0.7257 , 0.54165, 1.38882, 0.27304, 1.0739 , 0.74654,
|
||||||
-1.7142750941084806, -0.8151527229519924, -2.009462889335147, -0.3918389579023729, -1.2877598286852634,
|
1.35561, 1.18697, 1.09146, 0.17552, -0.30773, 0.27812, -1.674 ,
|
||||||
2.555703689627613, 0.9185193346378826, -2.4440956502956404, -1.5557875467629176, 1.6171292628313898,
|
-0.31073, -0.40745, 0.51546, -1.10875, 2.0081 , -1.27931, -1.16321,
|
||||||
-0.7350519162308693, 2.9185129503030653, -0.02369662637182124, 0.9957404325370858, -0.6504711593915609,
|
0.95652, 0.7487 , -0.2347 , 0.20324, -0.41417, 0.05929, 0.72632,
|
||||||
2.6190546093943468, -0.36103491516117003, -0.5988376927918715, 0.16399156134136383, 0.3254074568551131,
|
-1.15223, 1.2745 , -0.15947 };
|
||||||
-1.5638349190057885, 0.8561543642997189, -0.0880209333042492, 1.323918411026094, -0.9498883976797834,
|
|
||||||
2.3050169940592458, -2.859322940360703, 2.1798224505428836, 0.03769734441005257, 2.806706515762855,
|
|
||||||
-0.514728418369482, -2.7130236727731454, 1.343193402901159, -1.542350700154035, 1.1197565339573625,
|
|
||||||
-1.4498511795864624, 1.3472224178544003, 0.7044576479382245, -2.284211306571646, -1.7289596273930532,
|
|
||||||
-1.7276292685923906, -0.1945401442950634, 2.0338744133468643, 2.001064062247366, 1.9649901287717713,
|
|
||||||
1.5235253273336475, 0.40016636047698606, -1.3276206938801058, 0.8496121993449899, 1.054662320349336,
|
|
||||||
-1.1897996492934584, 0.49610727347392025, -1.8539475848522708, 0.4713599305742626, -2.8424352653158573,
|
|
||||||
-2.526691049928613, 2.1369664337786274, 1.0616438676464632, 1.9487914860665452, 2.822108017102477,
|
|
||||||
-0.3393405083020449, 2.787144781914554, -2.401723402781605, -1.1675562811241997, -1.1542961327714207,
|
|
||||||
0.18253192955355502, -2.418436664206371, 0.7423935287565309, 2.9903418274144666, -1.3503112004693552,
|
|
||||||
-2.649146174480099, -0.5447080156947952
|
|
||||||
};*/
|
|
||||||
|
|
||||||
static const float wr[122] = {
|
static const float wr[122] = {
|
||||||
-0.7856, -0.50352, 0.12392, -1.00316, -2.46556, -0.1627, 0.18966, 0.0043, 0.0,
|
0.13119, -0.13164, -1.2736 , 1.06352, -1.34749, -1.03086, -0.27417,
|
||||||
0.13681, 1.11245, 0.0, 0.0, -0.02781, -2.77982, 0.0, -0.91035, 0.60015,
|
-0.27762, 0.79454, -1.12623, 2.1134 , -0.7003 , 0.26056, -1.13518,
|
||||||
-1.27266, 0.0, 0.0, 0.0, 0.0, -7.26713, -0.19412, -1.05121, 0.27448, -4.94251,
|
-1.64548, -1.30828, -0.96589, -0.36258, -1.14323, -0.2006 , -1.00307,
|
||||||
-0.06844, 0.37183, -3.66465, -0.8305, 0.09266, 0.07217, 0.0, 0.29906, -1.26062,
|
0.57739, -0.62693, 0.29721, -0.36996, -0.17462, 0.96704, 0.08902,
|
||||||
0.17405, 0.48302, 2.00366, 0.92321, -0.10839, 1.06349, 0.39521, 3.4204,
|
1.4337 , -0.47107, 0.82156, 0.14988, 1.74034, 1.13313, -0.32083,
|
||||||
0.00576, 5.35, 3.8539, -0.09308, 0.17253, 0.13978, 0.2701, -0.52728, 0.88296,
|
-0.00048, -0.86622, 1.12808, 0.99875, 0.8049 , -0.16841, -0.42677,
|
||||||
0.2252, 0.0, 0.0, -0.12707, 3.05454, 0.31202, -0.88035, -0.01351, 0.0,
|
-1.9409 , -0.53565, -0.83708, 0.69603, 0.32079, 0.56942, 0.67965,
|
||||||
-3.40177, -0.22082, -0.13022, -0.09795, -2.29847, -12.32252, 0.0, -0.13597,
|
1.49328, -1.65885, 0.96284, 0.63196, -0.27504, 0.39174, 0.71225,
|
||||||
0.12039, 0.85631, 0.0, 0.0, -0.3424, 0.24855, 0.20178, 2.30052, 1.5068,
|
-0.3614 , 0.88761, 1.12882, 0.77764, 1.02618, -0.20245, -0.39245,
|
||||||
0.0, -0.07456, 5.16874, 0.01418, -1.3464, -1.29506, 0.0, 0.0, -1.40375,
|
-1.56799, 1.04888, -1.20858, -0.24361, -1.85157, -0.16912, 0.50512,
|
||||||
0.0, -0.11696, 0.05281, -9.67677, 0.05685, -1.09167, 0.0, 0.0, -2.56906,
|
-2.93122, 0.70477, -0.93066, 1.74867, 0.23963, -0.00699, -1.27183,
|
||||||
2.19605, 0.0, 0.68178, -0.08471, 0.0, -2.34631, 1.49549, -2.16183, 0.0,
|
-0.30604, 1.71039, 0.82202, -1.36734, -1.08352, -1.25054, 0.49436,
|
||||||
1.16242, 1.08744, -0.1716, 0.25236, 0.13246, -0.37646, 0.0, -2.87401,
|
-1.5037 , -0.73143, 0.74189, 0.32365, 0.30539, -0.72169, 0.41088,
|
||||||
0.74427, 1.07274, -0.01591, -0.14818, -0.06285, 0.08302, -1.03508
|
-1.56632, -0.63526, 0.58779, -0.05653, 0.76713, -1.40898, -0.33683,
|
||||||
};
|
1.86802, 0.59773, 1.28668, -0.65817, 2.46829, -0.09331, 2.9034 ,
|
||||||
|
1.04809, 0.73222, -0.44372, 0.53044, -1.9274 , -1.57183, -1.14068,
|
||||||
|
1.26036, -0.9296 , 0.06662, -0.26572, -0.30862, 0.72915, 0.98977,
|
||||||
|
0.63513, -1.43917, -0.12523 };
|
||||||
|
|
||||||
void setx(int pos[])
|
void setx(int pos[])
|
||||||
{
|
{
|
||||||
|
@ -179,7 +174,7 @@ static PyMethodDef dumbeval_methods[] = {
|
||||||
static struct PyModuleDef dumbeval_definition = {
|
static struct PyModuleDef dumbeval_definition = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"dumbeval",
|
"dumbeval",
|
||||||
"A Python module that implements Gerald Tesauro's dumbeval function for evaluation backgammon positions.",
|
"A Python module that implements Gerald Tesauro's pubeval function for evaluation backgammon positions with badly initialized weights.",
|
||||||
-1,
|
-1,
|
||||||
dumbeval_methods
|
dumbeval_methods
|
||||||
};
|
};
|
||||||
|
|
14
dumbeval/weights.py
Normal file
14
dumbeval/weights.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
import numpy as np
|
||||||
|
import re
|
||||||
|
|
||||||
|
re.DOTALL = True
|
||||||
|
|
||||||
|
np.set_printoptions(precision=5, suppress=True, threshold=np.nan)
|
||||||
|
def random_array_string():
|
||||||
|
return re.sub(r'^\[(.*)\]$(?s)', r'{\n\1 };', np.array2string(np.random.normal(0,1,122), separator=', '))
|
||||||
|
|
||||||
|
print("/* Weights generated by weights.py */")
|
||||||
|
print("static const float wc[122] =", random_array_string())
|
||||||
|
print()
|
||||||
|
print("static const float wr[122] =", random_array_string())
|
Loading…
Reference in New Issue
Block a user