Skip to content

Commit

Permalink
7.0
Browse files Browse the repository at this point in the history
-A little improvement in mcts
 (thanks to original Jorg Oster ideq developed after by
 Stefano Cardanobile)
-Improvement (at least 30 elo) in playing strength and hard positions solving, in particular
 * lmr search
 * king's and pawns evaluation
  • Loading branch information
amchess committed Feb 28, 2019
1 parent b9fa461 commit 2f23572
Show file tree
Hide file tree
Showing 10 changed files with 259 additions and 63 deletions.
15 changes: 15 additions & 0 deletions src/All/endgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,21 @@ Value Endgame<KQKR>::operator()(const Position& pos) const {
}


/// KNN vs KP. Simply push the opposing king to the corner.
template<>
Value Endgame<KNNKP>::operator()(const Position& pos) const {

assert(verify_material(pos, strongSide, 2 * KnightValueMg, 0));
assert(verify_material(pos, weakSide, VALUE_ZERO, 1));

Value result = 2 * KnightValueEg
- PawnValueEg
+ PushToEdges[pos.square<KING>(weakSide)];

return strongSide == pos.side_to_move() ? result : -result;
}


/// Some cases of trivial draws
template<> Value Endgame<KNNK>::operator()(const Position&) const { return VALUE_DRAW; }

Expand Down
2 changes: 2 additions & 0 deletions src/All/endgame.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum EndgameCode {

EVALUATION_FUNCTIONS,
KNNK, // KNN vs K
KNNKP, // KNN vs KP
KXK, // Generic "mate lone king" eval
KBNK, // KBN vs K
KPK, // KP vs K
Expand Down Expand Up @@ -125,6 +126,7 @@ class Endgames {
add<KRKN>("KRKN");
add<KQKP>("KQKP");
add<KQKR>("KQKR");
add<KNNKP>("KNNKP");

add<KNPK>("KNPK");
add<KNPKB>("KNPKB");
Expand Down
14 changes: 12 additions & 2 deletions src/All/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ namespace {
constexpr Score PawnlessFlank = S( 17, 95);
constexpr Score RestrictedPiece = S( 7, 7);
constexpr Score RookOnPawn = S( 10, 32);
constexpr Score SafeKingWithPawns = S( 5, 30); //nokdpawn2 patch
constexpr Score SliderOnQueen = S( 59, 18);
constexpr Score ThreatByKing = S( 24, 89);
constexpr Score ThreatByPawnPush = S( 48, 39);
Expand Down Expand Up @@ -499,6 +500,9 @@ namespace {
b2 = b1 & attackedBy2[Them];

int kingFlankAttacks = popcount(b1) + popcount(b2);
//nokdpawn2 and piece_reserve patches begin
bool shashinQuiescentCapablancaMaxScore=pos.this_thread()->shashinQuiescentCapablancaMaxScore;
int pieceReserveKingDangerCorrection=shashinQuiescentCapablancaMaxScore ? 0:pos.count<ALL_PIECES>(Them) - 30;

kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
+ 69 * kingAttacksCount[Them]
Expand All @@ -509,13 +513,19 @@ namespace {
- 6 * mg_value(score) / 8
+ mg_value(mobility[Them] - mobility[Us])
+ 5 * kingFlankAttacks * kingFlankAttacks / 16
- 25;
- 25
+pieceReserveKingDangerCorrection;//piece_reserve patch

// Transform the kingDanger units into a Score, and subtract it from the evaluation
int kingSafe = pos.this_thread()->shashinKingSafe;//Shashin very good tactical patch
if (kingDanger > 0)
score -= make_score(kingDanger * kingSafe * kingDanger / 4096, kingDanger / 16);

//nokdpawn2 patch begin
else
if ((pos.count<PAWN>(Us) > pos.count<PAWN>(Them)) && !shashinQuiescentCapablancaMaxScore)
score += SafeKingWithPawns;
//nokdpawn2 patch end
//nokdpawn2 and piece_reserve patches end
// Penalty when our king is on a pawnless flank
if (!(pos.pieces(PAWN) & KingFlank[file_of(ksq)]))
score -= PawnlessFlank;
Expand Down
18 changes: 9 additions & 9 deletions src/All/makeAll.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ ren C:\MinGW\mingw64-730-pse mingw64
make clean
mingw32-make profile-build ARCH=x86-64 COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-x86-64.exe"
ren shashchess.exe "ShashChess 7.0-x86-64.exe"
make clean
mingw32-make profile-build ARCH=x86-64-modern COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-x86-64-modern.exe"
ren shashchess.exe "ShashChess 7.0-x86-64-modern.exe"
make clean
mingw32-make profile-build ARCH=x86-64-bmi2 COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-x86-64-bmi2.exe"
ren shashchess.exe "ShashChess 7.0-x86-64-bmi2.exe"
mingw32-make build ARCH=ppc-64 COMP=mingw
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-ppc-64.exe"
ren shashchess.exe "ShashChess 7.0-ppc-64.exe"
make clean
mingw32-make profile-build ARCH=general-64 COMP=mingw CXX=x86_64-w64-mingw32-g++ -j14
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-general-64.exe"
ren shashchess.exe "ShashChess 7.0-general-64.exe"
make clean
ren C:\MinGW\mingw64 mingw64-730-pse
ren C:\MinGW\mingw32-730-pd mingw32
mingw32-make build ARCH=ppc-32 COMP=mingw
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-ppc-32.exe"
ren shashchess.exe "ShashChess 7.0-ppc-32.exe"
make clean
mingw32-make -f MakeFile profile-build ARCH=general-32 COMP=mingw
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-general-32.exe"
ren shashchess.exe "ShashChess 7.0-general-32.exe"
make clean
mingw32-make -f MakeFile profile-build ARCH=x86-32 COMP=mingw
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-x86-32.exe"
ren shashchess.exe "ShashChess 7.0-x86-32.exe"
make clean
mingw32-make -f MakeFile profile-build ARCH=x86-32-old COMP=mingw
strip shashchess.exe
ren shashchess.exe "ShashChess 6.2.4-x86-32-old.exe"
ren shashchess.exe "ShashChess 7.0-x86-32-old.exe"
make clean
ren C:\MinGW\mingw32 mingw32-730-pd
pause
18 changes: 9 additions & 9 deletions src/All/makeAll.sh
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
make build ARCH=x86-64 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-x86-64'
mv 'shashchess' 'ShashChess 7.0-x86-64'
make clean

make build ARCH=x86-64-modern COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-x86-64-modern'
mv 'shashchess' 'ShashChess 7.0-x86-64-modern'
make clean

make build ARCH=x86-64-bmi2 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-x86-64-bmi2'
mv 'shashchess' 'ShashChess 7.0-x86-64-bmi2'
make clean

make build ARCH=x86-32 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-x86-32'
mv 'shashchess' 'ShashChess 7.0-x86-32'
make clean

make build ARCH=x86-32-old COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-x86-32-old'
mv 'shashchess' 'ShashChess 7.0-x86-32-old'
make clean

make build ARCH=ppc-64 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-ppc-64'
mv 'shashchess' 'ShashChess 7.0-ppc-64'
make clean

make build ARCH=ppc-32 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-ppc-32'
mv 'shashchess' 'ShashChess 7.0-ppc-32'
make clean

make build ARCH=general-64 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-general-64'
mv 'shashchess' 'ShashChess 7.0-general-64'
make clean

make build ARCH=general-32 COMPCC=gcc-7.3.0
strip shashchess
mv 'shashchess' 'ShashChess 6.2.4-general-32'
mv 'shashchess' 'ShashChess 7.0-general-32'
make clean
2 changes: 1 addition & 1 deletion src/All/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace {

/// Version number. If Version is left empty, then compile date in the format
/// DD-MM-YY and show in engine_info.
const string Version = "6.2.4";
const string Version = "7.0";

/// Our fancy logging facility. The trick here is to replace cin.rdbuf() and
/// cout.rdbuf() with two Tie objects that tie cin and cout to a file stream. We
Expand Down
7 changes: 5 additions & 2 deletions src/All/pawns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,12 @@ Entry* probe(const Position& pos) {
e->key = key;
e->scores[WHITE] = evaluate<WHITE>(pos, e);
e->scores[BLACK] = evaluate<BLACK>(pos, e);
//patch sac3 begin
int asymmetryCorrection=pos.this_thread()->shashinValue==SHASHIN_POSITION_CAPABLANCA ? 0:(pos.count<PAWN>(WHITE) != pos.count<PAWN>(BLACK));
e->asymmetry = popcount( (e->passedPawns[WHITE] | e->passedPawns[BLACK])
| (e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]));

| (e->semiopenFiles[WHITE] ^ e->semiopenFiles[BLACK]))
+ asymmetryCorrection;
//end patch sac3 begin
return e;
}

Expand Down
Loading

0 comments on commit 2f23572

Please # to comment.