mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Use a formula for chain membership bonus
Passed both short TC: LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 5087 W: 1072 L: 951 D: 3064 And long TC: LLR: 2.95 (-2.94,2.94) [0.00,6.00] Total: 28620 W: 5042 L: 4798 D: 18780 bench: 7995098
This commit is contained in:
parent
3cc47edf62
commit
e8f9447b11
3 changed files with 20 additions and 10 deletions
|
@ -37,6 +37,7 @@ int main(int argc, char* argv[]) {
|
|||
Position::init();
|
||||
Bitbases::init_kpk();
|
||||
Search::init();
|
||||
Pawns::init();
|
||||
Eval::init();
|
||||
Threads.init();
|
||||
TT.set_size(Options["Hash"]);
|
||||
|
|
|
@ -51,16 +51,8 @@ namespace {
|
|||
{ S(20, 28), S(29, 31), S(33, 31), S(33, 31),
|
||||
S(33, 31), S(33, 31), S(29, 31), S(20, 28) }};
|
||||
|
||||
// Pawn chain membership bonus by file
|
||||
const Score ChainMember[FILE_NB][RANK_NB] = {
|
||||
{ S(0, 0), S(14, 0), S(16, 4), S(18, 9), S(28, 28), S(52, 104), S(118, 236) },
|
||||
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(30, 30), S(54, 108), S(120, 240) },
|
||||
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(30, 30), S(54, 108), S(120, 240) },
|
||||
{ S(0, 0), S(17, 0), S(19, 6), S(22, 11), S(33, 33), S(59, 118), S(127, 254) },
|
||||
{ S(0, 0), S(17, 0), S(19, 6), S(22, 11), S(33, 33), S(59, 118), S(127, 254) },
|
||||
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(30, 30), S(54, 108), S(120, 240) },
|
||||
{ S(0, 0), S(16, 0), S(18, 5), S(20, 10), S(30, 30), S(54, 108), S(120, 240) },
|
||||
{ S(0, 0), S(14, 0), S(16, 4), S(18, 9), S(28, 28), S(52, 104), S(118, 236) }};
|
||||
// Pawn chain membership bonus by file and rank (initialized by formula)
|
||||
Score ChainMember[FILE_NB][RANK_NB];
|
||||
|
||||
// Candidate passed pawn bonus by rank
|
||||
const Score CandidatePassed[RANK_NB] = {
|
||||
|
@ -199,6 +191,22 @@ namespace {
|
|||
|
||||
namespace Pawns {
|
||||
|
||||
/// init() initializes some tables by formula instead of hard-code their values
|
||||
|
||||
void init() {
|
||||
|
||||
const int chainByFile[8] = { 1, 3, 3, 4, 4, 3, 3, 1 };
|
||||
int bonus;
|
||||
|
||||
for (Rank r = RANK_1; r < RANK_8; ++r)
|
||||
for (File f = FILE_A; f <= FILE_H; ++f)
|
||||
{
|
||||
bonus = r * (r-1) * (r-2) + chainByFile[f] * (r/2 + 1);
|
||||
ChainMember[f][r] = make_score(bonus, bonus);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// probe() takes a position object as input, computes a Entry object, and returns
|
||||
/// a pointer to it. The result is also stored in a hash table, so we don't have
|
||||
/// to recompute everything when the same pawn structure occurs again.
|
||||
|
|
|
@ -73,6 +73,7 @@ struct Entry {
|
|||
|
||||
typedef HashTable<Entry, 16384> Table;
|
||||
|
||||
void init();
|
||||
Entry* probe(const Position& pos, Table& entries);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue