mirror of
https://github.com/sockspls/badfish
synced 2025-07-12 03:59:15 +00:00
Logaritmic futility margins
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
b599da01fa
commit
c52da3b806
3 changed files with 41 additions and 2 deletions
|
@ -366,6 +366,29 @@ Square pop_1st_bit(Bitboard* bb) {
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int bitScanReverse32(uint32_t b)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
|
||||||
|
if (b > 0xFFFF) {
|
||||||
|
b >>= 16;
|
||||||
|
result += 16;
|
||||||
|
}
|
||||||
|
if (b > 0xFF) {
|
||||||
|
b >>= 8;
|
||||||
|
result += 8;
|
||||||
|
}
|
||||||
|
if (b > 0xF) {
|
||||||
|
b >>= 4;
|
||||||
|
result += 4;
|
||||||
|
}
|
||||||
|
if (b > 0x3) {
|
||||||
|
b >>= 2;
|
||||||
|
result += 2;
|
||||||
|
}
|
||||||
|
return result + (b > 0) + (b > 1);
|
||||||
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// All functions below are used to precompute various bitboards during
|
// All functions below are used to precompute various bitboards during
|
||||||
|
|
|
@ -349,6 +349,7 @@ extern Square pop_1st_bit(Bitboard* b);
|
||||||
|
|
||||||
extern void print_bitboard(Bitboard b);
|
extern void print_bitboard(Bitboard b);
|
||||||
extern void init_bitboards();
|
extern void init_bitboards();
|
||||||
|
extern int bitScanReverse32(uint32_t b);
|
||||||
|
|
||||||
|
|
||||||
#endif // !defined(BITBOARD_H_INCLUDED)
|
#endif // !defined(BITBOARD_H_INCLUDED)
|
||||||
|
|
|
@ -1417,10 +1417,25 @@ namespace {
|
||||||
{
|
{
|
||||||
//std::cout << std::endl;
|
//std::cout << std::endl;
|
||||||
//for (int d = 2; d < 14; d++)
|
//for (int d = 2; d < 14; d++)
|
||||||
// std::cout << d << ", " << 300 + 2*(1 << (3*d/4)) << std::endl;
|
// std::cout << d << ", " << 64*(1+bitScanReverse32(d*d)) << std::endl;
|
||||||
|
|
||||||
//std::cout << std::endl;
|
//std::cout << std::endl;
|
||||||
/*
|
/*
|
||||||
|
64*(1+bitScanReverse32(d*d))
|
||||||
|
|
||||||
|
2 -> 256 - 256
|
||||||
|
3 -> 288 - 320
|
||||||
|
4 -> 512 - 384
|
||||||
|
5 -> 544 - 384
|
||||||
|
6 -> 592 - 448
|
||||||
|
7 -> 624 - 448
|
||||||
|
8 -> 672 - 512
|
||||||
|
9 -> 704 - 512
|
||||||
|
10 -> 832 - 512
|
||||||
|
11 -> 864 - 512
|
||||||
|
12 -> 928 - 576
|
||||||
|
13 -> 960 - 576
|
||||||
|
|
||||||
300 + 2*(1 << (3*d/4))
|
300 + 2*(1 << (3*d/4))
|
||||||
|
|
||||||
2 -> 256 - 304
|
2 -> 256 - 304
|
||||||
|
@ -1458,7 +1473,7 @@ namespace {
|
||||||
{
|
{
|
||||||
if (futilityValue == VALUE_NONE)
|
if (futilityValue == VALUE_NONE)
|
||||||
futilityValue = evaluate(pos, ei, threadID)
|
futilityValue = evaluate(pos, ei, threadID)
|
||||||
+ (300 + 2 * (1 << (3 * int(depth) /4)))
|
+ 64*(1+bitScanReverse32(int(depth) * int(depth)))
|
||||||
+ 4*IncrementalFutilityMargin;
|
+ 4*IncrementalFutilityMargin;
|
||||||
|
|
||||||
futilityValueScaled = futilityValue - moveCount * IncrementalFutilityMargin;
|
futilityValueScaled = futilityValue - moveCount * IncrementalFutilityMargin;
|
||||||
|
|
Loading…
Add table
Reference in a new issue