Bert,
Yes, at the moment it is still plain alpha-beta, no refinements yet, I still have to add a null-window search, history, killers etc.
Full evaluation is not full yet, it is very basic, but it is indeed material + the 20 structures Fabien uses, I use this because I want to compare apples to apples, it is coded entirely different though. The tables are a lot larger because there are holes in the index function, fortunately this doesn't seem to hurt speed by much.
The evaluation runs in ~100ns., of course it only needs to be called when the position is quiet.
When my search is ready and before I start with automatic learning I will probably switch to different structures more in line with what is known about Draughts theory.
Code: Select all
int ep_8bi[8][65536];
int ep_9bi[2][262144];
inline int v8i(int n, bb_t mb, bb_t mw, bb_t pf, bb_t pr)
{
return ep_8bi[n][(PEXT(mw, pf) << 8) + PEXT(mb, pf)] - ep_8bi[n][(r_8b[PEXT(mb, pr)] << 8) + r_8b[PEXT(mw, pr)]];
}
inline int v9i(int n, bb_t mb, bb_t mw, bb_t pf, bb_t pr)
{
return ep_9bi[n][(PEXT(mw, pf) << 9) + PEXT(mb, pf)] - ep_9bi[n][(r_9b[PEXT(mb, pr)] << 9) + r_9b[PEXT(mw, pr)]];
}
int evaluate(position_t *pos)
{
const bb_t mb = pos->men(Black);
const bb_t mw = pos->men(White);
int value[2];
*value =
+ 100 * POPCOUNT(mb)
- 100 * POPCOUNT(mw)
+ 300 * POPCOUNT(pos->kings(Black))
- 300 * POPCOUNT(pos->kings(White));
// 8 bit patterns
*value += v8i(0, mb, mw, 0x0000000000031863ULL, 0x0031863000000000ULL);
*value += v8i(1, mb, mw, 0x00000000000630c6ULL, 0x0018c31800000000ULL);
*value += v8i(2, mb, mw, 0x00000000000c618cULL, 0x000c618c00000000ULL);
*value += v8i(3, mb, mw, 0x000000000018c318ULL, 0x000630c600000000ULL);
*value += v8i(4, mb, mw, 0x0000000018c31800ULL, 0x00000630c6000000ULL);
*value += v8i(5, mb, mw, 0x0000000031863000ULL, 0x0000031863000000ULL);
*value += v8i(6, mb, mw, 0x00000000630c6000ULL, 0x0000018c31800000ULL);
*value += v8i(7, mb, mw, 0x00000000c618c000ULL, 0x000000c618c00000ULL);
// 9 bit patterns
*value += v9i(0, mb, mw, 0x0000000018430861ULL, 0x0021843086000000ULL);
*value += v9i(1, mb, mw, 0x000000008610c218ULL, 0x000610c218400000ULL);
value[White] = -value[Black];
return value[pos->own()];
}