#include "benchmark.h"
+#include <cstdlib>
#include <fstream>
#include <iostream>
-#include <istream>
#include <vector>
#include "position.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "bitboard.h"
+
#include <algorithm>
#include <bitset>
+#include <initializer_list>
-#include "bitboard.h"
#include "misc.h"
namespace Stockfish {
#ifndef BITBOARD_H_INCLUDED
#define BITBOARD_H_INCLUDED
+#include <algorithm>
+#include <cassert>
+#include <cmath>
+#include <cstdint>
+#include <cstdlib>
#include <string>
#include "types.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "evaluate.h"
+
#include <algorithm>
#include <cassert>
+#include <cstdlib>
#include <fstream>
#include <iomanip>
-#include <sstream>
#include <iostream>
-#include <streambuf>
+#include <sstream>
#include <vector>
-#include "bitboard.h"
-#include "evaluate.h"
+#include "incbin/incbin.h"
#include "misc.h"
+#include "nnue/evaluate_nnue.h"
+#include "position.h"
#include "thread.h"
-#include "timeman.h"
+#include "types.h"
#include "uci.h"
-#include "incbin/incbin.h"
-#include "nnue/evaluate_nnue.h"
// Macro to embed the default efficiently updatable neural network (NNUE) file
// data in the engine binary (using incbin.h, by Dale Weiler).
#define EVALUATE_H_INCLUDED
#include <string>
-#include <optional>
-
-#include "types.h"
namespace Stockfish {
class Position;
+enum Value : int;
namespace Eval {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <cstddef>
#include <iostream>
#include "bitboard.h"
+#include "evaluate.h"
+#include "misc.h"
#include "position.h"
#include "search.h"
-#include "syzygy/tbprobe.h"
#include "thread.h"
-#include "tt.h"
+#include "tune.h"
+#include "types.h"
#include "uci.h"
using namespace Stockfish;
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "misc.h"
+
#ifdef _WIN32
#if _WIN32_WINNT < 0x0601
#undef _WIN32_WINNT
}
#endif
+#include <atomic>
#include <cmath>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
+#include <mutex>
#include <sstream>
#include <string_view>
-#include <vector>
+
+#include "types.h"
#if defined(__linux__) && !defined(__ANDROID__)
-#include <stdlib.h>
#include <sys/mman.h>
#endif
#include <stdlib.h>
#endif
-#include "misc.h"
-#include "thread.h"
-
using namespace std;
namespace Stockfish {
#include <cassert>
#include <chrono>
-#include <ostream>
-#include <string>
-#include <vector>
+#include <cstddef>
#include <cstdint>
-
-#include "types.h"
+#include <iosfwd>
+#include <string>
#define stringify2(x) #x
#define stringify(x) stringify2(x)
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "movegen.h"
+
#include <cassert>
+#include <initializer_list>
-#include "movegen.h"
+#include "bitboard.h"
#include "position.h"
namespace Stockfish {
#define MOVEGEN_H_INCLUDED
#include <algorithm>
+#include <cstddef>
#include "types.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "movepick.h"
+
+#include <algorithm>
#include <cassert>
+#include <iterator>
+#include <utility>
#include "bitboard.h"
-#include "movepick.h"
+#include "position.h"
namespace Stockfish {
: 0 )
: 0 ;
}
-
+
else // Type == EVASIONS
{
if (pos.capture_stage(m))
#define MOVEPICK_H_INCLUDED
#include <array>
+#include <cassert>
+#include <cstdint>
+#include <cstdlib>
#include <limits>
#include <type_traits>
#include "movegen.h"
-#include "position.h"
#include "types.h"
namespace Stockfish {
+class Position;
/// StatsEntry stores the stat table value. It is usually a number but could
/// be a move or even a nested history. We use a class instead of naked value
// Code for calculating NNUE evaluation function
+#include "evaluate_nnue.h"
+
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
-#include <set>
#include <sstream>
#include <string_view>
#include "../evaluate.h"
+#include "../misc.h"
#include "../position.h"
-#include "../uci.h"
#include "../types.h"
-
-#include "evaluate_nnue.h"
+#include "../uci.h"
+#include "nnue_accumulator.h"
+#include "nnue_common.h"
namespace Stockfish::Eval::NNUE {
// format_cp_aligned_dot() converts a Value into pawns, always keeping two decimals
static void format_cp_aligned_dot(Value v, std::stringstream &stream) {
-
+
const double pawns = std::abs(0.01 * UCI::to_cp(v));
stream << (v < 0 ? '-' : v > 0 ? '+' : ' ')
#ifndef NNUE_EVALUATE_NNUE_H_INCLUDED
#define NNUE_EVALUATE_NNUE_H_INCLUDED
+#include <cstdint>
+#include <iosfwd>
+#include <memory>
+#include <optional>
+#include <string>
+
+#include "../misc.h"
+#include "nnue_architecture.h"
#include "nnue_feature_transformer.h"
-#include <memory>
+namespace Stockfish {
+ class Position;
+ enum Value : int;
+}
namespace Stockfish::Eval::NNUE {
#include "half_ka_v2_hm.h"
+#include "../../bitboard.h"
#include "../../position.h"
+#include "../../types.h"
+#include "../nnue_common.h"
namespace Stockfish::Eval::NNUE::Features {
#ifndef NNUE_FEATURES_HALF_KA_V2_HM_H_INCLUDED
#define NNUE_FEATURES_HALF_KA_V2_HM_H_INCLUDED
-#include "../nnue_common.h"
+#include <cstdint>
-#include "../../evaluate.h"
#include "../../misc.h"
+#include "../../types.h"
+#include "../nnue_common.h"
namespace Stockfish {
struct StateInfo;
+ class Position;
}
namespace Stockfish::Eval::NNUE::Features {
#ifndef NNUE_LAYERS_AFFINE_TRANSFORM_H_INCLUDED
#define NNUE_LAYERS_AFFINE_TRANSFORM_H_INCLUDED
+#include <cstdint>
#include <iostream>
-#include <algorithm>
-#include <type_traits>
+
#include "../nnue_common.h"
#include "simd.h"
#ifndef NNUE_LAYERS_AFFINE_TRANSFORM_SPARSE_INPUT_H_INCLUDED
#define NNUE_LAYERS_AFFINE_TRANSFORM_SPARSE_INPUT_H_INCLUDED
-#include <iostream>
#include <algorithm>
#include <array>
-#include <type_traits>
+#include <cstdint>
+#include <iostream>
+
+#include "../../bitboard.h"
#include "../nnue_common.h"
#include "affine_transform.h"
#include "simd.h"
#ifndef NNUE_LAYERS_CLIPPED_RELU_H_INCLUDED
#define NNUE_LAYERS_CLIPPED_RELU_H_INCLUDED
+#include <algorithm>
+#include <cstdint>
+#include <iosfwd>
+
#include "../nnue_common.h"
namespace Stockfish::Eval::NNUE::Layers {
#ifndef NNUE_LAYERS_SQR_CLIPPED_RELU_H_INCLUDED
#define NNUE_LAYERS_SQR_CLIPPED_RELU_H_INCLUDED
+#include <algorithm>
+#include <cstdint>
+#include <iosfwd>
+
#include "../nnue_common.h"
namespace Stockfish::Eval::NNUE::Layers {
#ifndef NNUE_ACCUMULATOR_H_INCLUDED
#define NNUE_ACCUMULATOR_H_INCLUDED
+#include <cstdint>
+
#include "nnue_architecture.h"
+#include "nnue_common.h"
namespace Stockfish::Eval::NNUE {
#ifndef NNUE_ARCHITECTURE_H_INCLUDED
#define NNUE_ARCHITECTURE_H_INCLUDED
-#include <memory>
-
-#include "nnue_common.h"
+#include <cstdint>
+#include <cstring>
+#include <iosfwd>
#include "features/half_ka_v2_hm.h"
-
-#include "layers/affine_transform_sparse_input.h"
#include "layers/affine_transform.h"
+#include "layers/affine_transform_sparse_input.h"
#include "layers/clipped_relu.h"
#include "layers/sqr_clipped_relu.h"
-
-#include "../misc.h"
+#include "nnue_common.h"
namespace Stockfish::Eval::NNUE {
#ifndef NNUE_COMMON_H_INCLUDED
#define NNUE_COMMON_H_INCLUDED
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
#include <cstring>
#include <iostream>
+#include <type_traits>
-#include "../misc.h" // for IsLittleEndian
+#include "../misc.h"
#if defined(USE_AVX2)
#include <immintrin.h>
#ifndef NNUE_FEATURE_TRANSFORMER_H_INCLUDED
#define NNUE_FEATURE_TRANSFORMER_H_INCLUDED
-#include "nnue_common.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdint>
+#include <cstring>
+#include <iosfwd>
+#include <utility>
+
+#include "../position.h"
+#include "../types.h"
+#include "nnue_accumulator.h"
#include "nnue_architecture.h"
-
-#include <cstring> // std::memset()
-#include <utility> // std::pair
+#include "nnue_common.h"
namespace Stockfish::Eval::NNUE {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "position.h"
+
#include <algorithm>
+#include <atomic>
#include <cassert>
-#include <cstddef> // For offsetof()
-#include <cstring> // For std::memset, std::memcmp
+#include <cctype>
+#include <cstddef>
+#include <cstring>
+#include <initializer_list>
#include <iomanip>
+#include <iostream>
#include <sstream>
#include <string_view>
+#include <utility>
#include "bitboard.h"
#include "misc.h"
#include "movegen.h"
-#include "position.h"
+#include "nnue/nnue_common.h"
+#include "syzygy/tbprobe.h"
#include "thread.h"
#include "tt.h"
#include "uci.h"
-#include "syzygy/tbprobe.h"
using std::string;
#include <cassert>
#include <deque>
-#include <memory> // For std::unique_ptr
+#include <iosfwd>
+#include <memory>
#include <string>
#include "bitboard.h"
-#include "evaluate.h"
-#include "types.h"
-
#include "nnue/nnue_accumulator.h"
+#include "types.h"
namespace Stockfish {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "search.h"
+
#include <algorithm>
+#include <array>
+#include <atomic>
#include <cassert>
#include <cmath>
-#include <cstring> // For std::memset
+#include <cstdlib>
+#include <cstring>
+#include <initializer_list>
#include <iostream>
#include <sstream>
+#include <string>
+#include <utility>
+#include "bitboard.h"
#include "evaluate.h"
#include "misc.h"
#include "movegen.h"
#include "movepick.h"
+#include "nnue/evaluate_nnue.h"
+#include "nnue/nnue_common.h"
#include "position.h"
-#include "search.h"
+#include "syzygy/tbprobe.h"
#include "thread.h"
#include "timeman.h"
#include "tt.h"
#include "uci.h"
-#include "syzygy/tbprobe.h"
-#include "nnue/evaluate_nnue.h"
namespace Stockfish {
// Decrease reduction if ttMove has been singularly extended (~1 Elo)
if (singularQuietLMR)
r--;
-
+
// Increase reduction on repetition (~1 Elo)
if ( move == (ss-4)->currentMove
&& pos.has_repeated())
#ifndef SEARCH_H_INCLUDED
#define SEARCH_H_INCLUDED
+#include <cstdint>
#include <vector>
#include "misc.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "tbprobe.h"
+
+#include <sys/stat.h>
#include <algorithm>
#include <atomic>
+#include <cassert>
#include <cstdint>
-#include <cstring> // For std::memset and std::memcpy
+#include <cstdlib>
+#include <cstring>
#include <deque>
#include <fstream>
+#include <initializer_list>
#include <iostream>
-#include <list>
#include <mutex>
#include <sstream>
#include <string_view>
#include <type_traits>
+#include <utility>
+#include <vector>
#include "../bitboard.h"
+#include "../misc.h"
#include "../movegen.h"
#include "../position.h"
#include "../search.h"
#include "../types.h"
#include "../uci.h"
-#include "tbprobe.h"
-
#ifndef _WIN32
#include <fcntl.h>
-#include <unistd.h>
#include <sys/mman.h>
-#include <sys/stat.h>
+#include <unistd.h>
#else
#define WIN32_LEAN_AND_MEAN
#ifndef NOMINMAX
// Starting from this we compute a base64[] table indexed by symbol length
// and containing 64 bit values so that d->base64[i] >= d->base64[i+1].
- // Implementation note: we first cast the unsigned size_t "base64.size()"
+ // Implementation note: we first cast the unsigned size_t "base64.size()"
// to a signed int "base64_size" variable and then we are able to subtract 2,
// avoiding unsigned overflow warnings.
#ifndef TBPROBE_H
#define TBPROBE_H
+#include <string>
+
#include "../search.h"
+namespace Stockfish {
+class Position;
+}
+
namespace Stockfish::Tablebases {
enum WDLScore {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <cassert>
+#include "thread.h"
-#include <algorithm> // For std::count
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <deque>
+#include <initializer_list>
+#include <map>
+#include <memory>
+#include <utility>
+
+#include "misc.h"
#include "movegen.h"
#include "search.h"
-#include "thread.h"
-#include "uci.h"
#include "syzygy/tbprobe.h"
#include "tt.h"
+#include "uci.h"
namespace Stockfish {
#include <atomic>
#include <condition_variable>
+#include <cstddef>
+#include <cstdint>
#include <mutex>
-#include <thread>
#include <vector>
#include "movepick.h"
#include "position.h"
#include "search.h"
#include "thread_win32_osx.h"
+#include "types.h"
namespace Stockfish {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "timeman.h"
+
#include <algorithm>
-#include <cfloat>
#include <cmath>
#include "search.h"
-#include "timeman.h"
#include "uci.h"
namespace Stockfish {
#ifndef TIMEMAN_H_INCLUDED
#define TIMEMAN_H_INCLUDED
+#include <cstdint>
+
#include "misc.h"
#include "search.h"
#include "thread.h"
+#include "types.h"
namespace Stockfish {
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <cstring> // For std::memset
+#include "tt.h"
+
+#include <cassert>
+#include <cstdlib>
+#include <cstring>
#include <iostream>
#include <thread>
+#include <vector>
-#include "bitboard.h"
#include "misc.h"
#include "thread.h"
-#include "tt.h"
#include "uci.h"
namespace Stockfish {
#ifndef TT_H_INCLUDED
#define TT_H_INCLUDED
+#include <cstddef>
+#include <cstdint>
+
#include "misc.h"
#include "types.h"
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "tune.h"
+
#include <algorithm>
#include <iostream>
+#include <map>
#include <sstream>
+#include <string>
-#include "types.h"
-#include "misc.h"
#include "uci.h"
+namespace Stockfish {
+enum Value : int;
+}
+
using std::string;
namespace Stockfish {
//
// Then paste the output below, as the function body
-#include <cmath>
namespace Stockfish {
#ifndef TUNE_H_INCLUDED
#define TUNE_H_INCLUDED
+#include <cstddef>
#include <memory>
#include <string>
#include <type_traits>
+#include <utility>
#include <vector>
namespace Stockfish {
+enum Value : int;
using Range = std::pair<int, int>; // Option's min-max values
using RangeFun = Range (int);
/// | only in 64-bit mode and requires hardware with pext support.
#include <cassert>
-#include <cctype>
#include <cstdint>
-#include <cstdlib>
-#include <algorithm>
#if defined(_MSC_VER)
// Disable some silly and noisy warning from MSVC compiler
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "uci.h"
+
+#include <algorithm>
#include <cassert>
+#include <cctype>
#include <cmath>
+#include <cstdint>
+#include <cstdlib>
+#include <deque>
#include <iostream>
+#include <memory>
+#include <optional>
#include <sstream>
#include <string>
+#include <vector>
#include "benchmark.h"
#include "evaluate.h"
+#include "misc.h"
#include "movegen.h"
+#include "nnue/evaluate_nnue.h"
#include "position.h"
#include "search.h"
#include "thread.h"
-#include "timeman.h"
-#include "tt.h"
-#include "uci.h"
-#include "syzygy/tbprobe.h"
-#include "nnue/evaluate_nnue.h"
using namespace std;
#ifndef UCI_H_INCLUDED
#define UCI_H_INCLUDED
+#include <cstddef>
+#include <iosfwd>
#include <map>
#include <string>
#include <algorithm>
#include <cassert>
+#include <cctype>
+#include <cstddef>
+#include <iosfwd>
+#include <istream>
+#include <map>
#include <ostream>
#include <sstream>
+#include <string>
#include "evaluate.h"
#include "misc.h"
#include "search.h"
+#include "syzygy/tbprobe.h"
#include "thread.h"
#include "tt.h"
+#include "types.h"
#include "uci.h"
-#include "syzygy/tbprobe.h"
using std::string;