mirror of
https://github.com/sockspls/badfish
synced 2025-07-11 19:49:14 +00:00
Sync with master
This commit is contained in:
commit
7aeef7285f
6 changed files with 26 additions and 41 deletions
29
src/Makefile
29
src/Makefile
|
@ -231,18 +231,19 @@ ifneq ($(comp),mingw)
|
|||
endif
|
||||
endif
|
||||
|
||||
### 3.4 Debugging
|
||||
### 3.2 Debugging
|
||||
ifeq ($(debug),no)
|
||||
CXXFLAGS += -DNDEBUG
|
||||
else
|
||||
CXXFLAGS += -g
|
||||
endif
|
||||
|
||||
### 3.5 Optimization
|
||||
### 3.3 Optimization
|
||||
ifeq ($(optimize),yes)
|
||||
|
||||
CXXFLAGS += -O3
|
||||
|
||||
ifeq ($(comp),gcc)
|
||||
CXXFLAGS += -O3
|
||||
|
||||
ifeq ($(UNAME),Darwin)
|
||||
ifeq ($(arch),i386)
|
||||
|
@ -258,21 +259,13 @@ ifeq ($(optimize),yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(comp),mingw)
|
||||
CXXFLAGS += -O3
|
||||
endif
|
||||
|
||||
ifeq ($(comp),icc)
|
||||
ifeq ($(UNAME),Darwin)
|
||||
CXXFLAGS += -fast -mdynamic-no-pic
|
||||
else
|
||||
CXXFLAGS += -fast
|
||||
CXXFLAGS += -mdynamic-no-pic
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(comp),clang)
|
||||
CXXFLAGS += -O3
|
||||
|
||||
ifeq ($(UNAME),Darwin)
|
||||
ifeq ($(pext),no)
|
||||
CXXFLAGS += -flto
|
||||
|
@ -288,12 +281,12 @@ ifeq ($(optimize),yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
### 3.6. Bits
|
||||
### 3.4 Bits
|
||||
ifeq ($(bits),64)
|
||||
CXXFLAGS += -DIS_64BIT
|
||||
endif
|
||||
|
||||
### 3.7 prefetch
|
||||
### 3.5 prefetch
|
||||
ifeq ($(prefetch),yes)
|
||||
ifeq ($(sse),yes)
|
||||
CXXFLAGS += -msse
|
||||
|
@ -303,7 +296,7 @@ else
|
|||
CXXFLAGS += -DNO_PREFETCH
|
||||
endif
|
||||
|
||||
### 3.9 popcnt
|
||||
### 3.6 popcnt
|
||||
ifeq ($(popcnt),yes)
|
||||
ifeq ($(comp),icc)
|
||||
CXXFLAGS += -msse3 -DUSE_POPCNT
|
||||
|
@ -312,7 +305,7 @@ ifeq ($(popcnt),yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
### 3.10 pext
|
||||
### 3.7 pext
|
||||
ifeq ($(pext),yes)
|
||||
CXXFLAGS += -DUSE_PEXT
|
||||
ifeq ($(comp),$(filter $(comp),gcc clang mingw))
|
||||
|
@ -320,7 +313,7 @@ ifeq ($(pext),yes)
|
|||
endif
|
||||
endif
|
||||
|
||||
### 3.11 Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows.
|
||||
### 3.8 Link Time Optimization, it works since gcc 4.5 but not on mingw under Windows.
|
||||
### This is a mix of compile and link time options because the lto link phase
|
||||
### needs access to the optimization flags.
|
||||
ifeq ($(comp),gcc)
|
||||
|
@ -343,7 +336,7 @@ ifeq ($(comp),mingw)
|
|||
endif
|
||||
endif
|
||||
|
||||
### 3.12 Android 5 can only run position independent executables. Note that this
|
||||
### 3.9 Android 5 can only run position independent executables. Note that this
|
||||
### breaks Android 4.0 and earlier.
|
||||
ifeq ($(arch),armv7)
|
||||
CXXFLAGS += -fPIE
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace {
|
|||
{
|
||||
ei.kingRing[Them] = b | shift_bb<Down>(b);
|
||||
b &= ei.attackedBy[Us][PAWN];
|
||||
ei.kingAttackersCount[Us] = b ? popcount(b) : 0;
|
||||
ei.kingAttackersCount[Us] = popcount(b);
|
||||
ei.kingAdjacentZoneAttacksCount[Us] = ei.kingAttackersWeight[Us] = 0;
|
||||
}
|
||||
else
|
||||
|
@ -276,9 +276,7 @@ namespace {
|
|||
{
|
||||
ei.kingAttackersCount[Us]++;
|
||||
ei.kingAttackersWeight[Us] += KingAttackWeights[Pt];
|
||||
bb = b & ei.attackedBy[Them][KING];
|
||||
if (bb)
|
||||
ei.kingAdjacentZoneAttacksCount[Us] += popcount(bb);
|
||||
ei.kingAdjacentZoneAttacksCount[Us] += popcount(b & ei.attackedBy[Them][KING]);
|
||||
}
|
||||
|
||||
if (Pt == QUEEN)
|
||||
|
@ -331,11 +329,7 @@ namespace {
|
|||
{
|
||||
// Bonus for aligning with enemy pawns on the same rank/file
|
||||
if (relative_rank(Us, s) >= RANK_5)
|
||||
{
|
||||
Bitboard alignedPawns = pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s];
|
||||
if (alignedPawns)
|
||||
score += RookOnPawn * popcount(alignedPawns);
|
||||
}
|
||||
score += RookOnPawn * popcount(pos.pieces(Them, PAWN) & PseudoAttacks[ROOK][s]);
|
||||
|
||||
// Bonus when on an open or semi-open file
|
||||
if (ei.pi->semiopen_file(Us, file_of(s)))
|
||||
|
@ -417,8 +411,7 @@ namespace {
|
|||
| ei.attackedBy[Them][BISHOP] | ei.attackedBy[Them][ROOK]
|
||||
| ei.attackedBy[Them][KING];
|
||||
|
||||
if (b)
|
||||
attackUnits += QueenContactCheck * popcount(b);
|
||||
attackUnits += QueenContactCheck * popcount(b);
|
||||
}
|
||||
|
||||
// Analyse the enemy's safe distance checks for sliders and knights
|
||||
|
@ -514,9 +507,7 @@ namespace {
|
|||
while (b)
|
||||
score += Threat[Rook ][type_of(pos.piece_on(pop_lsb(&b)))];
|
||||
|
||||
b = weak & ~ei.attackedBy[Them][ALL_PIECES];
|
||||
if (b)
|
||||
score += Hanging * popcount(b);
|
||||
score += Hanging * popcount(weak & ~ei.attackedBy[Them][ALL_PIECES]);
|
||||
|
||||
b = weak & ei.attackedBy[Us][KING];
|
||||
if (b)
|
||||
|
@ -535,8 +526,7 @@ namespace {
|
|||
& pos.pieces(Them)
|
||||
& ~ei.attackedBy[Us][PAWN];
|
||||
|
||||
if (b)
|
||||
score += ThreatByPawnPush * popcount(b);
|
||||
score += ThreatByPawnPush * popcount(b);
|
||||
|
||||
if (DoTrace)
|
||||
Trace::add(THREAT, Us, score);
|
||||
|
|
|
@ -239,7 +239,7 @@ namespace {
|
|||
&& !(PseudoAttacks[Pt][from] & target & ci->checkSquares[Pt]))
|
||||
continue;
|
||||
|
||||
if (ci->dcCandidates && (ci->dcCandidates & from))
|
||||
if (ci->dcCandidates & from)
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -523,8 +523,7 @@ bool Position::legal(Move m, Bitboard pinned) const {
|
|||
|
||||
// A non-king move is legal if and only if it is not pinned or it
|
||||
// is moving along the ray towards or away from the king.
|
||||
return !pinned
|
||||
|| !(pinned & from)
|
||||
return !(pinned & from)
|
||||
|| aligned(from, to_sq(m), square<KING>(us));
|
||||
}
|
||||
|
||||
|
@ -617,8 +616,7 @@ bool Position::gives_check(Move m, const CheckInfo& ci) const {
|
|||
return true;
|
||||
|
||||
// Is there a discovered check?
|
||||
if ( ci.dcCandidates
|
||||
&& (ci.dcCandidates & from)
|
||||
if ( (ci.dcCandidates & from)
|
||||
&& !aligned(from, to, ci.ksq))
|
||||
return true;
|
||||
|
||||
|
|
|
@ -1007,13 +1007,18 @@ moves_loop: // When in check search starts from here
|
|||
Value hValue = thisThread->history[pos.piece_on(to_sq(move))][to_sq(move)];
|
||||
Value cmhValue = cmh[pos.piece_on(to_sq(move))][to_sq(move)];
|
||||
|
||||
const CounterMoveStats* fm = (ss - 2)->counterMoves;
|
||||
const CounterMoveStats* fm2 = (ss - 4)->counterMoves;
|
||||
Value fmValue = (fm ? (*fm)[pos.piece_on(to_sq(move))][to_sq(move)] : VALUE_ZERO);
|
||||
Value fm2Value = (fm2 ? (*fm2)[pos.piece_on(to_sq(move))][to_sq(move)] : VALUE_ZERO);
|
||||
|
||||
// Increase reduction for cut nodes and moves with a bad history
|
||||
if ( (!PvNode && cutNode)
|
||||
|| (hValue < VALUE_ZERO && cmhValue <= VALUE_ZERO))
|
||||
r += ONE_PLY;
|
||||
|
||||
// Decrease/increase reduction for moves with a good/bad history
|
||||
int rHist = (hValue + cmhValue) / 14980;
|
||||
int rHist = (hValue + cmhValue + fmValue + fm2Value) / 20000;
|
||||
r = std::max(DEPTH_ZERO, r - rHist * ONE_PLY);
|
||||
|
||||
// Decrease reduction for moves that escape a capture. Filter out
|
||||
|
|
|
@ -2159,7 +2159,6 @@ static int has_repeated(StateInfo *st)
|
|||
bool Tablebases::root_probe(Position& pos, Search::RootMoves& rootMoves, Value& score)
|
||||
{
|
||||
int success;
|
||||
|
||||
int dtz = probe_dtz(pos, &success);
|
||||
|
||||
if (!success)
|
||||
|
|
Loading…
Add table
Reference in a new issue