├── .gitignore
├── .git-blame-ignore-revs
├── .github
├── ISSUE_TEMPLATE
│ ├── config.yml
│ └── BUG-REPORT.yml
├── ci
│ ├── libcxx17.imp
│ ├── arm_matrix.json
│ └── matrix.json
└── workflows
│ ├── iwyu.yml
│ ├── clang-format.yml
│ ├── codeql.yml
│ ├── sanitizers.yml
│ ├── compilation.yml
│ ├── arm_compilation.yml
│ ├── stockfish.yml
│ └── upload_binaries.yml
├── CITATION.cff
├── tests
├── signature.sh
├── perft.sh
└── reprosearch.sh
├── src
├── benchmark.h
├── main.cpp
├── incbin
│ └── UNLICENCE
├── score.cpp
├── score.h
├── evaluate.h
├── timeman.h
├── nnue
│ ├── nnue_misc.h
│ ├── features
│ │ ├── half_ka_v2_hm.cpp
│ │ └── half_ka_v2_hm.h
│ ├── nnue_accumulator.h
│ ├── layers
│ │ ├── sqr_clipped_relu.h
│ │ ├── simd.h
│ │ └── clipped_relu.h
│ ├── network.h
│ ├── nnue_architecture.h
│ └── nnue_misc.cpp
├── perft.h
├── movegen.h
├── syzygy
│ └── tbprobe.h
├── uci.h
├── ucioption.h
├── thread_win32_osx.h
├── engine.h
├── tune.cpp
├── tt.h
├── thread.h
├── evaluate.cpp
├── timeman.cpp
├── ucioption.cpp
├── engine.cpp
├── tt.cpp
├── tune.h
├── benchmark.cpp
├── misc.h
├── movepick.h
└── bitboard.cpp
├── .clang-format
├── scripts
└── get_native_properties.sh
├── CONTRIBUTING.md
├── AUTHORS
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | # Files from build
2 | **/*.o
3 | **/*.s
4 | src/.depend
5 |
6 | # Built binary
7 | src/stockfish*
8 | src/-lstdc++.res
9 |
10 | # Neural network for the NNUE evaluation
11 | **/*.nnue
12 |
13 |
--------------------------------------------------------------------------------
/.git-blame-ignore-revs:
--------------------------------------------------------------------------------
1 | # .git-blame-ignore-revs
2 | # Ignore commit which added clang-format
3 | 2d0237db3f0e596fb06e3ffbadba84dcc4e018f6
4 |
5 | # Post commit formatting fixes
6 | 0fca5605fa2e5e7240fde5e1aae50952b2612231
7 | 08ed4c90db31959521b7ef3186c026edd1e90307
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Discord server
4 | url: https://discord.gg/GWDRS3kU6R
5 | about: Feel free to ask for support or have a chat with us on our Discord server!
6 | - name: Discussions, Q&A, ideas, show us something...
7 | url: https://github.com/official-stockfish/Stockfish/discussions/new
8 | about: Do you have an idea for Stockfish? Do you want to show something that you made? Please open a discussion about it!
9 |
--------------------------------------------------------------------------------
/CITATION.cff:
--------------------------------------------------------------------------------
1 | # This CITATION.cff file was generated with cffinit.
2 | # Visit https://bit.ly/cffinit to generate yours today!
3 |
4 | cff-version: 1.2.0
5 | title: Stockfish
6 | message: >-
7 | Please cite this software using the metadata from this
8 | file.
9 | type: software
10 | authors:
11 | - name: The Stockfish developers (see AUTHORS file)
12 | repository-code: 'https://github.com/official-stockfish/Stockfish'
13 | url: 'https://stockfishchess.org/'
14 | repository-artifact: 'https://stockfishchess.org/download/'
15 | abstract: Stockfish is a free and strong UCI chess engine.
16 | keywords:
17 | - chess
18 | - artificial intelligence (AI)
19 | - tree search
20 | - alpha-beta search
21 | - neural networks (NN)
22 | - efficiently updatable neural networks (NNUE)
23 | license: GPL-3.0
24 |
--------------------------------------------------------------------------------
/tests/signature.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # obtain and optionally verify Bench / signature
3 | # if no reference is given, the output is deliberately limited to just the signature
4 |
5 | error()
6 | {
7 | echo "running bench for signature failed on line $1"
8 | exit 1
9 | }
10 | trap 'error ${LINENO}' ERR
11 |
12 | # obtain
13 |
14 | signature=`eval "$WINE_PATH ./stockfish bench 2>&1" | grep "Nodes searched : " | awk '{print $4}'`
15 |
16 | if [ $# -gt 0 ]; then
17 | # compare to given reference
18 | if [ "$1" != "$signature" ]; then
19 | if [ -z "$signature" ]; then
20 | echo "No signature obtained from bench. Code crashed or assert triggered ?"
21 | else
22 | echo "signature mismatch: reference $1 obtained: $signature ."
23 | fi
24 | exit 1
25 | else
26 | echo "signature OK: $signature"
27 | fi
28 | else
29 | # just report signature
30 | echo $signature
31 | fi
32 |
--------------------------------------------------------------------------------
/src/benchmark.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef BENCHMARK_H_INCLUDED
20 | #define BENCHMARK_H_INCLUDED
21 |
22 | #include
23 | #include
24 | #include
25 |
26 | namespace Stockfish::Benchmark {
27 |
28 | std::vector setup_bench(const std::string&, std::istream&);
29 |
30 | } // namespace Stockfish
31 |
32 | #endif // #ifndef BENCHMARK_H_INCLUDED
33 |
--------------------------------------------------------------------------------
/tests/perft.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # verify perft numbers (positions from www.chessprogramming.org/Perft_Results)
3 |
4 | error()
5 | {
6 | echo "perft testing failed on line $1"
7 | exit 1
8 | }
9 | trap 'error ${LINENO}' ERR
10 |
11 | echo "perft testing started"
12 |
13 | cat << EOF > perft.exp
14 | set timeout 10
15 | lassign \$argv pos depth result
16 | spawn ./stockfish
17 | send "position \$pos\\ngo perft \$depth\\n"
18 | expect "Nodes searched? \$result" {} timeout {exit 1}
19 | send "quit\\n"
20 | expect eof
21 | EOF
22 |
23 | expect perft.exp startpos 5 4865609 > /dev/null
24 | expect perft.exp "fen r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq -" 5 193690690 > /dev/null
25 | expect perft.exp "fen 8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - -" 6 11030083 > /dev/null
26 | expect perft.exp "fen r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1" 5 15833292 > /dev/null
27 | expect perft.exp "fen rnbq1k1r/pp1Pbppp/2p5/8/2B5/8/PPP1NnPP/RNBQK2R w KQ - 1 8" 5 89941194 > /dev/null
28 | expect perft.exp "fen r4rk1/1pp1qppp/p1np1n2/2b1p1B1/2B1P1b1/P1NP1N2/1PP1QPPP/R4RK1 w - - 0 10" 5 164075551 > /dev/null
29 |
30 | rm perft.exp
31 |
32 | echo "perft testing OK"
33 |
--------------------------------------------------------------------------------
/.github/ci/libcxx17.imp:
--------------------------------------------------------------------------------
1 | [
2 | # Mappings for libcxx's internal headers
3 | { include: [ "<__fwd/fstream.h>", private, "", public ] },
4 | { include: [ "<__fwd/ios.h>", private, "", public ] },
5 | { include: [ "<__fwd/istream.h>", private, "", public ] },
6 | { include: [ "<__fwd/ostream.h>", private, "", public ] },
7 | { include: [ "<__fwd/sstream.h>", private, "", public ] },
8 | { include: [ "<__fwd/streambuf.h>", private, "", public ] },
9 | { include: [ "<__fwd/string_view.h>", private, "", public ] },
10 |
11 | # Mappings for includes between public headers
12 | { include: [ "", public, "", public ] },
13 | { include: [ "", public, "", public ] },
14 | { include: [ "", public, "", public ] },
15 | { include: [ "", public, "", public ] },
16 | { include: [ "", public, "", public ] },
17 |
18 | # Missing mappings in include-what-you-use's libcxx.imp
19 | { include: ["@<__condition_variable/.*>", private, "", public ] },
20 | { include: ["@<__mutex/.*>", private, "", public ] },
21 | ]
22 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #include
20 |
21 | #include "bitboard.h"
22 | #include "misc.h"
23 | #include "position.h"
24 | #include "types.h"
25 | #include "uci.h"
26 | #include "tune.h"
27 |
28 | using namespace Stockfish;
29 |
30 | int main(int argc, char* argv[]) {
31 |
32 | std::cout << engine_info() << std::endl;
33 |
34 | Bitboards::init();
35 | Position::init();
36 |
37 | UCIEngine uci(argc, argv);
38 |
39 | Tune::init(uci.engine_options());
40 |
41 | uci.loop();
42 |
43 | return 0;
44 | }
45 |
--------------------------------------------------------------------------------
/.github/ci/arm_matrix.json:
--------------------------------------------------------------------------------
1 | {
2 | "config": [
3 | {
4 | "name": "Android NDK aarch64",
5 | "os": "ubuntu-22.04",
6 | "simple_name": "android",
7 | "compiler": "aarch64-linux-android21-clang++",
8 | "emu": "qemu-aarch64",
9 | "comp": "ndk",
10 | "shell": "bash",
11 | "archive_ext": "tar"
12 | },
13 | {
14 | "name": "Android NDK arm",
15 | "os": "ubuntu-22.04",
16 | "simple_name": "android",
17 | "compiler": "armv7a-linux-androideabi21-clang++",
18 | "emu": "qemu-arm",
19 | "comp": "ndk",
20 | "shell": "bash",
21 | "archive_ext": "tar"
22 | }
23 | ],
24 | "binaries": ["armv8-dotprod", "armv8", "armv7", "armv7-neon"],
25 | "exclude": [
26 | {
27 | "binaries": "armv8-dotprod",
28 | "config": {
29 | "compiler": "armv7a-linux-androideabi21-clang++"
30 | }
31 | },
32 | {
33 | "binaries": "armv8",
34 | "config": {
35 | "compiler": "armv7a-linux-androideabi21-clang++"
36 | }
37 | },
38 | {
39 | "binaries": "armv7",
40 | "config": {
41 | "compiler": "aarch64-linux-android21-clang++"
42 | }
43 | },
44 | {
45 | "binaries": "armv7-neon",
46 | "config": {
47 | "compiler": "aarch64-linux-android21-clang++"
48 | }
49 | }
50 | ]
51 | }
52 |
--------------------------------------------------------------------------------
/src/incbin/UNLICENCE:
--------------------------------------------------------------------------------
1 | The file "incbin.h" is free and unencumbered software released into
2 | the public domain by Dale Weiler, see:
3 |
4 |
5 | Anyone is free to copy, modify, publish, use, compile, sell, or
6 | distribute this software, either in source code form or as a compiled
7 | binary, for any purpose, commercial or non-commercial, and by any
8 | means.
9 |
10 | In jurisdictions that recognize copyright laws, the author or authors
11 | of this software dedicate any and all copyright interest in the
12 | software to the public domain. We make this dedication for the benefit
13 | of the public at large and to the detriment of our heirs and
14 | successors. We intend this dedication to be an overt act of
15 | relinquishment in perpetuity of all present and future rights to this
16 | software under copyright law.
17 |
18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 | OTHER DEALINGS IN THE SOFTWARE.
25 |
26 | For more information, please refer to
27 |
--------------------------------------------------------------------------------
/.clang-format:
--------------------------------------------------------------------------------
1 | AccessModifierOffset: -1
2 | AlignAfterOpenBracket: Align
3 | AlignConsecutiveAssignments: Consecutive
4 | AlignConsecutiveDeclarations: Consecutive
5 | AlignEscapedNewlines: DontAlign
6 | AlignOperands: AlignAfterOperator
7 | AlignTrailingComments: true
8 | AllowAllParametersOfDeclarationOnNextLine: true
9 | AllowShortCaseLabelsOnASingleLine: false
10 | AllowShortEnumsOnASingleLine: false
11 | AllowShortIfStatementsOnASingleLine: false
12 | AlwaysBreakTemplateDeclarations: Yes
13 | BasedOnStyle: WebKit
14 | BitFieldColonSpacing: After
15 | BinPackParameters: false
16 | BreakBeforeBinaryOperators: NonAssignment
17 | BreakBeforeBraces: Custom
18 | BraceWrapping:
19 | AfterFunction: false
20 | AfterClass: false
21 | AfterControlStatement: true
22 | BeforeElse: true
23 | BreakBeforeTernaryOperators: true
24 | BreakConstructorInitializers: AfterColon
25 | BreakStringLiterals: false
26 | ColumnLimit: 100
27 | ContinuationIndentWidth: 2
28 | Cpp11BracedListStyle: true
29 | IndentGotoLabels: false
30 | IndentPPDirectives: BeforeHash
31 | IndentWidth: 4
32 | MaxEmptyLinesToKeep: 2
33 | NamespaceIndentation: None
34 | PackConstructorInitializers: Never
35 | ReflowComments: false
36 | SortIncludes: false
37 | SortUsingDeclarations: false
38 | SpaceAfterCStyleCast: true
39 | SpaceAfterTemplateKeyword: false
40 | SpaceBeforeCaseColon: true
41 | SpaceBeforeCpp11BracedList: false
42 | SpaceBeforeInheritanceColon: false
43 | SpaceInEmptyBlock: false
44 | SpacesBeforeTrailingComments: 2
45 |
--------------------------------------------------------------------------------
/tests/reprosearch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # verify reproducible search
3 |
4 | error()
5 | {
6 | echo "reprosearch testing failed on line $1"
7 | exit 1
8 | }
9 | trap 'error ${LINENO}' ERR
10 |
11 | echo "reprosearch testing started"
12 |
13 | # repeat two short games, separated by ucinewgame.
14 | # with go nodes $nodes they should result in exactly
15 | # the same node count for each iteration.
16 | cat << EOF > repeat.exp
17 | set timeout 10
18 | spawn ./stockfish
19 | lassign \$argv nodes
20 |
21 | send "uci\n"
22 | expect "uciok"
23 |
24 | send "ucinewgame\n"
25 | send "position startpos\n"
26 | send "go nodes \$nodes\n"
27 | expect "bestmove"
28 |
29 | send "position startpos moves e2e4 e7e6\n"
30 | send "go nodes \$nodes\n"
31 | expect "bestmove"
32 |
33 | send "ucinewgame\n"
34 | send "position startpos\n"
35 | send "go nodes \$nodes\n"
36 | expect "bestmove"
37 |
38 | send "position startpos moves e2e4 e7e6\n"
39 | send "go nodes \$nodes\n"
40 | expect "bestmove"
41 |
42 | send "quit\n"
43 | expect eof
44 | EOF
45 |
46 | # to increase the likelihood of finding a non-reproducible case,
47 | # the allowed number of nodes are varied systematically
48 | for i in `seq 1 20`
49 | do
50 |
51 | nodes=$((100*3**i/2**i))
52 | echo "reprosearch testing with $nodes nodes"
53 |
54 | # each line should appear exactly an even number of times
55 | expect repeat.exp $nodes 2>&1 | grep -o "nodes [0-9]*" | sort | uniq -c | awk '{if ($1%2!=0) exit(1)}'
56 |
57 | done
58 |
59 | rm repeat.exp
60 |
61 | echo "reprosearch testing OK"
62 |
--------------------------------------------------------------------------------
/src/score.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #include "score.h"
20 |
21 | #include
22 | #include
23 | #include
24 |
25 | #include "uci.h"
26 |
27 | namespace Stockfish {
28 |
29 | Score::Score(Value v, const Position& pos) {
30 | assert(-VALUE_INFINITE < v && v < VALUE_INFINITE);
31 |
32 | if (std::abs(v) < VALUE_TB_WIN_IN_MAX_PLY)
33 | {
34 | score = InternalUnits{UCIEngine::to_cp(v, pos)};
35 | }
36 | else if (std::abs(v) <= VALUE_TB)
37 | {
38 | auto distance = VALUE_TB - std::abs(v);
39 | score = (v > 0) ? Tablebase{distance, true} : Tablebase{-distance, false};
40 | }
41 | else
42 | {
43 | auto distance = VALUE_MATE - std::abs(v);
44 | score = (v > 0) ? Mate{distance} : Mate{-distance};
45 | }
46 | }
47 |
48 | }
--------------------------------------------------------------------------------
/.github/workflows/iwyu.yml:
--------------------------------------------------------------------------------
1 | name: IWYU
2 | on:
3 | workflow_call:
4 | jobs:
5 | Analyzers:
6 | name: Check includes
7 | runs-on: ubuntu-22.04
8 | defaults:
9 | run:
10 | working-directory: Stockfish/src
11 | shell: bash
12 | steps:
13 | - name: Checkout Stockfish
14 | uses: actions/checkout@v4
15 | with:
16 | path: Stockfish
17 |
18 | - name: Checkout include-what-you-use
19 | uses: actions/checkout@v4
20 | with:
21 | repository: include-what-you-use/include-what-you-use
22 | ref: f25caa280dc3277c4086ec345ad279a2463fea0f
23 | path: include-what-you-use
24 |
25 | - name: Download required linux packages
26 | run: |
27 | sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
28 | wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
29 | sudo apt update
30 | sudo apt install -y libclang-17-dev clang-17 libc++-17-dev
31 |
32 | - name: Set up include-what-you-use
33 | run: |
34 | mkdir build && cd build
35 | cmake -G "Unix Makefiles" -DCMAKE_PREFIX_PATH="/usr/lib/llvm-17" ..
36 | sudo make install
37 | working-directory: include-what-you-use
38 |
39 | - name: Check include-what-you-use
40 | run: include-what-you-use --version
41 |
42 | - name: Check includes
43 | run: >
44 | make analyze
45 | COMP=clang
46 | CXX=include-what-you-use
47 | CXXFLAGS="-stdlib=libc++ -Xiwyu --comment_style=long -Xiwyu --mapping='${{ github.workspace }}/Stockfish/.github/ci/libcxx17.imp' -Xiwyu --error"
48 |
--------------------------------------------------------------------------------
/src/score.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef SCORE_H_INCLUDED
20 | #define SCORE_H_INCLUDED
21 |
22 | #include
23 | #include
24 |
25 | #include "types.h"
26 |
27 | namespace Stockfish {
28 |
29 | class Position;
30 |
31 | class Score {
32 | public:
33 | struct Mate {
34 | int plies;
35 | };
36 |
37 | struct Tablebase {
38 | int plies;
39 | bool win;
40 | };
41 |
42 | struct InternalUnits {
43 | int value;
44 | };
45 |
46 | Score() = default;
47 | Score(Value v, const Position& pos);
48 |
49 | template
50 | bool is() const {
51 | return std::holds_alternative(score);
52 | }
53 |
54 | template
55 | T get() const {
56 | return std::get(score);
57 | }
58 |
59 | template
60 | decltype(auto) visit(F&& f) const {
61 | return std::visit(std::forward(f), score);
62 | }
63 |
64 | private:
65 | std::variant score;
66 | };
67 |
68 | }
69 |
70 | #endif // #ifndef SCORE_H_INCLUDED
71 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/BUG-REPORT.yml:
--------------------------------------------------------------------------------
1 | name: Report issue
2 | description: Create a report to help us fix issues with the engine
3 | body:
4 | - type: textarea
5 | attributes:
6 | label: Describe the issue
7 | description: A clear and concise description of what you're experiencing.
8 | validations:
9 | required: true
10 |
11 | - type: textarea
12 | attributes:
13 | label: Expected behavior
14 | description: A clear and concise description of what you expected to happen.
15 | validations:
16 | required: true
17 |
18 | - type: textarea
19 | attributes:
20 | label: Steps to reproduce
21 | description: |
22 | Steps to reproduce the behavior.
23 | You can also use this section to paste the command line output.
24 | placeholder: |
25 | ```
26 | position startpos moves g2g4 e7e5 f2f3
27 | go mate 1
28 | info string NNUE evaluation using nn-6877cd24400e.nnue enabled
29 | info depth 1 seldepth 1 multipv 1 score mate 1 nodes 33 nps 11000 tbhits 0 time 3 pv d8h4
30 | bestmove d8h4
31 | ```
32 | validations:
33 | required: true
34 |
35 | - type: textarea
36 | attributes:
37 | label: Anything else?
38 | description: |
39 | Anything that will give us more context about the issue you are encountering.
40 | You can also use this section to propose ideas on how to solve the issue.
41 | validations:
42 | required: false
43 |
44 | - type: dropdown
45 | attributes:
46 | label: Operating system
47 | options:
48 | - All
49 | - Windows
50 | - Linux
51 | - MacOS
52 | - Android
53 | - Other or N/A
54 | validations:
55 | required: true
56 |
57 | - type: input
58 | attributes:
59 | label: Stockfish version
60 | description: |
61 | This can be found by running the engine.
62 | You can also use the commit ID.
63 | placeholder: Stockfish 15 / e6e324e
64 | validations:
65 | required: true
66 |
--------------------------------------------------------------------------------
/src/evaluate.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef EVALUATE_H_INCLUDED
20 | #define EVALUATE_H_INCLUDED
21 |
22 | #include
23 |
24 | #include "types.h"
25 |
26 | namespace Stockfish {
27 |
28 | class Position;
29 |
30 | namespace Eval {
31 |
32 | // The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue
33 | // for the build process (profile-build and fishtest) to work. Do not change the
34 | // name of the macro or the location where this macro is defined, as it is used
35 | // in the Makefile/Fishtest.
36 | #define EvalFileDefaultNameBig "nn-c721dfca8cd3.nnue"
37 | #define EvalFileDefaultNameSmall "nn-baff1ede1f90.nnue"
38 |
39 | namespace NNUE {
40 | struct Networks;
41 | struct AccumulatorCaches;
42 | }
43 |
44 | std::string trace(Position& pos, const Eval::NNUE::Networks& networks);
45 |
46 | int simple_eval(const Position& pos, Color c);
47 | bool use_smallnet(const Position& pos);
48 | Value evaluate(const NNUE::Networks& networks,
49 | const Position& pos,
50 | Eval::NNUE::AccumulatorCaches& caches,
51 | int optimism);
52 | } // namespace Eval
53 |
54 | } // namespace Stockfish
55 |
56 | #endif // #ifndef EVALUATE_H_INCLUDED
57 |
--------------------------------------------------------------------------------
/.github/workflows/clang-format.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run clang-format and comment on the PR.
2 | # Because of security reasons, it is crucial that this workflow
3 | # executes no shell script nor runs make.
4 | # Read this before editing: https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
5 |
6 | name: Clang-Format
7 | on:
8 | pull_request_target:
9 | branches:
10 | - "master"
11 | paths:
12 | - "**.cpp"
13 | - "**.h"
14 | jobs:
15 | Clang-Format:
16 | name: Clang-Format
17 | runs-on: ubuntu-20.04
18 | steps:
19 | - uses: actions/checkout@v4
20 | with:
21 | ref: ${{ github.event.pull_request.head.sha }}
22 |
23 | - name: Run clang-format style check
24 | uses: jidicula/clang-format-action@f62da5e3d3a2d88ff364771d9d938773a618ab5e # @v4.11.0
25 | id: clang-format
26 | continue-on-error: true
27 | with:
28 | clang-format-version: "17"
29 | exclude-regex: "incbin"
30 |
31 | - name: Comment on PR
32 | if: steps.clang-format.outcome == 'failure'
33 | uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # @v2.5.0
34 | with:
35 | message: |
36 | clang-format 17 needs to be run on this PR.
37 | If you do not have clang-format installed, the maintainer will run it when merging.
38 | For the exact version please see https://packages.ubuntu.com/mantic/clang-format-17.
39 |
40 | _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
41 | comment_tag: execution
42 |
43 | - name: Comment on PR
44 | if: steps.clang-format.outcome != 'failure'
45 | uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # @v2.5.0
46 | with:
47 | message: |
48 | _(execution **${{ github.run_id }}** / attempt **${{ github.run_attempt }}**)_
49 | create_if_not_exists: false
50 | comment_tag: execution
51 | mode: delete
52 |
--------------------------------------------------------------------------------
/.github/workflows/codeql.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | branches: ["master"]
6 | pull_request:
7 | # The branches below must be a subset of the branches above
8 | branches: ["master"]
9 | schedule:
10 | - cron: "17 18 * * 1"
11 |
12 | jobs:
13 | analyze:
14 | name: Analyze
15 | runs-on: ubuntu-latest
16 | permissions:
17 | actions: read
18 | contents: read
19 | security-events: write
20 |
21 | strategy:
22 | fail-fast: false
23 | matrix:
24 | language: ["cpp"]
25 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
26 | # Use only 'java' to analyze code written in Java, Kotlin, or both
27 | # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
28 | # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
29 |
30 | steps:
31 | - name: Checkout repository
32 | uses: actions/checkout@v4
33 |
34 | # Initializes the CodeQL tools for scanning.
35 | - name: Initialize CodeQL
36 | uses: github/codeql-action/init@v3
37 | with:
38 | languages: ${{ matrix.language }}
39 | # If you wish to specify custom queries, you can do so here or in a config file.
40 | # By default, queries listed here will override any specified in a config file.
41 | # Prefix the list here with "+" to use these queries and those in the config file.
42 |
43 | # For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
44 | # queries: security-extended,security-and-quality
45 |
46 | - name: Build
47 | working-directory: src
48 | run: make -j build ARCH=x86-64-modern
49 |
50 | - name: Perform CodeQL Analysis
51 | uses: github/codeql-action/analyze@v3
52 | with:
53 | category: "/language:${{matrix.language}}"
54 |
--------------------------------------------------------------------------------
/src/timeman.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef TIMEMAN_H_INCLUDED
20 | #define TIMEMAN_H_INCLUDED
21 |
22 | #include
23 |
24 | #include "misc.h"
25 | #include "types.h"
26 |
27 | namespace Stockfish {
28 |
29 | class OptionsMap;
30 |
31 | namespace Search {
32 | struct LimitsType;
33 | }
34 |
35 | // The TimeManagement class computes the optimal time to think depending on
36 | // the maximum available time, the game move number, and other parameters.
37 | class TimeManagement {
38 | public:
39 | void init(
40 | Search::LimitsType& limits, Color us, int ply, const OptionsMap& options, int& originalPly);
41 |
42 | TimePoint optimum() const;
43 | TimePoint maximum() const;
44 | template
45 | TimePoint elapsed(FUNC nodes) const {
46 | return useNodesTime ? TimePoint(nodes()) : elapsed_time();
47 | }
48 | TimePoint elapsed_time() const { return now() - startTime; };
49 |
50 | void clear();
51 | void advance_nodes_time(std::int64_t nodes);
52 |
53 | private:
54 | TimePoint startTime;
55 | TimePoint optimumTime;
56 | TimePoint maximumTime;
57 |
58 | std::int64_t availableNodes = -1; // When in 'nodes as time' mode
59 | bool useNodesTime = false; // True if we are in 'nodes as time' mode
60 | };
61 |
62 | } // namespace Stockfish
63 |
64 | #endif // #ifndef TIMEMAN_H_INCLUDED
65 |
--------------------------------------------------------------------------------
/src/nnue/nnue_misc.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef NNUE_MISC_H_INCLUDED
20 | #define NNUE_MISC_H_INCLUDED
21 |
22 | #include
23 | #include
24 |
25 | #include "../types.h"
26 | #include "nnue_architecture.h"
27 |
28 | namespace Stockfish {
29 |
30 | class Position;
31 |
32 | namespace Eval::NNUE {
33 |
34 | struct EvalFile {
35 | // Default net name, will use one of the EvalFileDefaultName* macros defined
36 | // in evaluate.h
37 | std::string defaultName;
38 | // Selected net name, either via uci option or default
39 | std::string current;
40 | // Net description extracted from the net file
41 | std::string netDescription;
42 | };
43 |
44 |
45 | struct NnueEvalTrace {
46 | static_assert(LayerStacks == PSQTBuckets);
47 |
48 | Value psqt[LayerStacks];
49 | Value positional[LayerStacks];
50 | std::size_t correctBucket;
51 | };
52 |
53 | struct Networks;
54 | struct AccumulatorCaches;
55 |
56 | std::string trace(Position& pos, const Networks& networks, AccumulatorCaches& caches);
57 | void hint_common_parent_position(const Position& pos,
58 | const Networks& networks,
59 | AccumulatorCaches& caches);
60 |
61 | } // namespace Stockfish::Eval::NNUE
62 | } // namespace Stockfish
63 |
64 | #endif // #ifndef NNUE_MISC_H_INCLUDED
65 |
--------------------------------------------------------------------------------
/src/perft.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef PERFT_H_INCLUDED
20 | #define PERFT_H_INCLUDED
21 |
22 | #include
23 |
24 | #include "movegen.h"
25 | #include "position.h"
26 | #include "types.h"
27 | #include "uci.h"
28 |
29 | namespace Stockfish::Benchmark {
30 |
31 | // Utility to verify move generation. All the leaf nodes up
32 | // to the given depth are generated and counted, and the sum is returned.
33 | template
34 | uint64_t perft(Position& pos, Depth depth) {
35 |
36 | StateInfo st;
37 | ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
38 |
39 | uint64_t cnt, nodes = 0;
40 | const bool leaf = (depth == 2);
41 |
42 | for (const auto& m : MoveList(pos))
43 | {
44 | if (Root && depth <= 1)
45 | cnt = 1, nodes++;
46 | else
47 | {
48 | pos.do_move(m, st);
49 | cnt = leaf ? MoveList(pos).size() : perft(pos, depth - 1);
50 | nodes += cnt;
51 | pos.undo_move(m);
52 | }
53 | if (Root)
54 | sync_cout << UCIEngine::move(m, pos.is_chess960()) << ": " << cnt << sync_endl;
55 | }
56 | return nodes;
57 | }
58 |
59 | inline uint64_t perft(const std::string& fen, Depth depth, bool isChess960) {
60 | StateListPtr states(new std::deque(1));
61 | Position p;
62 | p.set(fen, isChess960, &states->back());
63 |
64 | return perft(p, depth);
65 | }
66 | }
67 |
68 | #endif // PERFT_H_INCLUDED
69 |
--------------------------------------------------------------------------------
/src/movegen.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef MOVEGEN_H_INCLUDED
20 | #define MOVEGEN_H_INCLUDED
21 |
22 | #include // IWYU pragma: keep
23 | #include
24 |
25 | #include "types.h"
26 |
27 | namespace Stockfish {
28 |
29 | class Position;
30 |
31 | enum GenType {
32 | CAPTURES,
33 | QUIETS,
34 | QUIET_CHECKS,
35 | EVASIONS,
36 | NON_EVASIONS,
37 | LEGAL
38 | };
39 |
40 | struct ExtMove: public Move {
41 | int value;
42 |
43 | void operator=(Move m) { data = m.raw(); }
44 |
45 | // Inhibit unwanted implicit conversions to Move
46 | // with an ambiguity that yields to a compile error.
47 | operator float() const = delete;
48 | };
49 |
50 | inline bool operator<(const ExtMove& f, const ExtMove& s) { return f.value < s.value; }
51 |
52 | template
53 | ExtMove* generate(const Position& pos, ExtMove* moveList);
54 |
55 | // The MoveList struct wraps the generate() function and returns a convenient
56 | // list of moves. Using MoveList is sometimes preferable to directly calling
57 | // the lower level generate() function.
58 | template
59 | struct MoveList {
60 |
61 | explicit MoveList(const Position& pos) :
62 | last(generate(pos, moveList)) {}
63 | const ExtMove* begin() const { return moveList; }
64 | const ExtMove* end() const { return last; }
65 | size_t size() const { return last - moveList; }
66 | bool contains(Move move) const { return std::find(begin(), end(), move) != end(); }
67 |
68 | private:
69 | ExtMove moveList[MAX_MOVES], *last;
70 | };
71 |
72 | } // namespace Stockfish
73 |
74 | #endif // #ifndef MOVEGEN_H_INCLUDED
75 |
--------------------------------------------------------------------------------
/src/syzygy/tbprobe.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef TBPROBE_H
20 | #define TBPROBE_H
21 |
22 | #include
23 | #include
24 |
25 |
26 | namespace Stockfish {
27 | class Position;
28 | class OptionsMap;
29 |
30 | using Depth = int;
31 |
32 | namespace Search {
33 | struct RootMove;
34 | using RootMoves = std::vector;
35 | }
36 | }
37 |
38 | namespace Stockfish::Tablebases {
39 |
40 | struct Config {
41 | int cardinality = 0;
42 | bool rootInTB = false;
43 | bool useRule50 = false;
44 | Depth probeDepth = 0;
45 | };
46 |
47 | enum WDLScore {
48 | WDLLoss = -2, // Loss
49 | WDLBlessedLoss = -1, // Loss, but draw under 50-move rule
50 | WDLDraw = 0, // Draw
51 | WDLCursedWin = 1, // Win, but draw under 50-move rule
52 | WDLWin = 2, // Win
53 | };
54 |
55 | // Possible states after a probing operation
56 | enum ProbeState {
57 | FAIL = 0, // Probe failed (missing file table)
58 | OK = 1, // Probe successful
59 | CHANGE_STM = -1, // DTZ should check the other side
60 | ZEROING_BEST_MOVE = 2 // Best move zeroes DTZ (capture or pawn move)
61 | };
62 |
63 | extern int MaxCardinality;
64 |
65 |
66 | void init(const std::string& paths);
67 | WDLScore probe_wdl(Position& pos, ProbeState* result);
68 | int probe_dtz(Position& pos, ProbeState* result);
69 | bool root_probe(Position& pos, Search::RootMoves& rootMoves, bool rule50);
70 | bool root_probe_wdl(Position& pos, Search::RootMoves& rootMoves, bool rule50);
71 | Config rank_root_moves(const OptionsMap& options, Position& pos, Search::RootMoves& rootMoves);
72 |
73 | } // namespace Stockfish::Tablebases
74 |
75 | #endif
76 |
--------------------------------------------------------------------------------
/src/uci.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef UCI_H_INCLUDED
20 | #define UCI_H_INCLUDED
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 |
27 | #include "engine.h"
28 | #include "misc.h"
29 | #include "search.h"
30 |
31 | namespace Stockfish {
32 |
33 | class Position;
34 | class Move;
35 | class Score;
36 | enum Square : int;
37 | using Value = int;
38 |
39 | class UCIEngine {
40 | public:
41 | UCIEngine(int argc, char** argv);
42 |
43 | void loop();
44 |
45 | static int to_cp(Value v, const Position& pos);
46 | static std::string format_score(const Score& s);
47 | static std::string square(Square s);
48 | static std::string move(Move m, bool chess960);
49 | static std::string wdl(Value v, const Position& pos);
50 | static std::string to_lower(std::string str);
51 | static Move to_move(const Position& pos, std::string str);
52 |
53 | static Search::LimitsType parse_limits(std::istream& is);
54 |
55 | auto& engine_options() { return engine.get_options(); }
56 |
57 | private:
58 | Engine engine;
59 | CommandLine cli;
60 |
61 | void go(std::istringstream& is);
62 | void bench(std::istream& args);
63 | void position(std::istringstream& is);
64 | void setoption(std::istringstream& is);
65 | std::uint64_t perft(const Search::LimitsType&);
66 |
67 | static void on_update_no_moves(const Engine::InfoShort& info);
68 | static void on_update_full(const Engine::InfoFull& info, bool showWDL);
69 | static void on_iter(const Engine::InfoIter& info);
70 | static void on_bestmove(std::string_view bestmove, std::string_view ponder);
71 | };
72 |
73 | } // namespace Stockfish
74 |
75 | #endif // #ifndef UCI_H_INCLUDED
76 |
--------------------------------------------------------------------------------
/.github/workflows/sanitizers.yml:
--------------------------------------------------------------------------------
1 | name: Sanitizers
2 | on:
3 | workflow_call:
4 | jobs:
5 | Test-under-sanitizers:
6 | name: ${{ matrix.sanitizers.name }}
7 | runs-on: ${{ matrix.config.os }}
8 | env:
9 | COMPCXX: ${{ matrix.config.compiler }}
10 | COMP: ${{ matrix.config.comp }}
11 | CXXFLAGS: "-Werror"
12 | strategy:
13 | fail-fast: false
14 | matrix:
15 | config:
16 | - name: Ubuntu 22.04 GCC
17 | os: ubuntu-22.04
18 | compiler: g++
19 | comp: gcc
20 | shell: bash
21 | sanitizers:
22 | - name: Run with thread sanitizer
23 | make_option: sanitize=thread
24 | instrumented_option: sanitizer-thread
25 | - name: Run with UB sanitizer
26 | make_option: sanitize=undefined
27 | instrumented_option: sanitizer-undefined
28 | - name: Run under valgrind
29 | make_option: ""
30 | instrumented_option: valgrind
31 | - name: Run under valgrind-thread
32 | make_option: ""
33 | instrumented_option: valgrind-thread
34 | - name: Run non-instrumented
35 | make_option: ""
36 | instrumented_option: none
37 | defaults:
38 | run:
39 | working-directory: src
40 | shell: ${{ matrix.config.shell }}
41 | steps:
42 | - uses: actions/checkout@v4
43 |
44 | - name: Download required linux packages
45 | run: |
46 | sudo apt update
47 | sudo apt install expect valgrind g++-multilib
48 |
49 | - name: Download the used network from the fishtest framework
50 | run: make net
51 |
52 | - name: Check compiler
53 | run: $COMPCXX -v
54 |
55 | - name: Test help target
56 | run: make help
57 |
58 | - name: Check git
59 | run: git --version
60 |
61 | # Since Linux Kernel 6.5 we are getting false positives from the ci,
62 | # lower the ALSR entropy to disable ALSR, which works as a temporary workaround.
63 | # https://github.com/google/sanitizers/issues/1716
64 | # https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2056762
65 |
66 | - name: Lower ALSR entropy
67 | run: sudo sysctl -w vm.mmap_rnd_bits=28
68 |
69 | # Sanitizers
70 |
71 | - name: ${{ matrix.sanitizers.name }}
72 | run: |
73 | export CXXFLAGS="-O1 -fno-inline"
74 | make clean
75 | make -j4 ARCH=x86-64-sse41-popcnt ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null
76 | ../tests/instrumented.sh --${{ matrix.sanitizers.instrumented_option }}
77 |
--------------------------------------------------------------------------------
/src/ucioption.h:
--------------------------------------------------------------------------------
1 | /*
2 | Stockfish, a UCI chess playing engine derived from Glaurung 2.1
3 | Copyright (C) 2004-2024 The Stockfish developers (see AUTHORS file)
4 |
5 | Stockfish is free software: you can redistribute it and/or modify
6 | it under the terms of the GNU General Public License as published by
7 | the Free Software Foundation, either version 3 of the License, or
8 | (at your option) any later version.
9 |
10 | Stockfish is distributed in the hope that it will be useful,
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 | GNU General Public License for more details.
14 |
15 | You should have received a copy of the GNU General Public License
16 | along with this program. If not, see .
17 | */
18 |
19 | #ifndef UCIOPTION_H_INCLUDED
20 | #define UCIOPTION_H_INCLUDED
21 |
22 | #include
23 | #include
24 | #include
25 | #include