Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ddugovic committed Jun 8, 2023
2 parents 2cfd037 + 54ad986 commit 9222a88
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 101 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/stockfish.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Stockfish
on:
push:
tags:
- '*'
branches:
- master
- tools
Expand All @@ -17,8 +19,8 @@ jobs:
Compiles:
uses: ./.github/workflows/stockfish_compile_test.yml
Binaries:
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || (startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag')
uses: ./.github/workflows/stockfish_binaries.yml
ARM_Binaries:
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || (startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag')
uses: ./.github/workflows/stockfish_arm_binaries.yml
8 changes: 8 additions & 0 deletions .github/workflows/stockfish_arm_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,18 @@ jobs:
cp "Top CPU Contributors.txt" stockfish/
cp Copying.txt stockfish/
cp AUTHORS stockfish/
cp CITATION.cff stockfish/
cp README.md stockfish/
tar -cvf stockfish-android-$BINARY.tar stockfish
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: stockfish-android-${{ matrix.binaries }}
path: stockfish-android-${{ matrix.binaries }}.tar

- name: Release
if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: stockfish-android-${{ matrix.binaries }}.tar
27 changes: 18 additions & 9 deletions .github/workflows/stockfish_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,26 @@ jobs:
COMPILER: ${{ matrix.config.compiler }}
COMP: ${{ matrix.config.comp }}
EXT: ${{ matrix.config.ext }}
OS: ${{ matrix.config.os }}
NAME: ${{ matrix.config.simple_name }}
BINARY: ${{ matrix.binaries }}
strategy:
matrix:
config:
- name: Ubuntu 20.04 GCC
os: ubuntu-20.04
simple_name: ubuntu
compiler: g++
comp: gcc
shell: bash {0}
- name: MacOS 12 Apple Clang
os: macos-12
simple_name: macos
compiler: clang++
comp: clang
shell: bash {0}
- name: Windows 2022 Mingw-w64 GCC x86_64
os: windows-2022
simple_name: windows
compiler: g++
comp: mingw
msys_sys: mingw64
Expand Down Expand Up @@ -75,34 +78,40 @@ jobs:

- name: Compile ${{ matrix.binaries }} build
run: |
make clean
make -j2 profile-build ARCH=$BINARY COMP=$COMP
make strip ARCH=$BINARY COMP=$COMP
mv ./stockfish$EXT ../stockfish-$OS-$BINARY$EXT
mv ./stockfish$EXT ../stockfish-$NAME-$BINARY$EXT
- name: Remove non src files
run: rm -f *.o .depend *.nnue
run: git clean -fx

- name: Download wiki
run: |
git clone https://github.com/official-stockfish/Stockfish.wiki.git ../wiki
cd ../wiki
rm -rf .git
rm -rf ../wiki/.git
- name: Create tar archive.
run: |
cd ..
mkdir stockfish
cp -r wiki stockfish/
cp -r src stockfish/
cp stockfish-$OS-$BINARY$EXT stockfish/
cp stockfish-$NAME-$BINARY$EXT stockfish/
cp "Top CPU Contributors.txt" stockfish/
cp Copying.txt stockfish/
cp AUTHORS stockfish/
tar -cvf stockfish-$OS-$BINARY.tar stockfish
cp CITATION.cff stockfish/
cp README.md stockfish/
tar -cvf stockfish-$NAME-$BINARY.tar stockfish
- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}
path: stockfish-${{ matrix.config.os }}-${{ matrix.binaries }}.tar
path: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.tar

- name: Release
if: startsWith(github.ref_name, 'sf_') && github.ref_type == 'tag'
uses: softprops/action-gh-release@v1
with:
files: stockfish-${{ matrix.config.simple_name }}-${{ matrix.binaries }}.tar
8 changes: 3 additions & 5 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1973,11 +1973,9 @@ Value Eval::evaluate(const Position& pos) {

Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);

// Blend nnue complexity with (semi)classical complexity
nnueComplexity = 25 * (nnueComplexity + abs(psq - nnue)) / 64;

optimism += optimism * nnueComplexity / 256;
v = (nnue * (945 + npm) + optimism * (174 + npm)) / 1024;
// Blend optimism with nnue complexity and (semi)classical complexity
optimism += optimism * (nnueComplexity + abs(psq - nnue)) / 512;
v = (nnue * (945 + npm) + optimism * (150 + npm)) / 1024;
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/evaluate.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace Eval {
// The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue
// for the build process (profile-build and fishtest) to work. Do not change the
// name of the macro, as it is used in the Makefile.
#define EvalFileDefaultName "nn-8d69132723e2.nnue"
#define EvalFileDefaultName "nn-0dd1cebea573.nnue"

namespace NNUE {

Expand Down
24 changes: 9 additions & 15 deletions src/position.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ Value Position::see<ATOMIC_VARIANT>(Move m, PieceType nextVictim, Square s) cons
/// SEE value of move is greater or equal to the given threshold. We'll use an
/// algorithm similar to alpha-beta pruning with a null window.

bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
bool Position::see_ge(Move m, Value threshold) const {

assert(is_ok(m));
#ifdef CRAZYHOUSE
Expand Down Expand Up @@ -2244,7 +2244,7 @@ bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
if (threshold > VALUE_ZERO)
return false;

occupied = pieces() ^ from;
Bitboard occupied = pieces() ^ from;
Bitboard attackers = attackers_to(to, occupied) & occupied & pieces(~stm) & ~pieces(KING);

// Loop over attacking pieces
Expand Down Expand Up @@ -2272,7 +2272,7 @@ bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
if (is_extinction() && ! more_than_one(pieces(color_of(piece_on(from)), type_of(piece_on(from)))))
{
// Toggles to square occupancy in case of stm != sideToMove
occupied = pieces() ^ from ^ to;
Bitboard occupied = pieces() ^ from ^ to;
if (type_of(m) == EN_PASSANT)
occupied ^= make_square(file_of(to), rank_of(from));
if (attackers_to(to, occupied) & occupied & pieces(color_of(piece_on(from))))
Expand All @@ -2293,12 +2293,11 @@ bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
#else
assert(color_of(piece_on(from)) == sideToMove);
#endif
Bitboard occupied = pieces() ^ from ^ to; // xoring to is important for pinned piece logic
#ifdef CRAZYHOUSE
if (is_house() && type_of(m) == DROP)
occupied = pieces() ^ to;
else
#endif
occupied = pieces() ^ from ^ to; // xoring to is important for pinned piece logic
Color stm = sideToMove;
Bitboard attackers = attackers_to(to, occupied);
Bitboard stmAttackers, bb;
Expand Down Expand Up @@ -2343,43 +2342,43 @@ bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
// the bitboard 'attackers' any X-ray attackers behind it.
if ((bb = stmAttackers & pieces(PAWN)))
{
occupied ^= least_significant_square_bb(bb);
if ((swap = PawnValueMg - swap) < res)
break;
occupied ^= least_significant_square_bb(bb);

attackers |= attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN);
}

else if ((bb = stmAttackers & pieces(KNIGHT)))
{
occupied ^= least_significant_square_bb(bb);
if ((swap = KnightValueMg - swap) < res)
break;
occupied ^= least_significant_square_bb(bb);
}

else if ((bb = stmAttackers & pieces(BISHOP)))
{
occupied ^= least_significant_square_bb(bb);
if ((swap = BishopValueMg - swap) < res)
break;
occupied ^= least_significant_square_bb(bb);

attackers |= attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN);
}

else if ((bb = stmAttackers & pieces(ROOK)))
{
occupied ^= least_significant_square_bb(bb);
if ((swap = RookValueMg - swap) < res)
break;
occupied ^= least_significant_square_bb(bb);

attackers |= attacks_bb<ROOK>(to, occupied) & pieces(ROOK, QUEEN);
}

else if ((bb = stmAttackers & pieces(QUEEN)))
{
occupied ^= least_significant_square_bb(bb);
if ((swap = QueenValueMg - swap) < res)
break;
occupied ^= least_significant_square_bb(bb);

attackers |= (attacks_bb<BISHOP>(to, occupied) & pieces(BISHOP, QUEEN))
| (attacks_bb<ROOK >(to, occupied) & pieces(ROOK , QUEEN));
Expand All @@ -2394,11 +2393,6 @@ bool Position::see_ge(Move m, Bitboard& occupied, Value threshold) const {
return bool(res);
}

bool Position::see_ge(Move m, Value threshold) const {
Bitboard occupied;
return see_ge(m, occupied, threshold);
}


/// Position::is_draw() tests whether the position is drawn by 50-move rule
/// or by repetition. It does not detect stalemates.
Expand Down
1 change: 0 additions & 1 deletion src/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ class Position {
template<Variant V>
Value see(Move m, PieceType nextVictim, Square s) const;
#endif
bool see_ge(Move m, Bitboard& occupied, Value threshold = VALUE_ZERO) const;
bool see_ge(Move m, Value threshold = VALUE_ZERO) const;

// Accessing hash keys
Expand Down
Loading

0 comments on commit 9222a88

Please sign in to comment.