├── third-party └── fmt │ ├── support │ ├── bazel │ │ ├── .bazelversion │ │ ├── WORKSPACE.bazel │ │ ├── BUILD.bazel │ │ └── README.md │ ├── AndroidManifest.xml │ ├── rtd │ │ ├── theme │ │ │ ├── theme.conf │ │ │ └── layout.html │ │ ├── index.rst │ │ └── conf.py │ ├── README │ ├── cmake │ │ ├── fmt-config.cmake.in │ │ ├── fmt.pc.in │ │ ├── FindSetEnv.cmake │ │ └── JoinPaths.cmake │ ├── Android.mk │ ├── Vagrantfile │ ├── compute-powers.py │ └── build-docs.py │ ├── doc │ ├── basic-bootstrap │ │ ├── theme.conf │ │ └── README │ ├── html │ │ ├── objects.inv │ │ ├── _static │ │ │ ├── file.png │ │ │ ├── minus.png │ │ │ ├── plus.png │ │ │ ├── fonts │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ └── glyphicons-halflings-regular.woff │ │ │ └── documentation_options.js │ │ └── _sources │ │ │ └── contents.rst.txt │ ├── contents.rst │ ├── _static │ │ └── fonts │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ └── glyphicons-halflings-regular.woff │ ├── bootstrap │ │ ├── mixins │ │ │ ├── center-block.less │ │ │ ├── text-emphasis.less │ │ │ ├── size.less │ │ │ ├── background-variant.less │ │ │ ├── opacity.less │ │ │ ├── text-overflow.less │ │ │ ├── tab-focus.less │ │ │ ├── resize.less │ │ │ ├── labels.less │ │ │ ├── progress-bar.less │ │ │ ├── nav-divider.less │ │ │ ├── reset-filter.less │ │ │ ├── alerts.less │ │ │ ├── nav-vertical-align.less │ │ │ ├── responsive-visibility.less │ │ │ ├── pagination.less │ │ │ ├── border-radius.less │ │ │ ├── panels.less │ │ │ ├── list-group.less │ │ │ ├── hide-text.less │ │ │ ├── clearfix.less │ │ │ ├── table-row.less │ │ │ ├── image.less │ │ │ ├── buttons.less │ │ │ ├── forms.less │ │ │ └── grid-framework.less │ │ ├── wells.less │ │ ├── breadcrumbs.less │ │ ├── responsive-embed.less │ │ ├── component-animations.less │ │ ├── close.less │ │ ├── thumbnails.less │ │ ├── utilities.less │ │ ├── media.less │ │ ├── pager.less │ │ ├── jumbotron.less │ │ ├── mixins.less │ │ ├── bootstrap.less │ │ ├── labels.less │ │ ├── badges.less │ │ ├── code.less │ │ ├── grid.less │ │ ├── alerts.less │ │ ├── progress-bars.less │ │ ├── pagination.less │ │ ├── print.less │ │ ├── tooltip.less │ │ └── list-group.less │ ├── CMakeLists.txt │ ├── fmt.less │ └── _templates │ │ └── search.html │ ├── test │ ├── gtest │ │ ├── .clang-format │ │ └── CMakeLists.txt │ ├── static-export-test │ │ ├── main.cc │ │ ├── library.cc │ │ └── CMakeLists.txt │ ├── add-subdirectory-test │ │ ├── main.cc │ │ └── CMakeLists.txt │ ├── find-package-test │ │ ├── main.cc │ │ └── CMakeLists.txt │ ├── header-only-test.cc │ ├── cuda-test │ │ ├── cpp14.cc │ │ ├── cuda-cpp14.cu │ │ └── CMakeLists.txt │ ├── noexception-test.cc │ ├── ranges-odr-test.cc │ ├── detect-stdfs.cc │ ├── fuzzing │ │ ├── main.cc │ │ ├── README.md │ │ ├── chrono-timepoint.cc │ │ ├── CMakeLists.txt │ │ ├── float.cc │ │ ├── one-arg.cc │ │ ├── build.sh │ │ ├── fuzzer-common.h │ │ ├── named-arg.cc │ │ └── two-args.cc │ ├── assert-test.cc │ ├── test-assert.h │ ├── test-main.cc │ ├── unicode-test.cc │ ├── util.cc │ ├── mock-allocator.h │ ├── posix-mock.h │ ├── enforce-checks-test.cc │ ├── gtest-extra.cc │ ├── util.h │ ├── compile-fp-test.cc │ └── color-test.cc │ ├── .clang-format │ ├── CONTRIBUTING.md │ ├── src │ ├── format.cc │ └── fmt.cc │ └── LICENSE ├── .editorconfig ├── src ├── magics │ ├── entry.h │ ├── magic_finder.h │ └── attacks.h ├── utils │ ├── time.h │ ├── fused.h │ ├── random.h │ ├── string.h │ ├── list.h │ ├── barrier.h │ └── zobrist.h ├── data_gen │ ├── format │ │ ├── format.h │ │ └── fens.h │ └── data_gen.h ├── engine │ ├── search │ │ ├── history │ │ │ ├── continuation_entries.h │ │ │ ├── bonus.h │ │ │ ├── pawn_history.h │ │ │ ├── quiet_history.h │ │ │ ├── capture_history.h │ │ │ ├── history.h │ │ │ └── continuation_history.h │ │ ├── syzygy │ │ │ ├── syzygy.h │ │ │ └── syzygy.cc │ │ ├── cuckoo.h │ │ ├── move_picker.h │ │ ├── cuckoo.cc │ │ ├── transpo.cc │ │ └── transpo.h │ ├── evaluation │ │ ├── nnue │ │ │ └── nnue.h │ │ └── evaluation.h │ └── uci │ │ └── uci.h ├── ascii_logo.h ├── tests │ └── tests.h ├── main.cc ├── chess │ ├── fen.h │ ├── move_gen.h │ ├── move.h │ └── move.cc └── tuner │ └── spsa.h ├── README.md ├── shared └── nnue │ └── definitions.h ├── preprocess └── CMakeLists.txt ├── Makefile └── .gitignore /third-party/fmt/support/bazel/.bazelversion: -------------------------------------------------------------------------------- 1 | 6.1.2 2 | -------------------------------------------------------------------------------- /third-party/fmt/support/bazel/WORKSPACE.bazel: -------------------------------------------------------------------------------- 1 | workspace(name = "fmt") 2 | -------------------------------------------------------------------------------- /third-party/fmt/doc/basic-bootstrap/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | -------------------------------------------------------------------------------- /third-party/fmt/support/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /third-party/fmt/support/rtd/theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{cc,h}] 4 | indent_size = 2 5 | indent_style = space -------------------------------------------------------------------------------- /third-party/fmt/test/gtest/.clang-format: -------------------------------------------------------------------------------- 1 | # Disable clang-format here 2 | DisableFormat: true 3 | SortIncludes: Never 4 | -------------------------------------------------------------------------------- /third-party/fmt/doc/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/objects.inv -------------------------------------------------------------------------------- /third-party/fmt/support/README: -------------------------------------------------------------------------------- 1 | This directory contains build support files such as 2 | 3 | * CMake modules 4 | * Build scripts 5 | -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/file.png -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/minus.png -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/plus.png -------------------------------------------------------------------------------- /third-party/fmt/support/rtd/index.rst: -------------------------------------------------------------------------------- 1 | If you are not redirected automatically, follow the 2 | `link to the fmt documentation `_. 3 | -------------------------------------------------------------------------------- /third-party/fmt/doc/contents.rst: -------------------------------------------------------------------------------- 1 | ######## 2 | Contents 3 | ######## 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | usage 9 | api 10 | syntax 11 | -------------------------------------------------------------------------------- /third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/_static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_sources/contents.rst.txt: -------------------------------------------------------------------------------- 1 | ######## 2 | Contents 3 | ######## 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | 8 | usage 9 | api 10 | syntax 11 | -------------------------------------------------------------------------------- /third-party/fmt/support/rtd/conf.py: -------------------------------------------------------------------------------- 1 | # Sphinx configuration for readthedocs. 2 | 3 | import os, sys 4 | 5 | master_doc = 'index' 6 | html_theme = 'theme' 7 | html_theme_path = ["."] 8 | -------------------------------------------------------------------------------- /third-party/fmt/test/static-export-test/main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern std::string foo(); 5 | 6 | int main() { std::cout << foo() << std::endl; } 7 | -------------------------------------------------------------------------------- /third-party/fmt/doc/basic-bootstrap/README: -------------------------------------------------------------------------------- 1 | Sphinx basic theme with Bootstrap support. Modifications are kept to 2 | a minimum to simplify integration in case of changes to Sphinx theming. 3 | -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aronpetko/integral/HEAD/third-party/fmt/doc/html/_static/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /third-party/fmt/test/add-subdirectory-test/main.cc: -------------------------------------------------------------------------------- 1 | #include "fmt/core.h" 2 | 3 | int main(int argc, char** argv) { 4 | for (int i = 0; i < argc; ++i) fmt::print("{}: {}\n", i, argv[i]); 5 | } 6 | -------------------------------------------------------------------------------- /third-party/fmt/test/find-package-test/main.cc: -------------------------------------------------------------------------------- 1 | #include "fmt/format.h" 2 | 3 | int main(int argc, char** argv) { 4 | for (int i = 0; i < argc; ++i) fmt::print("{}: {}\n", i, argv[i]); 5 | } 6 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/center-block.less: -------------------------------------------------------------------------------- 1 | // Center-align a block level element 2 | 3 | .center-block() { 4 | display: block; 5 | margin-left: auto; 6 | margin-right: auto; 7 | } 8 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/text-emphasis.less: -------------------------------------------------------------------------------- 1 | // Typography 2 | 3 | .text-emphasis-variant(@color) { 4 | color: @color; 5 | a&:hover { 6 | color: darken(@color, 10%); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fmt/test/static-export-test/library.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | __attribute__((visibility("default"))) std::string foo() { 4 | return fmt::format(FMT_COMPILE("foo bar {}"), 4242); 5 | } 6 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/size.less: -------------------------------------------------------------------------------- 1 | // Sizing shortcuts 2 | 3 | .size(@width; @height) { 4 | width: @width; 5 | height: @height; 6 | } 7 | 8 | .square(@size) { 9 | .size(@size; @size); 10 | } 11 | -------------------------------------------------------------------------------- /third-party/fmt/support/cmake/fmt-config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | 3 | if (NOT TARGET fmt::fmt) 4 | include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake) 5 | endif () 6 | 7 | check_required_components(fmt) 8 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/background-variant.less: -------------------------------------------------------------------------------- 1 | // Contextual backgrounds 2 | 3 | .bg-variant(@color) { 4 | background-color: @color; 5 | a&:hover { 6 | background-color: darken(@color, 10%); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/opacity.less: -------------------------------------------------------------------------------- 1 | // Opacity 2 | 3 | .opacity(@opacity) { 4 | opacity: @opacity; 5 | // IE8 filter 6 | @opacity-ie: (@opacity * 100); 7 | filter: ~"alpha(opacity=@{opacity-ie})"; 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/text-overflow.less: -------------------------------------------------------------------------------- 1 | // Text overflow 2 | // Requires inline-block or block for proper styling 3 | 4 | .text-overflow() { 5 | overflow: hidden; 6 | text-overflow: ellipsis; 7 | white-space: nowrap; 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/tab-focus.less: -------------------------------------------------------------------------------- 1 | // WebKit-style focus 2 | 3 | .tab-focus() { 4 | // Default 5 | outline: thin dotted; 6 | // WebKit 7 | outline: 5px auto -webkit-focus-ring-color; 8 | outline-offset: -2px; 9 | } 10 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/resize.less: -------------------------------------------------------------------------------- 1 | // Resize anything 2 | 3 | .resizable(@direction) { 4 | resize: @direction; // Options: horizontal, vertical, both 5 | overflow: auto; // Per CSS3 UI, `resize` only applies when `overflow` isn't `visible` 6 | } 7 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/labels.less: -------------------------------------------------------------------------------- 1 | // Labels 2 | 3 | .label-variant(@color) { 4 | background-color: @color; 5 | 6 | &[href] { 7 | &:hover, 8 | &:focus { 9 | background-color: darken(@color, 10%); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /third-party/fmt/.clang-format: -------------------------------------------------------------------------------- 1 | # Run manually to reformat a file: 2 | # clang-format -i --style=file 3 | Language: Cpp 4 | BasedOnStyle: Google 5 | IndentPPDirectives: AfterHash 6 | IndentCaseLabels: false 7 | AlwaysBreakTemplateDeclarations: false 8 | DerivePointerAlignment: false 9 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/progress-bar.less: -------------------------------------------------------------------------------- 1 | // Progress bars 2 | 3 | .progress-bar-variant(@color) { 4 | background-color: @color; 5 | 6 | // Deprecated parent class requirement as of v3.2.0 7 | .progress-striped & { 8 | #gradient > .striped(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/magics/entry.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_MAGICS_ENTRY_H_ 2 | #define INTEGRAL_MAGICS_ENTRY_H_ 3 | 4 | #include "../chess/bitboard.h" 5 | 6 | namespace magics { 7 | 8 | struct MagicEntry { 9 | U64 mask; 10 | U64 magic; 11 | int shift; 12 | }; 13 | 14 | } // namespace magics 15 | 16 | #endif // INTEGRAL_MAGICS_ENTRY_H_ -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/nav-divider.less: -------------------------------------------------------------------------------- 1 | // Horizontal dividers 2 | // 3 | // Dividers (basically an hr) within dropdowns and nav lists 4 | 5 | .nav-divider(@color: #e5e5e5) { 6 | height: 1px; 7 | margin: ((@line-height-computed / 2) - 1) 0; 8 | overflow: hidden; 9 | background-color: @color; 10 | } 11 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/reset-filter.less: -------------------------------------------------------------------------------- 1 | // Reset filters for IE 2 | // 3 | // When you need to remove a gradient background, do not forget to use this to reset 4 | // the IE filter for IE9 and below. 5 | 6 | .reset-filter() { 7 | filter: e(%("progid:DXImageTransform.Microsoft.gradient(enabled = false)")); 8 | } 9 | -------------------------------------------------------------------------------- /third-party/fmt/test/header-only-test.cc: -------------------------------------------------------------------------------- 1 | // Header-only configuration test 2 | 3 | #include "fmt/core.h" 4 | #include "fmt/ostream.h" 5 | #include "gtest/gtest.h" 6 | 7 | #ifndef FMT_HEADER_ONLY 8 | # error "Not in the header-only mode." 9 | #endif 10 | 11 | TEST(header_only_test, format) { EXPECT_EQ(fmt::format("foo"), "foo"); } 12 | -------------------------------------------------------------------------------- /third-party/fmt/support/cmake/fmt.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@CMAKE_INSTALL_PREFIX@ 2 | exec_prefix=@CMAKE_INSTALL_PREFIX@ 3 | libdir=@libdir_for_pc_file@ 4 | includedir=@includedir_for_pc_file@ 5 | 6 | Name: fmt 7 | Description: A modern formatting library 8 | Version: @FMT_VERSION@ 9 | Libs: -L${libdir} -l@FMT_LIB_NAME@ 10 | Cflags: -I${includedir} 11 | 12 | -------------------------------------------------------------------------------- /third-party/fmt/support/cmake/FindSetEnv.cmake: -------------------------------------------------------------------------------- 1 | # A CMake script to find SetEnv.cmd. 2 | 3 | find_program(WINSDK_SETENV NAMES SetEnv.cmd 4 | PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/bin") 5 | if (WINSDK_SETENV AND PRINT_PATH) 6 | execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${WINSDK_SETENV}") 7 | endif () 8 | -------------------------------------------------------------------------------- /src/magics/magic_finder.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_MAGICS_MAGIC_FINDER_H_ 2 | #define INTEGRAL_MAGICS_MAGIC_FINDER_H_ 3 | 4 | #include "entry.h" 5 | 6 | namespace magics::finder { 7 | 8 | MagicEntry FindMagic(PieceType piece_type, Square square); 9 | 10 | void GenerateMagics(); 11 | 12 | } // namespace magics::finder 13 | 14 | #endif // INTEGRAL_MAGICS_MAGIC_FINDER_H_ -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/alerts.less: -------------------------------------------------------------------------------- 1 | // Alerts 2 | 3 | .alert-variant(@background; @border; @text-color) { 4 | background-color: @background; 5 | border-color: @border; 6 | color: @text-color; 7 | 8 | hr { 9 | border-top-color: darken(@border, 5%); 10 | } 11 | .alert-link { 12 | color: darken(@text-color, 10%); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /third-party/fmt/support/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | include $(CLEAR_VARS) 3 | 4 | LOCAL_MODULE := fmt_static 5 | LOCAL_MODULE_FILENAME := libfmt 6 | 7 | LOCAL_SRC_FILES := ../src/format.cc 8 | 9 | LOCAL_C_INCLUDES := $(LOCAL_PATH) 10 | LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) 11 | 12 | LOCAL_CFLAGS += -std=c++11 -fexceptions 13 | 14 | include $(BUILD_STATIC_LIBRARY) 15 | 16 | -------------------------------------------------------------------------------- /src/utils/time.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_TIME_H 2 | #define INTEGRAL_TIME_H 3 | 4 | #include 5 | 6 | #include "types.h" 7 | 8 | using TimeStamp = I64; 9 | 10 | [[nodiscard]] static U64 GetCurrentTime() { 11 | const auto duration = std::chrono::high_resolution_clock ::now().time_since_epoch(); 12 | return std::chrono::duration_cast(duration) 13 | .count(); 14 | } 15 | 16 | #endif // INTEGRAL_TIME_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/nav-vertical-align.less: -------------------------------------------------------------------------------- 1 | // Navbar vertical align 2 | // 3 | // Vertically center elements in the navbar. 4 | // Example: an element has a height of 30px, so write out `.navbar-vertical-align(30px);` to calculate the appropriate top margin. 5 | 6 | .navbar-vertical-align(@element-height) { 7 | margin-top: ((@navbar-height - @element-height) / 2); 8 | margin-bottom: ((@navbar-height - @element-height) / 2); 9 | } 10 | -------------------------------------------------------------------------------- /third-party/fmt/doc/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '10.2.0', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | BUILDER: 'html', 7 | FILE_SUFFIX: '.html', 8 | LINK_SUFFIX: '.html', 9 | HAS_SOURCE: true, 10 | SOURCELINK_SUFFIX: '.txt', 11 | NAVIGATION_WITH_KEYS: false 12 | }; -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/responsive-visibility.less: -------------------------------------------------------------------------------- 1 | // Responsive utilities 2 | 3 | // 4 | // More easily include all the states for responsive-utilities.less. 5 | .responsive-visibility() { 6 | display: block !important; 7 | table& { display: table; } 8 | tr& { display: table-row !important; } 9 | th&, 10 | td& { display: table-cell !important; } 11 | } 12 | 13 | .responsive-invisibility() { 14 | display: none !important; 15 | } 16 | -------------------------------------------------------------------------------- /src/data_gen/format/format.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_FORMAT_H 2 | #define INTEGRAL_FORMAT_H 3 | 4 | #include "../../chess/board.h" 5 | 6 | namespace data_gen::format { 7 | 8 | class OutputFormatter { 9 | public: 10 | virtual void SetPosition(const BoardState& state) = 0; 11 | 12 | virtual void PushMove(Move move, Color turn, Score score) = 0; 13 | 14 | virtual U64 WriteOutcome(double wdl_outcome) = 0; 15 | }; 16 | 17 | } // namespace data_gen::format 18 | 19 | #endif // INTEGRAL_FORMAT_H -------------------------------------------------------------------------------- /third-party/fmt/test/cuda-test/cpp14.cc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // The purpose of this part is to ensure NVCC's host compiler also supports 4 | // the standard version. See 'cuda-cpp14.cu'. 5 | // 6 | // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros 7 | static_assert(__cplusplus >= 201402L, "expect C++ 2014 for host compiler"); 8 | 9 | auto make_message_cpp() -> std::string { 10 | return fmt::format("host compiler \t: __cplusplus == {}", __cplusplus); 11 | } 12 | -------------------------------------------------------------------------------- /src/engine/search/history/continuation_entries.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_CONTINUATION_ENTRIES_H 2 | #define INTEGRAL_CONTINUATION_ENTRIES_H 3 | 4 | #include "../../../../shared/multi_array.h" 5 | #include "../../../utils/types.h" 6 | 7 | namespace search::history { 8 | 9 | using ContinuationEntry = 10 | MultiArray; 11 | 12 | using ContinuationCorrectionEntry = 13 | MultiArray; 14 | 15 | } 16 | 17 | #endif // INTEGRAL_CONTINUATION_ENTRIES_H -------------------------------------------------------------------------------- /src/engine/evaluation/nnue/nnue.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_NNUE_H 2 | #define INTEGRAL_NNUE_H 3 | 4 | #include "../../../../shared/multi_array.h" 5 | #include "../../../../shared/nnue/definitions.h" 6 | #include "../../../../shared/simd.h" 7 | #include "../../../chess/board.h" 8 | #include "../../../utils/types.h" 9 | 10 | namespace nnue { 11 | 12 | inline Network* network = nullptr; 13 | 14 | class Accumulator; 15 | 16 | void LoadFromIncBin(); 17 | 18 | Score Evaluate(Board& board); 19 | 20 | } // namespace nnue 21 | 22 | #endif // INTEGRAL_NNUE_H -------------------------------------------------------------------------------- /third-party/fmt/test/noexception-test.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - Noexception tests 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "fmt/args.h" 9 | #include "fmt/chrono.h" 10 | #include "fmt/color.h" 11 | #include "fmt/compile.h" 12 | #include "fmt/core.h" 13 | #include "fmt/format.h" 14 | #include "fmt/os.h" 15 | #include "fmt/ostream.h" 16 | #include "fmt/printf.h" 17 | #include "fmt/ranges.h" 18 | #include "fmt/xchar.h" 19 | -------------------------------------------------------------------------------- /src/ascii_logo.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_ASCII_LOGO_H 2 | #define INTEGRAL_ASCII_LOGO_H 3 | 4 | #include 5 | #include 6 | 7 | // clang-format off 8 | constexpr std::string_view kIntegralAsciiLogo = 9 | R"( 10 | πππ 11 | ππ ππ 12 | ππ 13 | ππ 14 | ππ 15 | ππ ππ 16 | πππ 17 | )"; 18 | // clang-format on 19 | 20 | inline void PrintAsciiLogo() { 21 | fmt::println("{}", kIntegralAsciiLogo); 22 | } 23 | 24 | #endif // INTEGRAL_ASCII_LOGO_H -------------------------------------------------------------------------------- /third-party/fmt/test/ranges-odr-test.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - the core API 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include 9 | 10 | #include "fmt/ranges.h" 11 | #include "gtest/gtest.h" 12 | 13 | // call fmt::format from another translation unit to test ODR 14 | TEST(ranges_odr_test, format_vector) { 15 | auto v = std::vector{1, 2, 3, 5, 7, 11}; 16 | EXPECT_EQ(fmt::format("{}", v), "[1, 2, 3, 5, 7, 11]"); 17 | } 18 | -------------------------------------------------------------------------------- /src/tests/tests.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_TESTS_H 2 | #define INTEGRAL_TESTS_H 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "../utils/string.h" 12 | 13 | class Board; 14 | class Search; 15 | 16 | namespace tests { 17 | 18 | constexpr int kDefaultBenchDepth = 12; 19 | 20 | void BenchSuite(int depth); 21 | 22 | void SEESuite(); 23 | 24 | void PerftSuite(); 25 | 26 | void Perft(Board &board, int depth); 27 | 28 | } // namespace tests 29 | 30 | #endif // INTEGRAL_TESTS_H -------------------------------------------------------------------------------- /src/engine/search/syzygy/syzygy.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_SYZYGY_H 2 | #define INTEGRAL_SYZYGY_H 3 | 4 | #include 5 | 6 | #include "../../../chess/board.h" 7 | 8 | namespace syzygy { 9 | 10 | inline std::atomic enabled = false; 11 | inline std::atomic probe_depth = 0; 12 | 13 | enum class ProbeResult { 14 | kFailed, 15 | kWin, 16 | kDraw, 17 | kLoss 18 | }; 19 | 20 | void SetPath(std::string_view path); 21 | 22 | void Free(); 23 | 24 | ProbeResult ProbePosition(const BoardState &state); 25 | 26 | } // namespace syzygy 27 | 28 | #endif // INTEGRAL_SYZYGY_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/pagination.less: -------------------------------------------------------------------------------- 1 | // Pagination 2 | 3 | .pagination-size(@padding-vertical; @padding-horizontal; @font-size; @border-radius) { 4 | > li { 5 | > a, 6 | > span { 7 | padding: @padding-vertical @padding-horizontal; 8 | font-size: @font-size; 9 | } 10 | &:first-child { 11 | > a, 12 | > span { 13 | .border-left-radius(@border-radius); 14 | } 15 | } 16 | &:last-child { 17 | > a, 18 | > span { 19 | .border-right-radius(@border-radius); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/border-radius.less: -------------------------------------------------------------------------------- 1 | // Single side border-radius 2 | 3 | .border-top-radius(@radius) { 4 | border-top-right-radius: @radius; 5 | border-top-left-radius: @radius; 6 | } 7 | .border-right-radius(@radius) { 8 | border-bottom-right-radius: @radius; 9 | border-top-right-radius: @radius; 10 | } 11 | .border-bottom-radius(@radius) { 12 | border-bottom-right-radius: @radius; 13 | border-bottom-left-radius: @radius; 14 | } 15 | .border-left-radius(@radius) { 16 | border-bottom-left-radius: @radius; 17 | border-top-left-radius: @radius; 18 | } 19 | -------------------------------------------------------------------------------- /third-party/fmt/support/rtd/theme/layout.html: -------------------------------------------------------------------------------- 1 | {% extends "basic/layout.html" %} 2 | 3 | {% block extrahead %} 4 | 5 | 6 | 9 | Page Redirection 10 | {% endblock %} 11 | 12 | {% block document %} 13 | If you are not redirected automatically, follow the link to the fmt documentation. 14 | {% endblock %} 15 | 16 | {% block footer %} 17 | {% endblock %} 18 | -------------------------------------------------------------------------------- /src/engine/search/cuckoo.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_CUCKOO_H 2 | #define INTEGRAL_CUCKOO_H 3 | 4 | #include "../../chess/move_gen.h" 5 | #include "../../utils/types.h" 6 | #include "../../utils/zobrist.h" 7 | 8 | namespace search::cuckoo { 9 | 10 | inline std::array keys; 11 | inline std::array moves; 12 | 13 | constexpr U64 H1(U64 key) { 14 | return static_cast(key & 0x1FFF); 15 | } 16 | 17 | constexpr U64 H2(U64 key) { 18 | return static_cast((key >> 16) & 0x1FFF); 19 | } 20 | 21 | void Initialize(); 22 | 23 | } // namespace search::cuckoo 24 | 25 | #endif // INTEGRAL_CUCKOO_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/panels.less: -------------------------------------------------------------------------------- 1 | // Panels 2 | 3 | .panel-variant(@border; @heading-text-color; @heading-bg-color; @heading-border) { 4 | border-color: @border; 5 | 6 | & > .panel-heading { 7 | color: @heading-text-color; 8 | background-color: @heading-bg-color; 9 | border-color: @heading-border; 10 | 11 | + .panel-collapse > .panel-body { 12 | border-top-color: @border; 13 | } 14 | .badge { 15 | color: @heading-bg-color; 16 | background-color: @heading-text-color; 17 | } 18 | } 19 | & > .panel-footer { 20 | + .panel-collapse > .panel-body { 21 | border-bottom-color: @border; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @well-bg; 12 | border: 1px solid @well-border; 13 | border-radius: @border-radius-base; 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-lg { 23 | padding: 24px; 24 | border-radius: @border-radius-large; 25 | } 26 | .well-sm { 27 | padding: 9px; 28 | border-radius: @border-radius-small; 29 | } 30 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/list-group.less: -------------------------------------------------------------------------------- 1 | // List Groups 2 | 3 | .list-group-item-variant(@state; @background; @color) { 4 | .list-group-item-@{state} { 5 | color: @color; 6 | background-color: @background; 7 | 8 | a& { 9 | color: @color; 10 | 11 | .list-group-item-heading { 12 | color: inherit; 13 | } 14 | 15 | &:hover, 16 | &:focus { 17 | color: @color; 18 | background-color: darken(@background, 5%); 19 | } 20 | &.active, 21 | &.active:hover, 22 | &.active:focus { 23 | color: #fff; 24 | background-color: @color; 25 | border-color: @color; 26 | } 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /third-party/fmt/test/find-package-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8...3.25) 2 | 3 | project(fmt-test) 4 | 5 | find_package(FMT REQUIRED) 6 | 7 | add_executable(library-test main.cc) 8 | target_link_libraries(library-test fmt::fmt) 9 | target_compile_options(library-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) 10 | target_include_directories(library-test PUBLIC SYSTEM .) 11 | 12 | if (TARGET fmt::fmt-header-only) 13 | add_executable(header-only-test main.cc) 14 | target_link_libraries(header-only-test fmt::fmt-header-only) 15 | target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) 16 | target_include_directories(header-only-test PUBLIC SYSTEM .) 17 | endif () 18 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/hide-text.less: -------------------------------------------------------------------------------- 1 | // CSS image replacement 2 | // 3 | // Heads up! v3 launched with with only `.hide-text()`, but per our pattern for 4 | // mixins being reused as classes with the same name, this doesn't hold up. As 5 | // of v3.0.1 we have added `.text-hide()` and deprecated `.hide-text()`. 6 | // 7 | // Source: https://github.com/h5bp/html5-boilerplate/commit/aa0396eae757 8 | 9 | // Deprecated as of v3.0.1 (will be removed in v4) 10 | .hide-text() { 11 | font: ~"0/0" a; 12 | color: transparent; 13 | text-shadow: none; 14 | background-color: transparent; 15 | border: 0; 16 | } 17 | 18 | // New mixin to use as of v3.0.1 19 | .text-hide() { 20 | .hide-text(); 21 | } 22 | -------------------------------------------------------------------------------- /third-party/fmt/support/Vagrantfile: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | # A vagrant config for testing against gcc-4.8. 5 | Vagrant.configure("2") do |config| 6 | config.vm.box = "ubuntu/xenial64" 7 | config.disksize.size = '15GB' 8 | 9 | config.vm.provider "virtualbox" do |vb| 10 | vb.memory = "4096" 11 | end 12 | 13 | config.vm.provision "shell", inline: <<-SHELL 14 | apt-get update 15 | apt-get install -y g++ make wget git 16 | wget -q https://github.com/Kitware/CMake/releases/download/v3.26.0/cmake-3.26.0-Linux-x86_64.tar.gz 17 | tar xzf cmake-3.26.0-Linux-x86_64.tar.gz 18 | ln -s `pwd`/cmake-3.26.0-Linux-x86_64/bin/cmake /usr/local/bin 19 | SHELL 20 | end 21 | -------------------------------------------------------------------------------- /third-party/fmt/test/add-subdirectory-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8...3.25) 2 | 3 | project(fmt-test CXX) 4 | 5 | add_subdirectory(../.. fmt) 6 | 7 | add_executable(library-test main.cc) 8 | target_include_directories(library-test PUBLIC SYSTEM .) 9 | target_compile_options(library-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) 10 | target_link_libraries(library-test fmt::fmt) 11 | 12 | if (TARGET fmt::fmt-header-only) 13 | add_executable(header-only-test main.cc) 14 | target_include_directories(header-only-test PUBLIC SYSTEM .) 15 | target_compile_options(header-only-test PRIVATE ${PEDANTIC_COMPILE_FLAGS}) 16 | target_link_libraries(header-only-test fmt::fmt-header-only) 17 | endif () 18 | -------------------------------------------------------------------------------- /third-party/fmt/test/detect-stdfs.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - tests of formatters for standard library types 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include // _GLIBCXX_RELEASE & _LIBCPP_VERSION 9 | 10 | #if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE == 8 11 | # error libfound "stdc++fs" 12 | #elif !defined(__apple_build_version__) && defined(_LIBCPP_VERSION) && \ 13 | _LIBCPP_VERSION >= 7000 && _LIBCPP_VERSION < 9000 14 | # error libfound "c++fs" 15 | #else 16 | // none if std::filesystem does not require additional libraries 17 | # error libfound "" 18 | #endif 19 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/main.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "fuzzer-common.h" 6 | 7 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); 8 | 9 | int main(int argc, char** argv) { 10 | for (int i = 1; i < argc; ++i) { 11 | std::ifstream in(argv[i]); 12 | assert(in); 13 | in.seekg(0, std::ios_base::end); 14 | const auto size = in.tellg(); 15 | assert(size >= 0); 16 | in.seekg(0, std::ios_base::beg); 17 | std::vector buf(static_cast(size)); 18 | in.read(buf.data(), size); 19 | assert(in.gcount() == size); 20 | LLVMFuzzerTestOneInput(as_bytes(buf.data()), buf.size()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/clearfix.less: -------------------------------------------------------------------------------- 1 | // Clearfix 2 | // 3 | // For modern browsers 4 | // 1. The space content is one way to avoid an Opera bug when the 5 | // contenteditable attribute is included anywhere else in the document. 6 | // Otherwise it causes space to appear at the top and bottom of elements 7 | // that are clearfixed. 8 | // 2. The use of `table` rather than `block` is only necessary if using 9 | // `:before` to contain the top-margins of child elements. 10 | // 11 | // Source: http://nicolasgallagher.com/micro-clearfix-hack/ 12 | 13 | .clearfix() { 14 | &:before, 15 | &:after { 16 | content: " "; // 1 17 | display: table; // 2 18 | } 19 | &:after { 20 | clear: both; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: @breadcrumb-padding-vertical @breadcrumb-padding-horizontal; 8 | margin-bottom: @line-height-computed; 9 | list-style: none; 10 | background-color: @breadcrumb-bg; 11 | border-radius: @border-radius-base; 12 | 13 | > li { 14 | display: inline-block; 15 | 16 | + li:before { 17 | content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space 18 | padding: 0 5px; 19 | color: @breadcrumb-color; 20 | } 21 | } 22 | 23 | > .active { 24 | color: @breadcrumb-active-color; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/responsive-embed.less: -------------------------------------------------------------------------------- 1 | // Embeds responsive 2 | // 3 | // Credit: Nicolas Gallagher and SUIT CSS. 4 | 5 | .embed-responsive { 6 | position: relative; 7 | display: block; 8 | height: 0; 9 | padding: 0; 10 | overflow: hidden; 11 | 12 | .embed-responsive-item, 13 | iframe, 14 | embed, 15 | object, 16 | video { 17 | position: absolute; 18 | top: 0; 19 | left: 0; 20 | bottom: 0; 21 | height: 100%; 22 | width: 100%; 23 | border: 0; 24 | } 25 | } 26 | 27 | // Modifier class for 16:9 aspect ratio 28 | .embed-responsive-16by9 { 29 | padding-bottom: 56.25%; 30 | } 31 | 32 | // Modifier class for 4:3 aspect ratio 33 | .embed-responsive-4by3 { 34 | padding-bottom: 75%; 35 | } 36 | -------------------------------------------------------------------------------- /src/main.cc: -------------------------------------------------------------------------------- 1 | #include "engine/evaluation/nnue/nnue.h" 2 | #include "engine/search/cuckoo.h" 3 | #include "engine/uci/uci.h" 4 | #ifdef _WIN32 5 | #include 6 | #endif 7 | 8 | int main(int arg_count, char **args) { 9 | // Change output buffer size 10 | setvbuf(stdout, nullptr, _IONBF, 0); 11 | 12 | #ifdef _WIN32 13 | // Enable ANSI escape codes 14 | const auto stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); 15 | 16 | DWORD console_mode = 0; 17 | GetConsoleMode(stdout_handle, &console_mode); 18 | 19 | console_mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; 20 | SetConsoleMode(stdout_handle, console_mode); 21 | #endif 22 | 23 | nnue::LoadFromIncBin(); 24 | 25 | search::cuckoo::Initialize(); 26 | 27 | uci::AcceptCommands(arg_count, args); 28 | } -------------------------------------------------------------------------------- /third-party/fmt/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing to {fmt} 2 | ===================== 3 | 4 | By submitting a pull request or a patch, you represent that you have the right 5 | to license your contribution to the {fmt} project owners and the community, 6 | agree that your contributions are licensed under the {fmt} license, and agree 7 | to future changes to the licensing. 8 | 9 | All C++ code must adhere to [Google C++ Style Guide]( 10 | https://google.github.io/styleguide/cppguide.html) with the following 11 | exceptions: 12 | 13 | * Exceptions are permitted 14 | * snake_case should be used instead of UpperCamelCase for function and type 15 | names 16 | 17 | All documentation must adhere to the [Google Developer Documentation Style 18 | Guide](https://developers.google.com/style). 19 | 20 | Thanks for contributing! 21 | -------------------------------------------------------------------------------- /third-party/fmt/support/bazel/BUILD.bazel: -------------------------------------------------------------------------------- 1 | cc_library( 2 | name = "fmt", 3 | srcs = [ 4 | #"src/fmt.cc", # No C++ module support 5 | "src/format.cc", 6 | "src/os.cc", 7 | ], 8 | hdrs = [ 9 | "include/fmt/args.h", 10 | "include/fmt/chrono.h", 11 | "include/fmt/color.h", 12 | "include/fmt/compile.h", 13 | "include/fmt/core.h", 14 | "include/fmt/format.h", 15 | "include/fmt/format-inl.h", 16 | "include/fmt/os.h", 17 | "include/fmt/ostream.h", 18 | "include/fmt/printf.h", 19 | "include/fmt/ranges.h", 20 | "include/fmt/std.h", 21 | "include/fmt/xchar.h", 22 | ], 23 | includes = [ 24 | "include", 25 | ], 26 | strip_include_prefix = "include", 27 | visibility = ["//visibility:public"], 28 | ) 29 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | // Heads up! 6 | // 7 | // We don't use the `.opacity()` mixin here since it causes a bug with text 8 | // fields in IE7-8. Source: https://github.com/twbs/bootstrap/pull/3552. 9 | 10 | .fade { 11 | opacity: 0; 12 | .transition(opacity .15s linear); 13 | &.in { 14 | opacity: 1; 15 | } 16 | } 17 | 18 | .collapse { 19 | display: none; 20 | 21 | &.in { display: block; } 22 | tr&.in { display: table-row; } 23 | tbody&.in { display: table-row-group; } 24 | } 25 | 26 | .collapsing { 27 | position: relative; 28 | height: 0; 29 | overflow: hidden; 30 | .transition-property(~"height, visibility"); 31 | .transition-duration(.35s); 32 | .transition-timing-function(ease); 33 | } 34 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/table-row.less: -------------------------------------------------------------------------------- 1 | // Tables 2 | 3 | .table-row-variant(@state; @background) { 4 | // Exact selectors below required to override `.table-striped` and prevent 5 | // inheritance to nested tables. 6 | .table > thead > tr, 7 | .table > tbody > tr, 8 | .table > tfoot > tr { 9 | > td.@{state}, 10 | > th.@{state}, 11 | &.@{state} > td, 12 | &.@{state} > th { 13 | background-color: @background; 14 | } 15 | } 16 | 17 | // Hover states for `.table-hover` 18 | // Note: this is not available for cells or rows within `thead` or `tfoot`. 19 | .table-hover > tbody > tr { 20 | > td.@{state}:hover, 21 | > th.@{state}:hover, 22 | &.@{state}:hover > td, 23 | &:hover > .@{state}, 24 | &.@{state}:hover > th { 25 | background-color: darken(@background, 5%); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/README.md: -------------------------------------------------------------------------------- 1 | # Running the fuzzers locally 2 | 3 | There is a [helper script](build.sh) to build the fuzzers, which has only been 4 | tested on Debian and Ubuntu linux so far. There should be no problems fuzzing on 5 | Windows (using clang>=8) or on Mac, but the script will probably not work out of 6 | the box. 7 | 8 | Something along 9 | ```sh 10 | mkdir build 11 | cd build 12 | export CXX=clang++ 13 | export CXXFLAGS="-fsanitize=fuzzer-no-link -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION= -g" 14 | cmake .. -DFMT_SAFE_DURATION_CAST=On -DFMT_FUZZ=On -DFMT_FUZZ_LINKMAIN=Off -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer" 15 | cmake --build . 16 | ``` 17 | should work to build the fuzzers for all platforms which clang supports. 18 | 19 | Execute a fuzzer with for instance 20 | ```sh 21 | cd build 22 | export UBSAN_OPTIONS=halt_on_error=1 23 | mkdir out_chrono 24 | bin/fuzzer_chrono_duration out_chrono 25 | ``` 26 | -------------------------------------------------------------------------------- /src/data_gen/data_gen.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_DATAGEN_H 2 | #define INTEGRAL_DATAGEN_H 3 | 4 | #include 5 | #include 6 | 7 | #include "../utils/types.h" 8 | 9 | // Data generation is the process by how Integral creates data in order to train 10 | // its evaluation. Integral plays many games against itself and when a suitable 11 | // position occurs in a game, it will store it in a list. At the end of this 12 | // game, the data is then written to a file with the WDL (outcome) of the game. 13 | namespace data_gen { 14 | 15 | inline std::atomic stop = false; 16 | 17 | struct Config { 18 | U64 soft_node_limit = 0; 19 | U64 hard_node_limit = 0; 20 | U64 num_games = 0; 21 | I32 num_threads = 0; 22 | I32 min_move_plies = 8, max_move_plies = 9; 23 | std::string output_file; 24 | std::string fens_file; 25 | }; 26 | 27 | void Generate(Config config); 28 | 29 | } // namespace data_gen 30 | 31 | #endif // INTEGRAL_DATAGEN_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: (@font-size-base * 1.5); 9 | font-weight: @close-font-weight; 10 | line-height: 1; 11 | color: @close-color; 12 | text-shadow: @close-text-shadow; 13 | .opacity(.2); 14 | 15 | &:hover, 16 | &:focus { 17 | color: @close-color; 18 | text-decoration: none; 19 | cursor: pointer; 20 | .opacity(.5); 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | // See https://developer.mozilla.org/en-US/docs/Web/Events/click#Safari_Mobile 27 | button& { 28 | padding: 0; 29 | cursor: pointer; 30 | background: transparent; 31 | border: 0; 32 | -webkit-appearance: none; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Mixin and adjust the regular image class 7 | .thumbnail { 8 | display: block; 9 | padding: @thumbnail-padding; 10 | margin-bottom: @line-height-computed; 11 | line-height: @line-height-base; 12 | background-color: @thumbnail-bg; 13 | border: 1px solid @thumbnail-border; 14 | border-radius: @thumbnail-border-radius; 15 | .transition(border .2s ease-in-out); 16 | 17 | > img, 18 | a > img { 19 | &:extend(.img-responsive); 20 | margin-left: auto; 21 | margin-right: auto; 22 | } 23 | 24 | // Add a hover state for linked versions only 25 | a&:hover, 26 | a&:focus, 27 | a&.active { 28 | border-color: @link-color; 29 | } 30 | 31 | // Image captions 32 | .caption { 33 | padding: @thumbnail-caption-padding; 34 | color: @thumbnail-caption-color; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /third-party/fmt/test/static-export-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.8...3.25) 2 | 3 | project(fmt-link CXX) 4 | 5 | set(BUILD_SHARED_LIBS OFF) 6 | set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) 7 | set(CMAKE_CXX_VISIBILITY_PRESET "hidden") 8 | 9 | # Broken LTO on GCC 4 10 | if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5) 11 | set(BROKEN_LTO ON) 12 | endif () 13 | 14 | if (NOT BROKEN_LTO AND CMAKE_VERSION VERSION_GREATER "3.8") 15 | # CMake 3.9+ 16 | include(CheckIPOSupported) 17 | check_ipo_supported(RESULT HAVE_IPO) 18 | if (HAVE_IPO) 19 | set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) 20 | endif () 21 | endif () 22 | 23 | add_subdirectory(../.. fmt) 24 | set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) 25 | 26 | add_library(library-test SHARED library.cc) 27 | target_link_libraries(library-test PRIVATE fmt::fmt) 28 | 29 | add_executable(exe-test main.cc) 30 | target_link_libraries(exe-test PRIVATE library-test) 31 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/chrono-timepoint.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021, Paul Dreik 2 | // For license information refer to format.h. 3 | #include 4 | 5 | #include "fuzzer-common.h" 6 | 7 | /* 8 | * a fuzzer for the chrono timepoints formatters 9 | * C is a clock (std::chrono::system_clock etc) 10 | */ 11 | template void doit(const uint8_t* data, size_t size) { 12 | using Rep = typename C::time_point::rep; 13 | constexpr auto N = sizeof(Rep); 14 | if (size < N) return; 15 | 16 | const auto x = assign_from_buf(data); 17 | typename C::duration dur{x}; 18 | typename C::time_point timepoint{dur}; 19 | data += N; 20 | size -= N; 21 | data_to_string format_str(data, size); 22 | 23 | std::string message = fmt::format(format_str.get(), timepoint); 24 | } 25 | 26 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 27 | try { 28 | doit(data, size); 29 | } catch (...) { 30 | } 31 | return 0; 32 | } 33 | -------------------------------------------------------------------------------- /third-party/fmt/test/assert-test.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - FMT_ASSERT test 2 | // 3 | // It is a separate test to minimize the number of EXPECT_DEBUG_DEATH checks 4 | // which are slow on some platforms. In other tests FMT_ASSERT is made to throw 5 | // an exception which is much faster and easier to check. 6 | // 7 | // Copyright (c) 2012 - present, Victor Zverovich 8 | // All rights reserved. 9 | // 10 | // For the license information refer to format.h. 11 | 12 | #include "fmt/core.h" 13 | #include "gtest/gtest.h" 14 | 15 | TEST(assert_test, fail) { 16 | #if GTEST_HAS_DEATH_TEST 17 | EXPECT_DEBUG_DEATH(FMT_ASSERT(false, "don't panic!"), "don't panic!"); 18 | #else 19 | fmt::print("warning: death tests are not supported\n"); 20 | #endif 21 | } 22 | 23 | TEST(assert_test, dangling_else) { 24 | bool test_condition = false; 25 | bool executed_else = false; 26 | if (test_condition) 27 | FMT_ASSERT(true, ""); 28 | else 29 | executed_else = true; 30 | EXPECT_TRUE(executed_else); 31 | } 32 | -------------------------------------------------------------------------------- /src/utils/fused.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_FUSED_H 2 | #define INTEGRAL_FUSED_H 3 | 4 | #include 5 | 6 | #include "types.h" 7 | 8 | enum FusedOperation { 9 | kAdd, 10 | kSub 11 | }; 12 | 13 | template = true> 16 | inline constexpr T Fused(const T& in) { 17 | return in; 18 | } 19 | 20 | template , bool> = true, 25 | std::enable_if_t = true> 26 | inline constexpr T Fused(const T& in, const T& operand, const Ts&... operands) { 27 | switch (update_op) { 28 | case kAdd: 29 | return Fused(static_cast(in + operand), operands...); 30 | case kSub: 31 | return Fused(static_cast(in - operand), operands...); 32 | } 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Floats 7 | // ------------------------- 8 | 9 | .clearfix { 10 | .clearfix(); 11 | } 12 | .center-block { 13 | .center-block(); 14 | } 15 | .pull-right { 16 | float: right !important; 17 | } 18 | .pull-left { 19 | float: left !important; 20 | } 21 | 22 | 23 | // Toggling content 24 | // ------------------------- 25 | 26 | // Note: Deprecated .hide in favor of .hidden or .sr-only (as appropriate) in v3.0.1 27 | .hide { 28 | display: none !important; 29 | } 30 | .show { 31 | display: block !important; 32 | } 33 | .invisible { 34 | visibility: hidden; 35 | } 36 | .text-hide { 37 | .text-hide(); 38 | } 39 | 40 | 41 | // Hide from screenreaders and browsers 42 | // 43 | // Credit: HTML5 Boilerplate 44 | 45 | .hidden { 46 | display: none !important; 47 | } 48 | 49 | 50 | // For Affix plugin 51 | // ------------------------- 52 | 53 | .affix { 54 | position: fixed; 55 | } 56 | -------------------------------------------------------------------------------- /third-party/fmt/doc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | find_program(DOXYGEN doxygen 2 | PATHS "$ENV{ProgramFiles}/doxygen/bin" 3 | "$ENV{ProgramFiles\(x86\)}/doxygen/bin") 4 | if (NOT DOXYGEN) 5 | message(STATUS "Target 'doc' disabled (requires doxygen)") 6 | return () 7 | endif () 8 | 9 | # Find the Python interpreter and set the PYTHON_EXECUTABLE variable. 10 | if (CMAKE_VERSION VERSION_LESS 3.12) 11 | # This logic is deprecated in CMake after 3.12. 12 | find_package(PythonInterp QUIET REQUIRED) 13 | else () 14 | find_package(Python QUIET REQUIRED) 15 | set(PYTHON_EXECUTABLE ${Python_EXECUTABLE}) 16 | endif () 17 | 18 | add_custom_target(doc 19 | COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/build.py 20 | ${FMT_VERSION} 21 | SOURCES api.rst syntax.rst usage.rst build.py conf.py _templates/layout.html) 22 | 23 | include(GNUInstallDirs) 24 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/ 25 | DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/doc/fmt OPTIONAL 26 | PATTERN ".doctrees" EXCLUDE) 27 | -------------------------------------------------------------------------------- /third-party/fmt/test/cuda-test/cuda-cpp14.cu: -------------------------------------------------------------------------------- 1 | // Direct NVCC command line example: 2 | // 3 | // nvcc ./cuda-cpp14.cu -x cu -I"../include" -l"fmtd" -L"../build/Debug" \ 4 | // -std=c++14 -Xcompiler /std:c++14 -Xcompiler /Zc:__cplusplus 5 | 6 | // Ensure that we are using the latest C++ standard for NVCC 7 | // The version is C++14 8 | // 9 | // https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#c-cplusplus-language-support 10 | // https://en.cppreference.com/w/cpp/preprocessor/replace#Predefined_macros 11 | static_assert(__cplusplus >= 201402L, "expect C++ 2014 for nvcc"); 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | extern auto make_message_cpp() -> std::string; 19 | extern auto make_message_cuda() -> std::string; 20 | 21 | int main() { 22 | std::cout << make_message_cuda() << std::endl; 23 | std::cout << make_message_cpp() << std::endl; 24 | } 25 | 26 | auto make_message_cuda() -> std::string { 27 | return fmt::format("nvcc compiler \t: __cplusplus == {}", __cplusplus); 28 | } 29 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/media.less: -------------------------------------------------------------------------------- 1 | .media { 2 | // Proper spacing between instances of .media 3 | margin-top: 15px; 4 | 5 | &:first-child { 6 | margin-top: 0; 7 | } 8 | } 9 | 10 | .media, 11 | .media-body { 12 | zoom: 1; 13 | overflow: hidden; 14 | } 15 | 16 | .media-body { 17 | width: 10000px; 18 | } 19 | 20 | .media-object { 21 | display: block; 22 | } 23 | 24 | .media-right, 25 | .media > .pull-right { 26 | padding-left: 10px; 27 | } 28 | 29 | .media-left, 30 | .media > .pull-left { 31 | padding-right: 10px; 32 | } 33 | 34 | .media-left, 35 | .media-right, 36 | .media-body { 37 | display: table-cell; 38 | vertical-align: top; 39 | } 40 | 41 | .media-middle { 42 | vertical-align: middle; 43 | } 44 | 45 | .media-bottom { 46 | vertical-align: bottom; 47 | } 48 | 49 | // Reset margins on headings for tighter default spacing 50 | .media-heading { 51 | margin-top: 0; 52 | margin-bottom: 5px; 53 | } 54 | 55 | // Media list variation 56 | // 57 | // Undo default ul/ol styles 58 | .media-list { 59 | padding-left: 0; 60 | list-style: none; 61 | } 62 | -------------------------------------------------------------------------------- /third-party/fmt/support/cmake/JoinPaths.cmake: -------------------------------------------------------------------------------- 1 | # This module provides function for joining paths 2 | # known from from most languages 3 | # 4 | # Original license: 5 | # SPDX-License-Identifier: (MIT OR CC0-1.0) 6 | # Explicit permission given to distribute this module under 7 | # the terms of the project as described in /LICENSE.rst. 8 | # Copyright 2020 Jan Tojnar 9 | # https://github.com/jtojnar/cmake-snips 10 | # 11 | # Modelled after Python’s os.path.join 12 | # https://docs.python.org/3.7/library/os.path.html#os.path.join 13 | # Windows not supported 14 | function(join_paths joined_path first_path_segment) 15 | set(temp_path "${first_path_segment}") 16 | foreach(current_segment IN LISTS ARGN) 17 | if(NOT ("${current_segment}" STREQUAL "")) 18 | if(IS_ABSOLUTE "${current_segment}") 19 | set(temp_path "${current_segment}") 20 | else() 21 | set(temp_path "${temp_path}/${current_segment}") 22 | endif() 23 | endif() 24 | endforeach() 25 | set(${joined_path} "${temp_path}" PARENT_SCOPE) 26 | endfunction() 27 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | padding-left: 0; 8 | margin: @line-height-computed 0; 9 | list-style: none; 10 | text-align: center; 11 | &:extend(.clearfix all); 12 | li { 13 | display: inline; 14 | > a, 15 | > span { 16 | display: inline-block; 17 | padding: 5px 14px; 18 | background-color: @pager-bg; 19 | border: 1px solid @pager-border; 20 | border-radius: @pager-border-radius; 21 | } 22 | 23 | > a:hover, 24 | > a:focus { 25 | text-decoration: none; 26 | background-color: @pager-hover-bg; 27 | } 28 | } 29 | 30 | .next { 31 | > a, 32 | > span { 33 | float: right; 34 | } 35 | } 36 | 37 | .previous { 38 | > a, 39 | > span { 40 | float: left; 41 | } 42 | } 43 | 44 | .disabled { 45 | > a, 46 | > a:hover, 47 | > a:focus, 48 | > span { 49 | color: @pager-disabled-color; 50 | background-color: @pager-bg; 51 | cursor: @cursor-disabled; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/utils/random.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_RANDOM_H 2 | #define INTEGRAL_RANDOM_H 3 | 4 | #include 5 | 6 | #include "types.h" 7 | 8 | constexpr int kRandomSeed = 0x1333317; 9 | static thread_local std::mt19937_64 mt_generator(kRandomSeed); 10 | 11 | template 12 | static void RandomSeed(U64 base_seed, Args... additional_seeds) { 13 | std::random_device rd; 14 | std::vector seed_data{static_cast(rd()), 15 | static_cast(rd()), 16 | static_cast(rd()), 17 | static_cast(rd()), 18 | static_cast(base_seed), 19 | static_cast(additional_seeds)...}; 20 | std::seed_seq seed(seed_data.begin(), seed_data.end()); 21 | mt_generator.seed(seed); 22 | } 23 | 24 | static U64 RandomU64() { 25 | return mt_generator(); 26 | } 27 | 28 | static U64 RandomU64(U64 min, U64 max) { 29 | std::uniform_int_distribution dist(min, max); 30 | return dist(mt_generator); 31 | } 32 | 33 | #endif // INTEGRAL_RANDOM_H -------------------------------------------------------------------------------- /src/magics/attacks.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_MAGICS_ATTACKS_H_ 2 | #define INTEGRAL_MAGICS_ATTACKS_H_ 3 | 4 | #include "../../shared/multi_array.h" 5 | #include "../chess/bitboard.h" 6 | 7 | namespace magics::attacks { 8 | 9 | constexpr int kBishopBlockerCombinations = 512; 10 | constexpr int kRookBlockerCombinations = 4096; 11 | 12 | using BishopAttacksTable = 13 | MultiArray; 14 | using RookAttacksTable = 15 | MultiArray; 16 | 17 | extern BishopAttacksTable kBishopAttacks; 18 | extern RookAttacksTable kRookAttacks; 19 | 20 | U64 GetBishopAttackIndex(Square square, const BitBoard& occupied); 21 | 22 | U64 GetRookAttackIndex(Square square, const BitBoard& occupied); 23 | 24 | BitBoard GenerateBishopMask(Square square); 25 | 26 | BitBoard GenerateRookMask(Square square); 27 | 28 | BitBoard GenerateBishopMoves(Square square, const BitBoard &occupied); 29 | 30 | BitBoard GenerateRookMoves(Square square, const BitBoard &occupied); 31 | 32 | std::vector CreateBlockers(BitBoard moves); 33 | 34 | } // namespace magics::attacks 35 | 36 | #endif // INTEGRAL_MAGICS_ATTACKS_H_ -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/image.less: -------------------------------------------------------------------------------- 1 | // Image Mixins 2 | // - Responsive image 3 | // - Retina image 4 | 5 | 6 | // Responsive image 7 | // 8 | // Keep images from scaling beyond the width of their parents. 9 | .img-responsive(@display: block) { 10 | display: @display; 11 | max-width: 100%; // Part 1: Set a maximum relative to the parent 12 | height: auto; // Part 2: Scale the height according to the width, otherwise you get stretching 13 | } 14 | 15 | 16 | // Retina image 17 | // 18 | // Short retina mixin for setting background-image and -size. Note that the 19 | // spelling of `min--moz-device-pixel-ratio` is intentional. 20 | .img-retina(@file-1x; @file-2x; @width-1x; @height-1x) { 21 | background-image: url("@{file-1x}"); 22 | 23 | @media 24 | only screen and (-webkit-min-device-pixel-ratio: 2), 25 | only screen and ( min--moz-device-pixel-ratio: 2), 26 | only screen and ( -o-min-device-pixel-ratio: 2/1), 27 | only screen and ( min-device-pixel-ratio: 2), 28 | only screen and ( min-resolution: 192dpi), 29 | only screen and ( min-resolution: 2dppx) { 30 | background-image: url("@{file-2x}"); 31 | background-size: @width-1x @height-1x; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/jumbotron.less: -------------------------------------------------------------------------------- 1 | // 2 | // Jumbotron 3 | // -------------------------------------------------- 4 | 5 | 6 | .jumbotron { 7 | padding: @jumbotron-padding (@jumbotron-padding / 2); 8 | margin-bottom: @jumbotron-padding; 9 | color: @jumbotron-color; 10 | background-color: @jumbotron-bg; 11 | 12 | h1, 13 | .h1 { 14 | color: @jumbotron-heading-color; 15 | } 16 | 17 | p { 18 | margin-bottom: (@jumbotron-padding / 2); 19 | font-size: @jumbotron-font-size; 20 | font-weight: 200; 21 | } 22 | 23 | > hr { 24 | border-top-color: darken(@jumbotron-bg, 10%); 25 | } 26 | 27 | .tb-container &, 28 | .container-fluid & { 29 | border-radius: @border-radius-large; // Only round corners at higher resolutions if contained in a container 30 | } 31 | 32 | .tb-container { 33 | max-width: 100%; 34 | } 35 | 36 | @media screen and (min-width: @screen-sm-min) { 37 | padding: (@jumbotron-padding * 1.6) 0; 38 | 39 | .tb-container &, 40 | .container-fluid & { 41 | padding-left: (@jumbotron-padding * 2); 42 | padding-right: (@jumbotron-padding * 2); 43 | } 44 | 45 | h1, 46 | .h1 { 47 | font-size: (@font-size-base * 4.5); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------------------------------- 3 | 4 | // Utilities 5 | @import "mixins/hide-text.less"; 6 | @import "mixins/opacity.less"; 7 | @import "mixins/image.less"; 8 | @import "mixins/labels.less"; 9 | @import "mixins/reset-filter.less"; 10 | @import "mixins/resize.less"; 11 | @import "mixins/responsive-visibility.less"; 12 | @import "mixins/size.less"; 13 | @import "mixins/tab-focus.less"; 14 | @import "mixins/text-emphasis.less"; 15 | @import "mixins/text-overflow.less"; 16 | @import "mixins/vendor-prefixes.less"; 17 | 18 | // Components 19 | @import "mixins/alerts.less"; 20 | @import "mixins/buttons.less"; 21 | @import "mixins/panels.less"; 22 | @import "mixins/pagination.less"; 23 | @import "mixins/list-group.less"; 24 | @import "mixins/nav-divider.less"; 25 | @import "mixins/forms.less"; 26 | @import "mixins/progress-bar.less"; 27 | @import "mixins/table-row.less"; 28 | 29 | // Skins 30 | @import "mixins/background-variant.less"; 31 | @import "mixins/border-radius.less"; 32 | @import "mixins/gradients.less"; 33 | 34 | // Layout 35 | @import "mixins/clearfix.less"; 36 | @import "mixins/center-block.less"; 37 | @import "mixins/nav-vertical-align.less"; 38 | @import "mixins/grid-framework.less"; 39 | @import "mixins/grid.less"; 40 | -------------------------------------------------------------------------------- /third-party/fmt/test/test-assert.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - test version of FMT_ASSERT 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #ifndef FMT_TEST_ASSERT_H_ 9 | #define FMT_TEST_ASSERT_H_ 10 | 11 | #include 12 | 13 | void throw_assertion_failure(const char* message); 14 | #define FMT_ASSERT(condition, message) \ 15 | if (!(condition)) throw_assertion_failure(message); 16 | 17 | #include "gtest/gtest.h" 18 | 19 | class assertion_failure : public std::logic_error { 20 | public: 21 | explicit assertion_failure(const char* message) : std::logic_error(message) {} 22 | 23 | private: 24 | virtual void avoid_weak_vtable(); 25 | }; 26 | 27 | void assertion_failure::avoid_weak_vtable() {} 28 | 29 | // We use a separate function (rather than throw directly from FMT_ASSERT) to 30 | // avoid GCC's -Wterminate warning when FMT_ASSERT is used in a destructor. 31 | inline void throw_assertion_failure(const char* message) { 32 | throw assertion_failure(message); 33 | } 34 | 35 | // Expects an assertion failure. 36 | #define EXPECT_ASSERT(stmt, message) \ 37 | FMT_TEST_THROW_(stmt, assertion_failure, message, GTEST_NONFATAL_FAILURE_) 38 | 39 | #endif // FMT_TEST_ASSERT_H_ 40 | -------------------------------------------------------------------------------- /src/engine/search/history/bonus.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_BONUS_H 2 | #define INTEGRAL_BONUS_H 3 | 4 | #include "../../../tuner/spsa.h" 5 | #include "../../../utils/types.h" 6 | 7 | namespace search::history { 8 | 9 | TUNABLE(kHistBonusGravity, 11422, 8192, 32768, false); 10 | TUNABLE(kHistBonusScale, 168, 65, 300, false); 11 | TUNABLE(kHistPenaltyScale, 156, 65, 300, false); 12 | TUNABLE_STEP(kHistBonusMaxBonus, 1294, 580, 2500, false, 200); 13 | TUNABLE(kHistBonusBias, 126, 0, 300, false); 14 | 15 | static I16 HistoryBonus(I16 depth, 16 | I16 scale = kHistBonusScale, 17 | I16 max_bonus = kHistBonusMaxBonus) { 18 | return std::clamp(scale * depth - kHistBonusBias, -max_bonus, max_bonus); 19 | } 20 | 21 | static I16 HistoryPenalty(I16 depth, 22 | I16 scale = kHistPenaltyScale, 23 | I16 max_bonus = kHistBonusMaxBonus) { 24 | return std::clamp( 25 | -scale * depth - kHistBonusBias, -max_bonus, max_bonus); 26 | } 27 | 28 | // Linear interpolation of the bonus and maximum score 29 | static I16 ScaleBonus(I16 score, I16 bonus, I16 gravity = kHistBonusGravity) { 30 | return bonus - score * std::abs(bonus) / gravity; 31 | } 32 | 33 | } // namespace search::history 34 | 35 | #endif // INTEGRAL_BONUS_H -------------------------------------------------------------------------------- /src/chess/fen.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_FEN_H_ 2 | #define INTEGRAL_FEN_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include "../utils/types.h" 9 | #include "board.h" 10 | 11 | namespace fen { 12 | 13 | constexpr std::string_view kStartFen = 14 | "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"; 15 | constexpr std::string_view kKiwipeteFen = 16 | "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - "; 17 | 18 | const std::unordered_map kCharToPieceType = { 19 | {'p', PieceType::kPawn}, 20 | {'n', PieceType::kKnight}, 21 | {'b', PieceType::kBishop}, 22 | {'r', PieceType::kRook}, 23 | {'q', PieceType::kQueen}, 24 | {'k', PieceType::kKing}, 25 | }; 26 | 27 | const std::unordered_map kPieceTypeToChar = { 28 | {PieceType::kNone, 'x'}, 29 | {PieceType::kPawn, 'p'}, 30 | {PieceType::kKnight, 'n'}, 31 | {PieceType::kBishop, 'b'}, 32 | {PieceType::kRook, 'r'}, 33 | {PieceType::kQueen, 'q'}, 34 | {PieceType::kKing, 'k'}, 35 | }; 36 | 37 | char GetPieceChar(const BoardState &state, Square square); 38 | 39 | BoardState StringToBoard(std::string_view fen_str = kStartFen); 40 | 41 | std::string BoardToString(const BoardState &state); 42 | 43 | } // namespace fen 44 | 45 | #endif // INTEGRAL_FEN_H_ -------------------------------------------------------------------------------- /src/utils/string.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_STRING_H 2 | #define INTEGRAL_STRING_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | [[maybe_unused]] static std::vector SplitString( 11 | std::string_view input, char delimiter) { 12 | std::vector result; 13 | std::string token; 14 | std::istringstream token_stream((std::string(input))); 15 | 16 | while (getline(token_stream, token, delimiter)) { 17 | result.push_back(token); 18 | } 19 | 20 | return result; 21 | } 22 | 23 | [[maybe_unused]] static std::string RemoveWhitespace(std::string_view input) { 24 | std::string output; 25 | for (char c : input) { 26 | if (!std::isspace(static_cast(c))) { 27 | output.push_back(c); 28 | } 29 | } 30 | return output; 31 | } 32 | 33 | static std::string ToLowercase(std::string string) { 34 | std::ranges::transform(string, string.begin(), [](auto ch) { 35 | return std::tolower(ch, std::locale()); 36 | }); 37 | return string; 38 | } 39 | 40 | inline std::string_view BoolToString(bool value) { 41 | return value ? "true" : "false"; 42 | } 43 | 44 | inline bool StringToBool(std::string string) { 45 | return ToLowercase(std::move(string)) == "true"; 46 | } 47 | 48 | #endif // INTEGRAL_STRING_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/buttons.less: -------------------------------------------------------------------------------- 1 | // Button variants 2 | // 3 | // Easily pump out default styles, as well as :hover, :focus, :active, 4 | // and disabled options for all buttons 5 | 6 | .button-variant(@color; @background; @border) { 7 | color: @color; 8 | background-color: @background; 9 | border-color: @border; 10 | 11 | &:hover, 12 | &:focus, 13 | &.focus, 14 | &:active, 15 | &.active, 16 | .open > .dropdown-toggle& { 17 | color: @color; 18 | background-color: darken(@background, 10%); 19 | border-color: darken(@border, 12%); 20 | } 21 | &:active, 22 | &.active, 23 | .open > .dropdown-toggle& { 24 | background-image: none; 25 | } 26 | &.disabled, 27 | &[disabled], 28 | fieldset[disabled] & { 29 | &, 30 | &:hover, 31 | &:focus, 32 | &.focus, 33 | &:active, 34 | &.active { 35 | background-color: @background; 36 | border-color: @border; 37 | } 38 | } 39 | 40 | .badge { 41 | color: @background; 42 | background-color: @color; 43 | } 44 | } 45 | 46 | // Button sizes 47 | .button-size(@padding-vertical; @padding-horizontal; @font-size; @line-height; @border-radius) { 48 | padding: @padding-vertical @padding-horizontal; 49 | font-size: @font-size; 50 | line-height: @line-height; 51 | border-radius: @border-radius; 52 | } 53 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/bootstrap.less: -------------------------------------------------------------------------------- 1 | // Core variables and mixins 2 | @import "variables.less"; 3 | @import "mixins.less"; 4 | 5 | // Reset and dependencies 6 | @import "normalize.less"; 7 | @import "print.less"; 8 | @import "glyphicons.less"; 9 | 10 | // Core CSS 11 | @import "scaffolding.less"; 12 | @import "type.less"; 13 | @import "code.less"; 14 | @import "grid.less"; 15 | @import "tables.less"; 16 | @import "forms.less"; 17 | @import "buttons.less"; 18 | 19 | // Components 20 | @import "component-animations.less"; 21 | @import "dropdowns.less"; 22 | @import "button-groups.less"; 23 | @import "input-groups.less"; 24 | @import "navs.less"; 25 | @import "navbar.less"; 26 | @import "breadcrumbs.less"; 27 | @import "pagination.less"; 28 | @import "pager.less"; 29 | @import "labels.less"; 30 | @import "badges.less"; 31 | @import "jumbotron.less"; 32 | @import "thumbnails.less"; 33 | @import "alerts.less"; 34 | @import "progress-bars.less"; 35 | @import "media.less"; 36 | @import "list-group.less"; 37 | @import "panels.less"; 38 | @import "responsive-embed.less"; 39 | @import "wells.less"; 40 | @import "close.less"; 41 | 42 | // Components w/ JavaScript 43 | @import "modals.less"; 44 | @import "tooltip.less"; 45 | @import "popovers.less"; 46 | @import "carousel.less"; 47 | 48 | // Utility classes 49 | @import "utilities.less"; 50 | @import "responsive-utilities.less"; 51 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, Paul Dreik 2 | # License: see LICENSE.rst in the fmt root directory 3 | 4 | # Link in the main function. Useful for reproducing, kcov, gdb, afl, valgrind. 5 | # (Note that libFuzzer can also reproduce, just pass it the files.) 6 | option(FMT_FUZZ_LINKMAIN "Enables the reproduce mode, instead of libFuzzer" On) 7 | 8 | # For oss-fuzz - insert $LIB_FUZZING_ENGINE into the link flags, but only for 9 | # the fuzz targets, otherwise the CMake configuration step fails. 10 | set(FMT_FUZZ_LDFLAGS "" CACHE STRING "LDFLAGS for the fuzz targets") 11 | 12 | # Adds a binary for reproducing, i.e. no fuzzing, just enables replaying data 13 | # through the fuzzers. 14 | function(add_fuzzer source) 15 | get_filename_component(basename ${source} NAME_WE) 16 | set(name ${basename}-fuzzer) 17 | add_executable(${name} ${source} fuzzer-common.h) 18 | if (FMT_FUZZ_LINKMAIN) 19 | target_sources(${name} PRIVATE main.cc) 20 | endif () 21 | target_link_libraries(${name} PRIVATE fmt) 22 | if (FMT_FUZZ_LDFLAGS) 23 | target_link_libraries(${name} PRIVATE ${FMT_FUZZ_LDFLAGS}) 24 | endif () 25 | target_compile_features(${name} PRIVATE cxx_std_14) 26 | endfunction() 27 | 28 | foreach (source chrono-duration.cc chrono-timepoint.cc float.cc named-arg.cc one-arg.cc two-args.cc) 29 | add_fuzzer(${source}) 30 | endforeach () 31 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/labels.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels 3 | // -------------------------------------------------- 4 | 5 | .label { 6 | display: inline; 7 | padding: .2em .6em .3em; 8 | font-size: 75%; 9 | font-weight: bold; 10 | line-height: 1; 11 | color: @label-color; 12 | text-align: center; 13 | white-space: nowrap; 14 | vertical-align: baseline; 15 | border-radius: .25em; 16 | 17 | // Add hover effects, but only for links 18 | a& { 19 | &:hover, 20 | &:focus { 21 | color: @label-link-hover-color; 22 | text-decoration: none; 23 | cursor: pointer; 24 | } 25 | } 26 | 27 | // Empty labels collapse automatically (not available in IE8) 28 | &:empty { 29 | display: none; 30 | } 31 | 32 | // Quick fix for labels in buttons 33 | .btn & { 34 | position: relative; 35 | top: -1px; 36 | } 37 | } 38 | 39 | // Colors 40 | // Contextual variations (linked labels get darker on :hover) 41 | 42 | .label-default { 43 | .label-variant(@label-default-bg); 44 | } 45 | 46 | .label-primary { 47 | .label-variant(@label-primary-bg); 48 | } 49 | 50 | .label-success { 51 | .label-variant(@label-success-bg); 52 | } 53 | 54 | .label-info { 55 | .label-variant(@label-info-bg); 56 | } 57 | 58 | .label-warning { 59 | .label-variant(@label-warning-bg); 60 | } 61 | 62 | .label-danger { 63 | .label-variant(@label-danger-bg); 64 | } 65 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/float.cc: -------------------------------------------------------------------------------- 1 | // A fuzzer for floating-point formatter. 2 | // For the license information refer to format.h. 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "fuzzer-common.h" 12 | 13 | void check_round_trip(fmt::string_view format_str, double value) { 14 | auto buffer = fmt::memory_buffer(); 15 | fmt::format_to(std::back_inserter(buffer), format_str, value); 16 | 17 | if (std::isnan(value)) { 18 | auto nan = std::signbit(value) ? "-nan" : "nan"; 19 | if (fmt::string_view(buffer.data(), buffer.size()) != nan) 20 | throw std::runtime_error("round trip failure"); 21 | return; 22 | } 23 | 24 | buffer.push_back('\0'); 25 | char* ptr = nullptr; 26 | if (std::strtod(buffer.data(), &ptr) != value) 27 | throw std::runtime_error("round trip failure"); 28 | if (ptr + 1 != buffer.end()) throw std::runtime_error("unparsed output"); 29 | } 30 | 31 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 32 | if (size <= sizeof(double) || !std::numeric_limits::is_iec559) 33 | return 0; 34 | check_round_trip("{}", assign_from_buf(data)); 35 | // A larger than necessary precision is used to trigger the fallback 36 | // formatter. 37 | check_round_trip("{:.50g}", assign_from_buf(data)); 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /third-party/fmt/test/test-main.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - test main function. 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include 9 | 10 | #include "gtest/gtest.h" 11 | 12 | #ifdef _WIN32 13 | # include 14 | #endif 15 | 16 | #ifdef _MSC_VER 17 | # include 18 | #endif 19 | 20 | int main(int argc, char** argv) { 21 | #ifdef _WIN32 22 | // Don't display any error dialogs. This also suppresses message boxes 23 | // on assertion failures in MinGW where _set_error_mode/CrtSetReportMode 24 | // doesn't help. 25 | SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | 26 | SEM_NOOPENFILEERRORBOX); 27 | #endif 28 | #ifdef _MSC_VER 29 | // Disable message boxes on assertion failures. 30 | _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 31 | _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); 32 | _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 33 | _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); 34 | #endif 35 | try { 36 | testing::InitGoogleTest(&argc, argv); 37 | testing::FLAGS_gtest_death_test_style = "threadsafe"; 38 | return RUN_ALL_TESTS(); 39 | } catch (...) { 40 | // Catch all exceptions to make Coverity happy. 41 | } 42 | return EXIT_FAILURE; 43 | } 44 | -------------------------------------------------------------------------------- /third-party/fmt/test/gtest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #------------------------------------------------------------------------------ 2 | # Build the google test library 3 | 4 | # We compile Google Test ourselves instead of using pre-compiled libraries. 5 | # See the Google Test FAQ "Why is it not recommended to install a 6 | # pre-compiled copy of Google Test (for example, into /usr/local)?" 7 | # at http://code.google.com/p/googletest/wiki/FAQ for more details. 8 | add_library(gtest STATIC 9 | gmock-gtest-all.cc gmock/gmock.h gtest/gtest.h gtest/gtest-spi.h) 10 | target_compile_definitions(gtest PUBLIC GTEST_HAS_STD_WSTRING=1) 11 | target_include_directories(gtest SYSTEM PUBLIC .) 12 | target_compile_features(gtest PUBLIC cxx_std_11) 13 | 14 | find_package(Threads) 15 | if (Threads_FOUND) 16 | target_link_libraries(gtest ${CMAKE_THREAD_LIBS_INIT}) 17 | else () 18 | target_compile_definitions(gtest PUBLIC GTEST_HAS_PTHREAD=0) 19 | endif () 20 | 21 | if (MSVC) 22 | # Disable MSVC warnings of _CRT_INSECURE_DEPRECATE functions. 23 | target_compile_definitions(gtest PRIVATE _CRT_SECURE_NO_WARNINGS) 24 | if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 25 | # Disable MSVC warnings of POSIX functions. 26 | target_compile_options(gtest PUBLIC -Wno-deprecated-declarations) 27 | endif () 28 | endif () 29 | 30 | # Silence MSVC tr1 deprecation warning in gmock. 31 | target_compile_definitions(gtest 32 | PUBLIC _SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1) 33 | -------------------------------------------------------------------------------- /third-party/fmt/test/unicode-test.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - Unicode tests 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "fmt/chrono.h" 13 | #include "gmock/gmock.h" 14 | #include "util.h" // get_locale 15 | 16 | using testing::Contains; 17 | 18 | TEST(unicode_test, is_utf8) { EXPECT_TRUE(fmt::detail::is_utf8()); } 19 | 20 | TEST(unicode_test, legacy_locale) { 21 | auto loc = get_locale("be_BY.CP1251", "Belarusian_Belarus.1251"); 22 | if (loc == std::locale::classic()) return; 23 | 24 | auto s = std::string(); 25 | try { 26 | s = fmt::format(loc, "Дзень тыдня: {:L}", fmt::weekday(1)); 27 | } catch (const fmt::format_error& e) { 28 | // Formatting can fail due to an unsupported encoding. 29 | fmt::print("Format Error: {}\n", e.what()); 30 | return; 31 | } 32 | 33 | #if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 500 34 | auto&& os = std::ostringstream(); 35 | os.imbue(loc); 36 | auto tm = std::tm(); 37 | tm.tm_wday = 1; 38 | os << std::put_time(&tm, "%a"); 39 | auto wd = os.str(); 40 | if (wd == "??") { 41 | EXPECT_EQ(s, "Дзень тыдня: ??"); 42 | fmt::print("std::locale gives ?? as a weekday.\n"); 43 | return; 44 | } 45 | #endif 46 | EXPECT_THAT((std::vector{"Дзень тыдня: пн", "Дзень тыдня: Пан"}), 47 | Contains(s)); 48 | } 49 | -------------------------------------------------------------------------------- /src/data_gen/format/fens.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_FENS_H 2 | #define INTEGRAL_FENS_H 3 | 4 | #include "format.h" 5 | 6 | namespace data_gen::format { 7 | 8 | class FenFormatter : public OutputFormatter { 9 | public: 10 | explicit FenFormatter(std::ostream& output_stream) 11 | : output_stream_(output_stream) {} 12 | 13 | void SetPosition(const BoardState& state) override { 14 | start_pos_ = Board(state); 15 | fens_.clear(); 16 | } 17 | 18 | void PushMove(Move move, Color turn, Score score) override { 19 | const auto& state = start_pos_.GetState(); 20 | const bool noisy_move = 21 | move.IsCapture(state) || move.GetType() == MoveType::kPromotion; 22 | 23 | start_pos_.MakeMove(move); 24 | 25 | if (!noisy_move && !state.InCheck()) { 26 | fens_.push_back(fen::BoardToString(state)); 27 | } 28 | } 29 | 30 | U64 WriteOutcome(double wdl_outcome) override { 31 | // White Loss = 0 Draw = 1 White Win = 2 32 | std::random_device rd; 33 | std::mt19937 gen{rd()}; 34 | std::ranges::shuffle(fens_, gen); 35 | 36 | for (int i = 0; i < 50 && i < fens_.size(); ++i) { 37 | output_stream_ << fens_[i] << fmt::format(" [{:.1f}]", wdl_outcome); 38 | output_stream_ << "\n"; 39 | } 40 | 41 | return std::min(50, fens_.size()); 42 | } 43 | 44 | private: 45 | Board start_pos_; 46 | std::vector fens_; 47 | std::ostream& output_stream_; 48 | }; 49 | 50 | } // namespace data_gen::format 51 | 52 | #endif // INTEGRAL_FENS_H -------------------------------------------------------------------------------- /src/utils/list.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_LIST_H 2 | #define INTEGRAL_LIST_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | template 9 | class List { 10 | public: 11 | List() : count_(0) {} 12 | 13 | inline T &operator[](int i) { 14 | assert(i >= 0 && i < count_); 15 | return container_[i]; 16 | } 17 | 18 | inline T operator[](int i) const { 19 | assert(i >= 0 && i < count_); 20 | return container_[i]; 21 | } 22 | 23 | inline void Push(const T &object) { 24 | assert(count_ < length); 25 | container_[count_++] = object; 26 | } 27 | 28 | inline void Push(T &&object) { 29 | assert(count_ < length); 30 | container_[count_++] = std::move(object); 31 | } 32 | 33 | inline T &PopBack() { 34 | assert(count_ > 0); 35 | return container_[--count_]; 36 | } 37 | 38 | inline T &Back() { 39 | return container_[count_ - 1]; 40 | } 41 | 42 | inline void Erase(int i) { 43 | std::swap(Back(), container_[i]); 44 | --count_; 45 | } 46 | 47 | [[nodiscard]] inline int Size() const { 48 | return count_; 49 | } 50 | 51 | [[nodiscard]] inline bool Empty() const { 52 | return count_ == 0; 53 | } 54 | 55 | [[nodiscard]] inline std::array &Data() { 56 | return container_; 57 | } 58 | 59 | inline void Clear() { 60 | count_ = 0; 61 | } 62 | 63 | private: 64 | std::array container_; 65 | std::int32_t count_ = 0; 66 | }; 67 | 68 | #endif // INTEGRAL_LIST_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .badge { 8 | display: inline-block; 9 | min-width: 10px; 10 | padding: 3px 7px; 11 | font-size: @font-size-small; 12 | font-weight: @badge-font-weight; 13 | color: @badge-color; 14 | line-height: @badge-line-height; 15 | vertical-align: baseline; 16 | white-space: nowrap; 17 | text-align: center; 18 | background-color: @badge-bg; 19 | border-radius: @badge-border-radius; 20 | 21 | // Empty badges collapse automatically (not available in IE8) 22 | &:empty { 23 | display: none; 24 | } 25 | 26 | // Quick fix for badges in buttons 27 | .btn & { 28 | position: relative; 29 | top: -1px; 30 | } 31 | 32 | .btn-xs &, 33 | .btn-group-xs > .btn & { 34 | top: 0; 35 | padding: 1px 5px; 36 | } 37 | 38 | // Hover state, but only for links 39 | a& { 40 | &:hover, 41 | &:focus { 42 | color: @badge-link-hover-color; 43 | text-decoration: none; 44 | cursor: pointer; 45 | } 46 | } 47 | 48 | // Account for badges in navs 49 | .list-group-item.active > &, 50 | .nav-pills > .active > a > & { 51 | color: @badge-active-color; 52 | background-color: @badge-active-bg; 53 | } 54 | 55 | .list-group-item > & { 56 | float: right; 57 | } 58 | 59 | .list-group-item > & + & { 60 | margin-right: 5px; 61 | } 62 | 63 | .nav-pills > li > a > & { 64 | margin-left: 3px; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/engine/search/syzygy/syzygy.cc: -------------------------------------------------------------------------------- 1 | #include "syzygy.h" 2 | 3 | #include 4 | 5 | namespace syzygy { 6 | 7 | void SetPath(std::string_view path) { 8 | syzygy::enabled = path != ""; 9 | tb_init(path.data()); 10 | } 11 | 12 | void Free() { 13 | tb_free(); 14 | } 15 | 16 | ProbeResult ProbePosition(const BoardState &state) { 17 | const Square en_passant = 18 | state.en_passant != Squares::kNoSquare ? state.en_passant : Square(0); 19 | const auto result = tb_probe_wdl(state.Occupied(Color::kWhite).AsU64(), 20 | state.Occupied(Color::kBlack).AsU64(), 21 | state.Kings().AsU64(), 22 | state.Queens().AsU64(), 23 | state.Rooks().AsU64(), 24 | state.Bishops().AsU64(), 25 | state.Knights().AsU64(), 26 | state.Pawns().AsU64(), 27 | 0, 28 | 0, 29 | en_passant, 30 | state.turn == Color::kWhite); 31 | 32 | switch (result) { 33 | case TB_WIN: 34 | return ProbeResult::kWin; 35 | case TB_LOSS: 36 | return ProbeResult::kLoss; 37 | case TB_RESULT_FAILED: 38 | return ProbeResult::kFailed; 39 | case TB_DRAW: 40 | default: 41 | return ProbeResult::kDraw; 42 | } 43 | } 44 | 45 | } // namespace syzygy -------------------------------------------------------------------------------- /third-party/fmt/src/format.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ 2 | // 3 | // Copyright (c) 2012 - 2016, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "fmt/format-inl.h" 9 | 10 | FMT_BEGIN_NAMESPACE 11 | namespace detail { 12 | 13 | template FMT_API auto dragonbox::to_decimal(float x) noexcept 14 | -> dragonbox::decimal_fp; 15 | template FMT_API auto dragonbox::to_decimal(double x) noexcept 16 | -> dragonbox::decimal_fp; 17 | 18 | #ifndef FMT_STATIC_THOUSANDS_SEPARATOR 19 | template FMT_API locale_ref::locale_ref(const std::locale& loc); 20 | template FMT_API auto locale_ref::get() const -> std::locale; 21 | #endif 22 | 23 | // Explicit instantiations for char. 24 | 25 | template FMT_API auto thousands_sep_impl(locale_ref) 26 | -> thousands_sep_result; 27 | template FMT_API auto decimal_point_impl(locale_ref) -> char; 28 | 29 | template FMT_API void buffer::append(const char*, const char*); 30 | 31 | template FMT_API void vformat_to(buffer&, string_view, 32 | typename vformat_args<>::type, locale_ref); 33 | 34 | // Explicit instantiations for wchar_t. 35 | 36 | template FMT_API auto thousands_sep_impl(locale_ref) 37 | -> thousands_sep_result; 38 | template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; 39 | 40 | template FMT_API void buffer::append(const wchar_t*, const wchar_t*); 41 | 42 | } // namespace detail 43 | FMT_END_NAMESPACE 44 | -------------------------------------------------------------------------------- /third-party/fmt/test/util.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - test utilities 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "util.h" 9 | 10 | #include 11 | 12 | const char* const file_content = "Don't panic!"; 13 | 14 | fmt::buffered_file open_buffered_file(FILE** fp) { 15 | #if FMT_USE_FCNTL 16 | fmt::file read_end, write_end; 17 | fmt::file::pipe(read_end, write_end); 18 | write_end.write(file_content, std::strlen(file_content)); 19 | write_end.close(); 20 | fmt::buffered_file f = read_end.fdopen("r"); 21 | if (fp) *fp = f.get(); 22 | #else 23 | fmt::buffered_file f("test-file", "w"); 24 | fputs(file_content, f.get()); 25 | if (fp) *fp = f.get(); 26 | #endif 27 | return f; 28 | } 29 | 30 | std::locale do_get_locale(const char* name) { 31 | try { 32 | return std::locale(name); 33 | } catch (const std::runtime_error&) { 34 | } 35 | return std::locale::classic(); 36 | } 37 | 38 | std::locale get_locale(const char* name, const char* alt_name) { 39 | auto loc = do_get_locale(name); 40 | if (loc == std::locale::classic() && alt_name) 41 | loc = do_get_locale(alt_name); 42 | #ifdef __OpenBSD__ 43 | // Locales are not working in OpenBSD: 44 | // https://github.com/fmtlib/fmt/issues/3670. 45 | loc = std::locale::classic(); 46 | #endif 47 | if (loc == std::locale::classic()) 48 | fmt::print(stderr, "{} locale is missing.\n", name); 49 | return loc; 50 | } 51 | -------------------------------------------------------------------------------- /third-party/fmt/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 - present, Victor Zverovich and {fmt} contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | --- Optional exception to the license --- 23 | 24 | As an exception, if, as a result of your compiling your source code, portions 25 | of this Software are embedded into a machine-executable object form of such 26 | source code, you may redistribute such embedded portions in such object form 27 | without including the above copyright and permission notices. 28 | -------------------------------------------------------------------------------- /third-party/fmt/doc/fmt.less: -------------------------------------------------------------------------------- 1 | @import 'bootstrap.less'; 2 | 3 | @header-bg: #094d75; 4 | @icon-font-path: "fonts/"; 5 | 6 | html { 7 | overflow-y: scroll; 8 | } 9 | 10 | .navbar { 11 | border-radius: 0; 12 | margin-bottom: 0; 13 | background-color: darken(@header-bg, 10%); 14 | } 15 | 16 | .jumbotron { 17 | #gradient > .vertical(@header-bg; darken(@header-bg, 2%); 50%; 50%); 18 | background-size: 100% 4px; 19 | background-color: @header-bg; 20 | background-repeat: repeat-y; 21 | color: white; 22 | text-align: center; 23 | } 24 | 25 | div.sphinxsidebar { 26 | margin-left: 0; 27 | } 28 | 29 | // Keep content not too wide for better readability. 30 | .navbar-content, .content { 31 | .make-md-column-offset(1); 32 | .make-md-column(10); 33 | .make-lg-column-offset(2); 34 | .make-lg-column(8); 35 | } 36 | 37 | .footer { 38 | padding-top: 20px; 39 | padding-bottom: 20px; 40 | border-top: 1px solid @gray-lighter; 41 | text-align: center; 42 | } 43 | 44 | // Indent descriptions of classes, functions and macros. 45 | .class dd, .function dd, .macro dd { 46 | margin-left: 20px; 47 | } 48 | 49 | // Remove Bootstrap padding for Sphinx containers. 50 | .breathe-sectiondef.container { 51 | padding: 0; 52 | } 53 | 54 | // Remove Bootstrap padding for Sphinx code elements in API signatures. 55 | .descclassname, .descname { 56 | padding: 0; 57 | } 58 | 59 | // Override center alignment in tables. 60 | td { 61 | text-align: left; 62 | } 63 | 64 | p.rubric { 65 | margin-top: 10px; 66 | } 67 | 68 | .github-btn { 69 | border: 0; 70 | overflow: hidden; 71 | } 72 | -------------------------------------------------------------------------------- /src/utils/barrier.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_BARRIER_H 2 | #define INTEGRAL_BARRIER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "types.h" 10 | 11 | class Barrier { 12 | public: 13 | explicit Barrier(I64 expected) { 14 | Reset(expected); 15 | } 16 | 17 | void Reset(I64 expected) { 18 | assert(expected > 0); 19 | assert(current_.load() == total_.load()); 20 | 21 | total_.store(expected, std::memory_order::seq_cst); 22 | current_.store(expected, std::memory_order::seq_cst); 23 | } 24 | 25 | void ArriveAndWait() { 26 | std::unique_lock lock{wait_mutex_}; 27 | 28 | const auto current = --current_; 29 | 30 | if (current > 0) { 31 | const auto phase = phase_.load(std::memory_order::relaxed); 32 | wait_signal_.wait(lock, [this, phase] { 33 | return (phase - phase_.load(std::memory_order::acquire)) < 0; 34 | }); 35 | } else { 36 | const auto total = total_.load(std::memory_order::acquire); 37 | current_.store(total, std::memory_order::release); 38 | 39 | ++phase_; 40 | 41 | wait_signal_.notify_all(); 42 | } 43 | } 44 | 45 | [[nodiscard]] bool IsCleared() const { 46 | return current_.load(std::memory_order::acquire) == 47 | total_.load(std::memory_order::acquire); 48 | } 49 | 50 | private: 51 | std::atomic total_{}; 52 | std::atomic current_{}; 53 | std::atomic phase_{}; 54 | std::mutex wait_mutex_{}; 55 | std::condition_variable wait_signal_{}; 56 | }; 57 | 58 | #endif // INTEGRAL_BARRIER_H -------------------------------------------------------------------------------- /src/engine/search/move_picker.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_MOVE_PICKER_H_ 2 | #define INTEGRAL_MOVE_PICKER_H_ 3 | 4 | #include 5 | 6 | #include "../../chess/move_gen.h" 7 | #include "../evaluation/evaluation.h" 8 | #include "history/history.h" 9 | 10 | namespace search { 11 | 12 | struct ScoredMove { 13 | Move move; 14 | int score; 15 | }; 16 | 17 | enum class MovePickerType { 18 | kSearch, 19 | kQuiescence, 20 | kNoisy = kQuiescence 21 | }; 22 | 23 | class MovePicker { 24 | public: 25 | enum class Stage { 26 | kTTMove, 27 | kGenerateNoisys, 28 | kGoodNoisys, 29 | kFirstKiller, 30 | kSecondKiller, 31 | kGenerateQuiets, 32 | kQuiets, 33 | kBadNoisys, 34 | }; 35 | 36 | MovePicker(MovePickerType type, 37 | Board &board, 38 | Move tt_move, 39 | history::History &history, 40 | StackEntry *stack, 41 | int see_threshold = 0); 42 | 43 | Move Next(); 44 | 45 | void SkipQuiets(); 46 | 47 | [[nodiscard]] Stage GetStage() const { 48 | return stage_; 49 | } 50 | 51 | private: 52 | Move &SelectionSort(List &move_list, int index); 53 | 54 | template 55 | void GenerateAndScoreMoves(List &list); 56 | 57 | int ScoreMove(Move &move); 58 | 59 | private: 60 | Board &board_; 61 | Move tt_move_; 62 | MovePickerType type_; 63 | history::History &history_; 64 | StackEntry *stack_; 65 | Stage stage_; 66 | List noisys_, bad_noisys_; 67 | List quiets_; 68 | int moves_idx_; 69 | int see_threshold_; 70 | }; 71 | 72 | } // namespace search 73 | 74 | #endif // INTEGRAL_MOVE_PICKER_H_ -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/code.less: -------------------------------------------------------------------------------- 1 | // 2 | // Code (inline and block) 3 | // -------------------------------------------------- 4 | 5 | 6 | // Inline and block code styles 7 | code, 8 | kbd, 9 | pre, 10 | samp { 11 | font-family: @font-family-monospace; 12 | } 13 | 14 | // Inline code 15 | code { 16 | padding: 2px 4px; 17 | font-size: 90%; 18 | color: @code-color; 19 | background-color: @code-bg; 20 | border-radius: @border-radius-base; 21 | } 22 | 23 | // User input typically entered via keyboard 24 | kbd { 25 | padding: 2px 4px; 26 | font-size: 90%; 27 | color: @kbd-color; 28 | background-color: @kbd-bg; 29 | border-radius: @border-radius-small; 30 | box-shadow: inset 0 -1px 0 rgba(0,0,0,.25); 31 | 32 | kbd { 33 | padding: 0; 34 | font-size: 100%; 35 | font-weight: bold; 36 | box-shadow: none; 37 | } 38 | } 39 | 40 | // Blocks of code 41 | pre { 42 | display: block; 43 | padding: ((@line-height-computed - 1) / 2); 44 | margin: 0 0 (@line-height-computed / 2); 45 | font-size: (@font-size-base - 1); // 14px to 13px 46 | line-height: @line-height-base; 47 | word-break: break-all; 48 | word-wrap: break-word; 49 | color: @pre-color; 50 | background-color: @pre-bg; 51 | border: 1px solid @pre-border-color; 52 | border-radius: @border-radius-base; 53 | 54 | // Account for some code outputs that place code tags in pre tags 55 | code { 56 | padding: 0; 57 | font-size: inherit; 58 | color: inherit; 59 | white-space: pre-wrap; 60 | background-color: transparent; 61 | border-radius: 0; 62 | } 63 | } 64 | 65 | // Enable scrollable blocks of code 66 | .pre-scrollable { 67 | max-height: @pre-scrollable-max-height; 68 | overflow-y: scroll; 69 | } 70 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container widths 7 | // 8 | // Set the container width, and override it for fixed navbars in media queries. 9 | 10 | .tb-container { 11 | .container-fixed(); 12 | 13 | @media (min-width: @screen-sm-min) { 14 | width: @container-sm; 15 | } 16 | @media (min-width: @screen-md-min) { 17 | width: @container-md; 18 | } 19 | @media (min-width: @screen-lg-min) { 20 | width: @container-lg; 21 | } 22 | } 23 | 24 | 25 | // Fluid container 26 | // 27 | // Utilizes the mixin meant for fixed width containers, but without any defined 28 | // width for fluid, full width layouts. 29 | 30 | .container-fluid { 31 | .container-fixed(); 32 | } 33 | 34 | 35 | // Row 36 | // 37 | // Rows contain and clear the floats of your columns. 38 | 39 | .row { 40 | .make-row(); 41 | } 42 | 43 | 44 | // Columns 45 | // 46 | // Common styles for small and large grid columns 47 | 48 | .make-grid-columns(); 49 | 50 | 51 | // Extra small grid 52 | // 53 | // Columns, offsets, pushes, and pulls for extra small devices like 54 | // smartphones. 55 | 56 | .make-grid(xs); 57 | 58 | 59 | // Small grid 60 | // 61 | // Columns, offsets, pushes, and pulls for the small device range, from phones 62 | // to tablets. 63 | 64 | @media (min-width: @screen-sm-min) { 65 | .make-grid(sm); 66 | } 67 | 68 | 69 | // Medium grid 70 | // 71 | // Columns, offsets, pushes, and pulls for the desktop device range. 72 | 73 | @media (min-width: @screen-md-min) { 74 | .make-grid(md); 75 | } 76 | 77 | 78 | // Large grid 79 | // 80 | // Columns, offsets, pushes, and pulls for the large desktop device range. 81 | 82 | @media (min-width: @screen-lg-min) { 83 | .make-grid(lg); 84 | } 85 | -------------------------------------------------------------------------------- /src/utils/zobrist.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_ZOBRIST_H_ 2 | #define INTEGRAL_ZOBRIST_H_ 3 | 4 | #include "../../shared/multi_array.h" 5 | #include "../chess/bitboard.h" 6 | #include "random.h" 7 | #include "types.h" 8 | 9 | class BoardState; 10 | 11 | namespace zobrist { 12 | 13 | using PieceTable = MultiArray; 14 | using CastleRightsTable = std::array; 15 | using EnPassantTable = std::array; 16 | using FiftyMoveTable = std::array; 17 | 18 | const auto turn = RandomU64(); 19 | 20 | static PieceTable GeneratePieceTable() { 21 | PieceTable piece_table; 22 | for (auto& table : piece_table) 23 | for (U64& entry : table) entry = RandomU64(); 24 | return piece_table; 25 | } 26 | 27 | const auto pieces = GeneratePieceTable(); 28 | 29 | static CastleRightsTable GenerateCastleRightsTable() { 30 | CastleRightsTable castle_rights_table; 31 | for (U64& entry : castle_rights_table) entry = RandomU64(); 32 | return castle_rights_table; 33 | } 34 | 35 | const auto castle_rights = GenerateCastleRightsTable(); 36 | 37 | static EnPassantTable GenerateEnPassantTable() { 38 | EnPassantTable en_passant_table; 39 | for (U64& entry : en_passant_table) entry = RandomU64(); 40 | return en_passant_table; 41 | } 42 | 43 | const auto en_passant = GenerateEnPassantTable(); 44 | 45 | static FiftyMoveTable GenerateFiftyMoveTable() { 46 | FiftyMoveTable fifty_move_table{}; 47 | constexpr int kStep = 8; 48 | for (int i = 14; i < 100; i += kStep) { 49 | const U64 key = RandomU64(); 50 | for (int j = 0; j < kStep; j++) { 51 | if (i + j >= 100) break; 52 | fifty_move_table[i + j] = key; 53 | } 54 | } 55 | return fifty_move_table; 56 | } 57 | 58 | const auto fifty_move = GenerateFiftyMoveTable(); 59 | 60 | } // namespace zobrist 61 | 62 | #endif // INTEGRAL_ZOBRIST_H_ -------------------------------------------------------------------------------- /third-party/fmt/support/compute-powers.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Compute 10 ** exp with exp in the range [min_exponent, max_exponent] and print 3 | # normalized (with most-significant bit equal to 1) significands in hexadecimal. 4 | 5 | from __future__ import print_function 6 | 7 | min_exponent = -348 8 | max_exponent = 340 9 | step = 8 10 | significand_size = 64 11 | exp_offset = 2000 12 | 13 | class fp: 14 | pass 15 | 16 | powers = [] 17 | for i, exp in enumerate(range(min_exponent, max_exponent + 1, step)): 18 | result = fp() 19 | n = 10 ** exp if exp >= 0 else 2 ** exp_offset / 10 ** -exp 20 | k = significand_size + 1 21 | # Convert to binary and round. 22 | binary = '{:b}'.format(n) 23 | result.f = (int('{:0<{}}'.format(binary[:k], k), 2) + 1) / 2 24 | result.e = len(binary) - (exp_offset if exp < 0 else 0) - significand_size 25 | powers.append(result) 26 | # Sanity check. 27 | exp_offset10 = 400 28 | actual = result.f * 10 ** exp_offset10 29 | if result.e > 0: 30 | actual *= 2 ** result.e 31 | else: 32 | for j in range(-result.e): 33 | actual /= 2 34 | expected = 10 ** (exp_offset10 + exp) 35 | precision = len('{}'.format(expected)) - len('{}'.format(actual - expected)) 36 | if precision < 19: 37 | print('low precision:', precision) 38 | exit(1) 39 | 40 | print('Significands:', end='') 41 | for i, fp in enumerate(powers): 42 | if i % 3 == 0: 43 | print(end='\n ') 44 | print(' {:0<#16x}'.format(fp.f, ), end=',') 45 | 46 | print('\n\nExponents:', end='') 47 | for i, fp in enumerate(powers): 48 | if i % 11 == 0: 49 | print(end='\n ') 50 | print(' {:5}'.format(fp.e), end=',') 51 | 52 | print('\n\nMax exponent difference:', 53 | max([x.e - powers[i - 1].e for i, x in enumerate(powers)][1:])) 54 | -------------------------------------------------------------------------------- /third-party/fmt/test/mock-allocator.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - mock allocator 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #ifndef FMT_MOCK_ALLOCATOR_H_ 9 | #define FMT_MOCK_ALLOCATOR_H_ 10 | 11 | #include // assert 12 | #include // size_t 13 | 14 | #include // std::allocator_traits 15 | 16 | #include "gmock/gmock.h" 17 | 18 | template class mock_allocator { 19 | public: 20 | mock_allocator() {} 21 | mock_allocator(const mock_allocator&) {} 22 | using value_type = T; 23 | MOCK_METHOD(T*, allocate, (size_t)); 24 | MOCK_METHOD(void, deallocate, (T*, size_t)); 25 | }; 26 | 27 | template class allocator_ref { 28 | private: 29 | Allocator* alloc_; 30 | 31 | void move(allocator_ref& other) { 32 | alloc_ = other.alloc_; 33 | other.alloc_ = nullptr; 34 | } 35 | 36 | public: 37 | using value_type = typename Allocator::value_type; 38 | 39 | explicit allocator_ref(Allocator* alloc = nullptr) : alloc_(alloc) {} 40 | 41 | allocator_ref(const allocator_ref& other) : alloc_(other.alloc_) {} 42 | allocator_ref(allocator_ref&& other) { move(other); } 43 | 44 | allocator_ref& operator=(allocator_ref&& other) { 45 | assert(this != &other); 46 | move(other); 47 | return *this; 48 | } 49 | 50 | allocator_ref& operator=(const allocator_ref& other) { 51 | alloc_ = other.alloc_; 52 | return *this; 53 | } 54 | 55 | public: 56 | Allocator* get() const { return alloc_; } 57 | 58 | value_type* allocate(size_t n) { 59 | return std::allocator_traits::allocate(*alloc_, n); 60 | } 61 | void deallocate(value_type* p, size_t n) { alloc_->deallocate(p, n); } 62 | }; 63 | 64 | #endif // FMT_MOCK_ALLOCATOR_H_ 65 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: @alert-padding; 11 | margin-bottom: @line-height-computed; 12 | border: 1px solid transparent; 13 | border-radius: @alert-border-radius; 14 | 15 | // Headings for larger alerts 16 | h4 { 17 | margin-top: 0; 18 | // Specified for the h4 to prevent conflicts of changing @headings-color 19 | color: inherit; 20 | } 21 | 22 | // Provide class for links that match alerts 23 | .alert-link { 24 | font-weight: @alert-link-font-weight; 25 | } 26 | 27 | // Improve alignment and spacing of inner content 28 | > p, 29 | > ul { 30 | margin-bottom: 0; 31 | } 32 | 33 | > p + p { 34 | margin-top: 5px; 35 | } 36 | } 37 | 38 | // Dismissible alerts 39 | // 40 | // Expand the right padding and account for the close button's positioning. 41 | 42 | .alert-dismissable, // The misspelled .alert-dismissable was deprecated in 3.2.0. 43 | .alert-dismissible { 44 | padding-right: (@alert-padding + 20); 45 | 46 | // Adjust close link position 47 | .close { 48 | position: relative; 49 | top: -2px; 50 | right: -21px; 51 | color: inherit; 52 | } 53 | } 54 | 55 | // Alternate styles 56 | // 57 | // Generate contextual modifier classes for colorizing the alert. 58 | 59 | .alert-success { 60 | .alert-variant(@alert-success-bg; @alert-success-border; @alert-success-text); 61 | } 62 | 63 | .alert-info { 64 | .alert-variant(@alert-info-bg; @alert-info-border; @alert-info-text); 65 | } 66 | 67 | .alert-warning { 68 | .alert-variant(@alert-warning-bg; @alert-warning-border; @alert-warning-text); 69 | } 70 | 71 | .alert-danger { 72 | .alert-variant(@alert-danger-bg; @alert-danger-border; @alert-danger-text); 73 | } 74 | -------------------------------------------------------------------------------- /third-party/fmt/test/posix-mock.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - mocks of POSIX functions 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #ifndef FMT_POSIX_TEST_H 9 | #define FMT_POSIX_TEST_H 10 | 11 | #include 12 | #include 13 | #include 14 | #ifdef __APPLE__ 15 | # include 16 | #endif 17 | 18 | #ifdef _WIN32 19 | # include 20 | #else 21 | # include // for FreeBSD version 22 | # include // for ssize_t 23 | #endif 24 | 25 | #ifndef _MSC_VER 26 | struct stat; 27 | #endif 28 | 29 | namespace test { 30 | 31 | #ifndef _MSC_VER 32 | // Size type for read and write. 33 | using size_t = size_t; 34 | using ssize_t = ssize_t; 35 | int open(const char* path, int oflag, int mode); 36 | int fstat(int fd, struct stat* buf); 37 | #else 38 | using size_t = unsigned; 39 | using ssize_t = int; 40 | #endif 41 | 42 | #ifndef _WIN32 43 | long sysconf(int name); 44 | #else 45 | DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh); 46 | #endif 47 | 48 | int close(int fildes); 49 | 50 | int dup(int fildes); 51 | int dup2(int fildes, int fildes2); 52 | 53 | FILE* fdopen(int fildes, const char* mode); 54 | 55 | ssize_t read(int fildes, void* buf, size_t nbyte); 56 | ssize_t write(int fildes, const void* buf, size_t nbyte); 57 | 58 | #ifndef _WIN32 59 | int pipe(int fildes[2]); 60 | #else 61 | int pipe(int* pfds, unsigned psize, int textmode); 62 | #endif 63 | 64 | FILE* fopen(const char* filename, const char* mode); 65 | int fclose(FILE* stream); 66 | int(fileno)(FILE* stream); 67 | 68 | #if defined(FMT_LOCALE) && !defined(_WIN32) 69 | locale_t newlocale(int category_mask, const char* locale, locale_t base); 70 | #endif 71 | } // namespace test 72 | 73 | #define FMT_SYSTEM(call) test::call 74 | 75 | #endif // FMT_POSIX_TEST_H 76 | -------------------------------------------------------------------------------- /src/engine/search/history/pawn_history.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_PAWN_HISTORY_H 2 | #define INTEGRAL_PAWN_HISTORY_H 3 | 4 | #include "../../../../shared/multi_array.h" 5 | #include "../stack.h" 6 | #include "bonus.h" 7 | 8 | namespace search::history { 9 | 10 | TUNABLE(kPawnHistFill, -919, -3000, 0, false); 11 | 12 | class PawnHistory { 13 | public: 14 | PawnHistory() : table_({}) { 15 | table_.fill(kPawnHistFill); 16 | } 17 | 18 | void UpdateMoveScore(const BoardState &state, Move move, I16 bonus) { 19 | // Apply a linear dampening to the bonus as the depth increases 20 | I16 &score = table_[GetIndex(state)][state.turn] 21 | [state.GetPieceType(move.GetFrom())][move.GetTo()]; 22 | score += ScaleBonus(score, bonus); 23 | } 24 | 25 | void UpdateScore(const BoardState &state, 26 | StackEntry *stack, 27 | I16 depth, 28 | MoveList &quiets) { 29 | const I16 bonus = HistoryBonus(depth); 30 | 31 | // Apply a linear dampening to the bonus as the depth increases 32 | UpdateMoveScore(state, stack->move, bonus); 33 | 34 | // Lower the score of the quiet moves that failed to raise alpha (gravity) 35 | const I16 penalty = HistoryPenalty(depth); 36 | for (int i = 0; i < quiets.Size(); i++) { 37 | UpdateMoveScore(state, quiets[i], penalty); 38 | } 39 | } 40 | 41 | [[nodiscard]] int GetScore(const BoardState &state, Move move) const { 42 | return table_[GetIndex(state)][state.turn] 43 | [state.GetPieceType(move.GetFrom())][move.GetTo()]; 44 | } 45 | 46 | private: 47 | [[nodiscard]] int GetIndex(const BoardState &state) const { 48 | return state.pawn_key & 16383; 49 | } 50 | 51 | private: 52 | MultiArray table_; 53 | }; 54 | 55 | } // namespace search::history 56 | 57 | #endif // INTEGRAL_PAWN_HISTORY_H 58 | -------------------------------------------------------------------------------- /src/engine/search/cuckoo.cc: -------------------------------------------------------------------------------- 1 | #include "cuckoo.h" 2 | 3 | namespace search::cuckoo { 4 | 5 | void Initialize() { 6 | moves.fill(Move::NullMove()); 7 | keys.fill(0); 8 | 9 | U32 count = 0; 10 | 11 | for (int piece = kKnight; piece <= kKing; ++piece) { 12 | for (Color color : {Color::kWhite, Color::kBlack}) { 13 | const int colored_piece = piece * 2 + color; 14 | for (int from = 0; from < 64; ++from) { 15 | for (int to = from + 1; to < 64; ++to) { 16 | BitBoard possible_moves; 17 | switch (piece) { 18 | case PieceType::kKnight: 19 | possible_moves = move_gen::KnightMoves(from); 20 | break; 21 | case PieceType::kBishop: 22 | possible_moves = move_gen::BishopMoves(from, 0); 23 | break; 24 | case PieceType::kRook: 25 | possible_moves = move_gen::RookMoves(from, 0); 26 | break; 27 | case PieceType::kQueen: 28 | possible_moves = move_gen::QueenMoves(from, 0); 29 | break; 30 | case PieceType::kKing: 31 | possible_moves = move_gen::KingAttacks(from); 32 | break; 33 | } 34 | 35 | if (!possible_moves.IsSet(to)) { 36 | continue; 37 | } 38 | 39 | auto move = Move(from, to); 40 | auto key = zobrist::pieces[colored_piece][from] ^ 41 | zobrist::pieces[colored_piece][to] ^ zobrist::turn; 42 | U32 slot = H1(key); 43 | 44 | while (true) { 45 | std::swap(keys[slot], key); 46 | std::swap(moves[slot], move); 47 | 48 | if (move == Move::NullMove()) { 49 | break; 50 | } 51 | 52 | slot = slot == H1(key) ? H2(key) : H1(key); 53 | } 54 | 55 | ++count; 56 | } 57 | } 58 | } 59 | } 60 | 61 | assert(count == 3668); 62 | } 63 | 64 | } // namespace search::cuckoo -------------------------------------------------------------------------------- /src/chess/move_gen.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_MOVE_GEN_H_ 2 | #define INTEGRAL_MOVE_GEN_H_ 3 | 4 | #include "../utils/types.h" 5 | #include "bitboard.h" 6 | #include "board.h" 7 | 8 | namespace move_gen { 9 | 10 | bool IsSquareAttacked(Square square, Color attacker, const BoardState &state); 11 | 12 | BitBoard PawnAttacks(BitBoard pawns, Color side); 13 | 14 | BitBoard PawnAttacks(Square square, Color side); 15 | 16 | BitBoard PawnPushes(BitBoard pawns, Color side); 17 | 18 | BitBoard PawnPushMoves(Square square, const BoardState &state); 19 | 20 | BitBoard KnightMoves(Square square); 21 | 22 | BitBoard BishopMoves(Square square, const BitBoard &occupied); 23 | 24 | BitBoard RookMoves(Square square, const BitBoard &occupied); 25 | 26 | BitBoard QueenMoves(Square square, const BitBoard &occupied); 27 | 28 | BitBoard KingMoves(Square square, const BoardState &state); 29 | 30 | BitBoard KingAttacks(Square square); 31 | 32 | BitBoard CastlingMoves(Color which, const BoardState &state); 33 | 34 | BitBoard GetAttackedSquares(const BoardState &state, Color attacker); 35 | 36 | BitBoard GetAttackersTo(const BoardState &state, Square square, Color attacker); 37 | 38 | BitBoard GetAttackersTo(const BoardState &state, 39 | Square square, 40 | const BitBoard &occupied, 41 | Color attacker); 42 | 43 | BitBoard GetSlidingAttackersTo(const BoardState &state, 44 | Square square, 45 | const BitBoard &occupied, 46 | Color attacker); 47 | 48 | // Returns a bitboard with the set bits being sliding attacks between the two 49 | // squares 50 | BitBoard RayBetween(Square first, Square second); 51 | 52 | // Returns a bitboard with the set bits being the ray that the two squares lie 53 | // on 54 | BitBoard RayIntersecting(Square first, Square second); 55 | 56 | template 57 | MoveList GenerateMoves(const Board &board); 58 | 59 | } // namespace move_gen 60 | 61 | #endif // INTEGRAL_MOVE_GEN_H_ -------------------------------------------------------------------------------- /src/engine/search/history/quiet_history.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_QUIET_HISTORY_H 2 | #define INTEGRAL_QUIET_HISTORY_H 3 | 4 | #include "../../../../shared/multi_array.h" 5 | #include "../stack.h" 6 | #include "bonus.h" 7 | 8 | namespace search::history { 9 | 10 | class QuietHistory { 11 | public: 12 | QuietHistory() : table_({}) {} 13 | 14 | void UpdateMoveScore(Color turn, Move move, BitBoard threats, I16 bonus) { 15 | // Apply a linear dampening to the bonus as the depth increases 16 | I16 &score = 17 | table_[turn][move.GetFrom()][move.GetTo()] 18 | [threats.IsSet(move.GetFrom())][threats.IsSet(move.GetTo())]; 19 | score += ScaleBonus(score, bonus); 20 | } 21 | 22 | void UpdateScore(const BoardState &state, 23 | StackEntry *stack, 24 | I16 depth, 25 | BitBoard threats, 26 | MoveList &quiets) { 27 | const I16 bonus = HistoryBonus(depth); 28 | 29 | // Apply a linear dampening to the bonus as the depth increases 30 | UpdateMoveScore(state.turn, stack->move, threats, bonus); 31 | 32 | // Lower the score of the quiet moves that failed to raise alpha (gravity) 33 | const I16 penalty = HistoryPenalty(depth); 34 | for (int i = 0; i < quiets.Size(); i++) { 35 | UpdateMoveScore(state.turn, quiets[i], threats, penalty); 36 | } 37 | } 38 | 39 | [[nodiscard]] int GetScore(const BoardState &state, 40 | Move move, 41 | BitBoard threats) const { 42 | return table_[state.turn][move.GetFrom()][move.GetTo()] 43 | [threats.IsSet(move.GetFrom())][threats.IsSet(move.GetTo())]; 44 | } 45 | 46 | private: 47 | [[nodiscard]] int ThreatIndex(Move move, BitBoard threats) const { 48 | return 2 * threats.IsSet(move.GetFrom()) + threats.IsSet(move.GetTo()); 49 | } 50 | 51 | private: 52 | MultiArray table_; 53 | }; 54 | 55 | } // namespace search::history 56 | 57 | #endif // INTEGRAL_QUIET_HISTORY_H -------------------------------------------------------------------------------- /third-party/fmt/test/enforce-checks-test.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - formatting library tests 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include 9 | #include 10 | 11 | #define I 42 // simulate https://en.cppreference.com/w/c/numeric/complex/I 12 | #include "fmt/chrono.h" 13 | #include "fmt/color.h" 14 | #include "fmt/format.h" 15 | #include "fmt/ostream.h" 16 | #include "fmt/ranges.h" 17 | #include "fmt/xchar.h" 18 | #undef I 19 | 20 | // Exercise the API to verify that everything we expect to can compile. 21 | void test_format_api() { 22 | (void)fmt::format(FMT_STRING("{}"), 42); 23 | (void)fmt::format(FMT_STRING(L"{}"), 42); 24 | (void)fmt::format(FMT_STRING("noop")); 25 | 26 | (void)fmt::to_string(42); 27 | (void)fmt::to_wstring(42); 28 | 29 | std::vector out; 30 | fmt::format_to(std::back_inserter(out), FMT_STRING("{}"), 42); 31 | 32 | char buffer[4]; 33 | fmt::format_to_n(buffer, 3, FMT_STRING("{}"), 12345); 34 | 35 | wchar_t wbuffer[4]; 36 | fmt::format_to_n(wbuffer, 3, FMT_STRING(L"{}"), 12345); 37 | } 38 | 39 | void test_chrono() { 40 | (void)fmt::format(FMT_STRING("{}"), std::chrono::seconds(42)); 41 | (void)fmt::format(FMT_STRING(L"{}"), std::chrono::seconds(42)); 42 | } 43 | 44 | void test_text_style() { 45 | fmt::print(fg(fmt::rgb(255, 20, 30)), FMT_STRING("{}"), "rgb(255,20,30)"); 46 | (void)fmt::format(fg(fmt::rgb(255, 20, 30)), FMT_STRING("{}"), 47 | "rgb(255,20,30)"); 48 | 49 | fmt::text_style ts = fg(fmt::rgb(255, 20, 30)); 50 | std::string out; 51 | fmt::format_to(std::back_inserter(out), ts, 52 | FMT_STRING("rgb(255,20,30){}{}{}"), 1, 2, 3); 53 | } 54 | 55 | void test_range() { 56 | std::vector hello = {'h', 'e', 'l', 'l', 'o'}; 57 | (void)fmt::format(FMT_STRING("{}"), hello); 58 | } 59 | 60 | int main() { 61 | test_format_api(); 62 | test_chrono(); 63 | test_text_style(); 64 | test_range(); 65 | } 66 | -------------------------------------------------------------------------------- /src/engine/search/history/capture_history.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_CAPTURE_HISTORY_H 2 | #define INTEGRAL_CAPTURE_HISTORY_H 3 | 4 | #include "../../../../shared/multi_array.h" 5 | #include "../stack.h" 6 | #include "bonus.h" 7 | 8 | namespace search::history { 9 | 10 | class CaptureHistory { 11 | public: 12 | CaptureHistory() : table_({}) {} 13 | 14 | void UpdateScore(const BoardState &state, Move move, I16 depth) { 15 | const I16 bonus = HistoryBonus(depth); 16 | const auto from = move.GetFrom(), to = move.GetTo(); 17 | const auto captured = 18 | move.IsEnPassant(state) ? kPawn : state.GetPieceType(to); 19 | // Apply a linear dampening to the bonus as the depth increases 20 | I16 &score = table_[state.turn][state.GetPieceType(from)][to][captured]; 21 | score += ScaleBonus(score, bonus); 22 | } 23 | 24 | void Penalize(const BoardState &state, I16 depth, MoveList &captures) { 25 | const I16 penalty = HistoryPenalty(depth); 26 | // Lower the score of the capture moves that failed to raise alpha 27 | for (I16 i = 0; i < captures.Size(); i++) { 28 | const Move bad_capture = captures[i]; 29 | const auto from = bad_capture.GetFrom(), to = bad_capture.GetTo(); 30 | const auto captured = 31 | bad_capture.IsEnPassant(state) ? kPawn : state.GetPieceType(to); 32 | // Apply a linear dampening to the penalty as the depth increases 33 | I16 &bad_capture_score = 34 | table_[state.turn][state.GetPieceType(from)][to][captured]; 35 | bad_capture_score += ScaleBonus(bad_capture_score, penalty); 36 | } 37 | } 38 | 39 | [[nodiscard]] I16 GetScore(const BoardState &state, Move move) const { 40 | const auto from = move.GetFrom(), to = move.GetTo(); 41 | const auto captured = 42 | move.IsEnPassant(state) ? kPawn : state.GetPieceType(to); 43 | return table_[state.turn][state.GetPieceType(from)][to][captured]; 44 | } 45 | 46 | private: 47 | MultiArray 48 | table_; 49 | }; 50 | 51 | } // namespace search::history 52 | 53 | #endif // INTEGRAL_CAPTURE_HISTORY_H -------------------------------------------------------------------------------- /third-party/fmt/doc/_templates/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2015 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {% set script_files = script_files + ['_static/searchtools.js'] %} 13 | {% block extrahead %} 14 | 17 | {# this is used when loading the search index using $.ajax fails, 18 | such as on Chrome for documents on localhost #} 19 | 20 | {{ super() }} 21 | {% endblock %} 22 | {% block body %} 23 |

{{ _('Search') }}

24 |
25 | 26 |

27 | {% trans %}Please activate JavaScript to enable the search 28 | functionality.{% endtrans %} 29 |

30 |
31 |

32 | {% trans %}From here you can search these documents. Enter your search 33 | words into the box below and click "search". Note that the search 34 | function will automatically search for all of the words. Pages 35 | containing fewer words won't appear in the result list.{% endtrans %} 36 |

37 | {{ searchform('form-inline', True) }} 38 | {% if search_performed %} 39 |

{{ _('Search Results') }}

40 | {% if not search_results %} 41 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

42 | {% endif %} 43 | {% endif %} 44 |
45 | {% if search_results %} 46 |
    47 | {% for href, caption, context in search_results %} 48 |
  • {{ caption }} 49 |
    {{ context|e }}
    50 |
  • 51 | {% endfor %} 52 |
53 | {% endif %} 54 |
55 | {% endblock %} 56 | -------------------------------------------------------------------------------- /src/engine/evaluation/evaluation.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_EVAL_H_ 2 | #define INTEGRAL_EVAL_H_ 3 | 4 | #include "../../chess/board.h" 5 | #include "../../tuner/spsa.h" 6 | 7 | namespace eval { 8 | 9 | TUNABLE(kSeePawnScore, 111, 50, 150, false); 10 | TUNABLE(kSeeKnightScore, 368, 200, 400, false); 11 | TUNABLE(kSeeBishopScore, 393, 200, 400, false); 12 | TUNABLE(kSeeRookScore, 588, 400, 600, false); 13 | TUNABLE(kSeeQueenScore, 1232, 700, 1500, false); 14 | TUNABLE(kSeeKingScore, 0, 0, 0, true); // Always 0 15 | TUNABLE(kSeeNoneScore, 0, 0, 0, true); // Always 0 16 | 17 | // clang-format off 18 | inline std::array kSeePieceScores = { 19 | &kSeePawnScore, 20 | &kSeeKnightScore, 21 | &kSeeBishopScore, 22 | &kSeeRookScore, 23 | &kSeeQueenScore, 24 | &kSeeKingScore, 25 | &kSeeNoneScore 26 | }; 27 | // clang-format on 28 | 29 | // Constants derived from WDL_model 30 | constexpr std::array kAs = { 31 | 86.66506958, -259.82299819, 205.33735813, 127.53923650}; 32 | 33 | [[nodiscard]] static Score NormalizeScore(Score score, int material_count) { 34 | if (score == 0 || std::abs(score) >= kTBWinInMaxPlyScore) return score; 35 | 36 | const auto material_constant = 37 | static_cast(std::clamp(material_count, 17, 78)) / 58.0; 38 | const auto wdl_param = 39 | ((kAs[0] * material_constant + kAs[1]) * material_constant + kAs[2]) * 40 | material_constant + 41 | kAs[3]; 42 | return static_cast( 43 | std::round(100.0 * static_cast(score) / wdl_param)); 44 | } 45 | 46 | [[nodiscard]] static bool IsMateScore(int evaluation) { 47 | return kMateScore - std::abs(evaluation) <= kMaxPlyFromRoot; 48 | } 49 | 50 | [[nodiscard]] static int MateIn(int evaluation) { 51 | if (evaluation > 0 && evaluation <= kMateScore) { // Mate in favor 52 | return (kMateScore - evaluation + 1) / 2; 53 | } else if (evaluation < 0 && evaluation >= -kMateScore) { // Mate against 54 | return -(kMateScore + evaluation) / 2; 55 | } 56 | // Not a mate score 57 | return evaluation; 58 | } 59 | 60 | bool StaticExchange(Move move, int threshold, const BoardState &state); 61 | 62 | Score Evaluate(Board &board); 63 | 64 | } // namespace eval 65 | 66 | #endif // INTEGRAL_EVAL_H_ -------------------------------------------------------------------------------- /third-party/fmt/support/build-docs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Build the documentation in CI. 3 | 4 | from __future__ import print_function 5 | import errno, os, shutil, subprocess, sys, urllib 6 | from subprocess import call, check_call, Popen, PIPE, STDOUT 7 | 8 | def rmtree_if_exists(dir): 9 | try: 10 | shutil.rmtree(dir) 11 | except OSError as e: 12 | if e.errno == errno.ENOENT: 13 | pass 14 | 15 | # Build the docs. 16 | fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) 17 | sys.path.insert(0, os.path.join(fmt_dir, 'doc')) 18 | import build 19 | build.create_build_env() 20 | html_dir = build.build_docs() 21 | 22 | repo = 'fmtlib.github.io' 23 | branch = os.environ['GITHUB_REF'] 24 | is_ci = 'CI' in os.environ 25 | if is_ci and branch != 'refs/heads/master': 26 | print('Branch: ' + branch) 27 | exit(0) # Ignore non-master branches 28 | if is_ci and 'KEY' not in os.environ: 29 | # Don't update the repo if building in CI from an account that doesn't have 30 | # push access. 31 | print('Skipping update of ' + repo) 32 | exit(0) 33 | 34 | # Clone the fmtlib.github.io repo. 35 | rmtree_if_exists(repo) 36 | git_url = 'https://github.com/' if is_ci else 'git@github.com:' 37 | check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)]) 38 | 39 | # Copy docs to the repo. 40 | target_dir = os.path.join(repo, 'dev') 41 | rmtree_if_exists(target_dir) 42 | shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*')) 43 | if is_ci: 44 | check_call(['git', 'config', '--global', 'user.name', 'fmtbot']) 45 | check_call(['git', 'config', '--global', 'user.email', 'viz@fmt.dev']) 46 | 47 | # Push docs to GitHub pages. 48 | check_call(['git', 'add', '--all'], cwd=repo) 49 | if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo): 50 | check_call(['git', 'commit', '-m', 'Update documentation'], cwd=repo) 51 | cmd = 'git push' 52 | if is_ci: 53 | cmd += ' https://$KEY@github.com/fmtlib/fmtlib.github.io.git master' 54 | p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=repo) 55 | # Print the output without the key. 56 | print(p.communicate()[0].decode('utf-8').replace(os.environ['KEY'], '$KEY')) 57 | if p.returncode != 0: 58 | raise subprocess.CalledProcessError(p.returncode, cmd) 59 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/progress-bars.less: -------------------------------------------------------------------------------- 1 | // 2 | // Progress bars 3 | // -------------------------------------------------- 4 | 5 | 6 | // Bar animations 7 | // ------------------------- 8 | 9 | // WebKit 10 | @-webkit-keyframes progress-bar-stripes { 11 | from { background-position: 40px 0; } 12 | to { background-position: 0 0; } 13 | } 14 | 15 | // Spec and IE10+ 16 | @keyframes progress-bar-stripes { 17 | from { background-position: 40px 0; } 18 | to { background-position: 0 0; } 19 | } 20 | 21 | 22 | // Bar itself 23 | // ------------------------- 24 | 25 | // Outer container 26 | .progress { 27 | overflow: hidden; 28 | height: @line-height-computed; 29 | margin-bottom: @line-height-computed; 30 | background-color: @progress-bg; 31 | border-radius: @progress-border-radius; 32 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); 33 | } 34 | 35 | // Bar of progress 36 | .progress-bar { 37 | float: left; 38 | width: 0%; 39 | height: 100%; 40 | font-size: @font-size-small; 41 | line-height: @line-height-computed; 42 | color: @progress-bar-color; 43 | text-align: center; 44 | background-color: @progress-bar-bg; 45 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); 46 | .transition(width .6s ease); 47 | } 48 | 49 | // Striped bars 50 | // 51 | // `.progress-striped .progress-bar` is deprecated as of v3.2.0 in favor of the 52 | // `.progress-bar-striped` class, which you just add to an existing 53 | // `.progress-bar`. 54 | .progress-striped .progress-bar, 55 | .progress-bar-striped { 56 | #gradient > .striped(); 57 | background-size: 40px 40px; 58 | } 59 | 60 | // Call animation for the active one 61 | // 62 | // `.progress.active .progress-bar` is deprecated as of v3.2.0 in favor of the 63 | // `.progress-bar.active` approach. 64 | .progress.active .progress-bar, 65 | .progress-bar.active { 66 | .animation(progress-bar-stripes 2s linear infinite); 67 | } 68 | 69 | 70 | // Variations 71 | // ------------------------- 72 | 73 | .progress-bar-success { 74 | .progress-bar-variant(@progress-bar-success-bg); 75 | } 76 | 77 | .progress-bar-info { 78 | .progress-bar-variant(@progress-bar-info-bg); 79 | } 80 | 81 | .progress-bar-warning { 82 | .progress-bar-variant(@progress-bar-warning-bg); 83 | } 84 | 85 | .progress-bar-danger { 86 | .progress-bar-variant(@progress-bar-danger-bg); 87 | } 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Integral Chess Engine 3 |

Integral

4 | Integral is a top chess engine developed in C++. It is a personal project developed with the goal of meshing my admiration for chess with programming. 5 |
6 |
7 | Play against Integral on Lichess 8 | 9 |
10 | 11 | ## Search 12 | Integral implements the widely adopted negamax search approach with alpha-beta pruning, and alongside it the various search heuristics that it enables. It utilizes the Lazy SMP approach for multi-threaded search, and has been proven to scale very well at higher thread counts compared to other alpha-beta chess engines. 13 | 14 | ## Evaluation 15 | Integral utilizes an efficiently updatable neural network (NNUE) for its evaluation function. 16 | 17 | ### Architecture 18 | Integral's neural network is a horizontally mirrored perspective network, containing 12 factorized king input buckets, an L1 of 1536 neurons, an L2 of 16 neurons, an L3 of 32 neurons, and 8 output buckets. 19 | `(768x12 (Factorized) -> 1536)x2 -> (16 -> 32 -> 1)1x8` 20 | 21 | ### Data Generation Process 22 | This neural network is trained on tens of millions of self-play games. Each self-play game starts with 3-4 randomly selected moves off a randomly selected opening from the **UHO_Lichess_4852_v1** book. Additionally, 5-man Syzygy endgame tablebases are used to guide the data generation search. 23 | 24 | ### Training Process 25 | The first iteration of Integral's neural network was trained on data from version 4, which had a powerful hand-crafted evaluation (HCE). Each iteration of Integral's neural network since then has been trained on a fresh dataset using the prior network. 26 | All networks are trained using the Bullet trainer, which has made my life way easier. 27 | 28 | ## Compiling Integral 29 | > [!NOTE] 30 | > Integral should be compiled with GCC >= v13 or Clang >= v10 31 | 32 | Integral provides a Makefile for compilation, but you can use CMake as well.\ 33 | To compile Integral, enter the following commands in a terminal: 34 | ``` 35 | git clone https://github.com/aronpetko/integral 36 | cd integral 37 | make [native | vnni512 | avx512 | avx2_bmi2 | avx2 | sse41_popcnt] 38 | ``` -------------------------------------------------------------------------------- /third-party/fmt/test/gtest-extra.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - custom Google Test assertions 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "gtest-extra.h" 9 | 10 | #if FMT_USE_FCNTL 11 | 12 | using fmt::file; 13 | 14 | output_redirect::output_redirect(FILE* f, bool flush) : file_(f) { 15 | if (flush) this->flush(); 16 | int fd = FMT_POSIX(fileno(f)); 17 | // Create a file object referring to the original file. 18 | original_ = file::dup(fd); 19 | // Create a pipe. 20 | file write_end; 21 | file::pipe(read_end_, write_end); 22 | // Connect the passed FILE object to the write end of the pipe. 23 | write_end.dup2(fd); 24 | } 25 | 26 | output_redirect::~output_redirect() noexcept { 27 | try { 28 | restore(); 29 | } catch (const std::exception& e) { 30 | std::fputs(e.what(), stderr); 31 | } 32 | } 33 | 34 | void output_redirect::flush() { 35 | int result = 0; 36 | do { 37 | result = fflush(file_); 38 | } while (result == EOF && errno == EINTR); 39 | if (result != 0) throw fmt::system_error(errno, "cannot flush stream"); 40 | } 41 | 42 | void output_redirect::restore() { 43 | if (original_.descriptor() == -1) return; // Already restored. 44 | flush(); 45 | // Restore the original file. 46 | original_.dup2(FMT_POSIX(fileno(file_))); 47 | original_.close(); 48 | } 49 | 50 | std::string output_redirect::restore_and_read() { 51 | // Restore output. 52 | restore(); 53 | 54 | // Read everything from the pipe. 55 | std::string content; 56 | if (read_end_.descriptor() == -1) return content; // Already read. 57 | enum { BUFFER_SIZE = 4096 }; 58 | char buffer[BUFFER_SIZE]; 59 | size_t count = 0; 60 | do { 61 | count = read_end_.read(buffer, BUFFER_SIZE); 62 | content.append(buffer, count); 63 | } while (count != 0); 64 | read_end_.close(); 65 | return content; 66 | } 67 | 68 | std::string read(file& f, size_t count) { 69 | std::string buffer(count, '\0'); 70 | size_t n = 0, offset = 0; 71 | do { 72 | n = f.read(&buffer[offset], count - offset); 73 | // We can't read more than size_t bytes since count has type size_t. 74 | offset += n; 75 | } while (offset < count && n != 0); 76 | buffer.resize(offset); 77 | return buffer; 78 | } 79 | 80 | #endif // FMT_USE_FCNTL 81 | -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/pagination.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pagination (multiple pages) 3 | // -------------------------------------------------- 4 | .pagination { 5 | display: inline-block; 6 | padding-left: 0; 7 | margin: @line-height-computed 0; 8 | border-radius: @border-radius-base; 9 | 10 | > li { 11 | display: inline; // Remove list-style and block-level defaults 12 | > a, 13 | > span { 14 | position: relative; 15 | float: left; // Collapse white-space 16 | padding: @padding-base-vertical @padding-base-horizontal; 17 | line-height: @line-height-base; 18 | text-decoration: none; 19 | color: @pagination-color; 20 | background-color: @pagination-bg; 21 | border: 1px solid @pagination-border; 22 | margin-left: -1px; 23 | } 24 | &:first-child { 25 | > a, 26 | > span { 27 | margin-left: 0; 28 | .border-left-radius(@border-radius-base); 29 | } 30 | } 31 | &:last-child { 32 | > a, 33 | > span { 34 | .border-right-radius(@border-radius-base); 35 | } 36 | } 37 | } 38 | 39 | > li > a, 40 | > li > span { 41 | &:hover, 42 | &:focus { 43 | color: @pagination-hover-color; 44 | background-color: @pagination-hover-bg; 45 | border-color: @pagination-hover-border; 46 | } 47 | } 48 | 49 | > .active > a, 50 | > .active > span { 51 | &, 52 | &:hover, 53 | &:focus { 54 | z-index: 2; 55 | color: @pagination-active-color; 56 | background-color: @pagination-active-bg; 57 | border-color: @pagination-active-border; 58 | cursor: default; 59 | } 60 | } 61 | 62 | > .disabled { 63 | > span, 64 | > span:hover, 65 | > span:focus, 66 | > a, 67 | > a:hover, 68 | > a:focus { 69 | color: @pagination-disabled-color; 70 | background-color: @pagination-disabled-bg; 71 | border-color: @pagination-disabled-border; 72 | cursor: @cursor-disabled; 73 | } 74 | } 75 | } 76 | 77 | // Sizing 78 | // -------------------------------------------------- 79 | 80 | // Large 81 | .pagination-lg { 82 | .pagination-size(@padding-large-vertical; @padding-large-horizontal; @font-size-large; @border-radius-large); 83 | } 84 | 85 | // Small 86 | .pagination-sm { 87 | .pagination-size(@padding-small-vertical; @padding-small-horizontal; @font-size-small; @border-radius-small); 88 | } 89 | -------------------------------------------------------------------------------- /third-party/fmt/test/util.h: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ - test utilities 2 | // 3 | // Copyright (c) 2012 - present, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #include "fmt/os.h" 14 | 15 | #ifdef _MSC_VER 16 | # define FMT_VSNPRINTF vsprintf_s 17 | #else 18 | # define FMT_VSNPRINTF vsnprintf 19 | #endif 20 | 21 | template 22 | void safe_sprintf(char (&buffer)[SIZE], const char* format, ...) { 23 | std::va_list args; 24 | va_start(args, format); 25 | FMT_VSNPRINTF(buffer, SIZE, format, args); 26 | va_end(args); 27 | } 28 | 29 | extern const char* const file_content; 30 | 31 | // Opens a buffered file for reading. 32 | auto open_buffered_file(FILE** fp = nullptr) -> fmt::buffered_file; 33 | 34 | inline auto safe_fopen(const char* filename, const char* mode) -> FILE* { 35 | #if defined(_WIN32) && !defined(__MINGW32__) 36 | // Fix MSVC warning about "unsafe" fopen. 37 | FILE* f = nullptr; 38 | errno = fopen_s(&f, filename, mode); 39 | return f; 40 | #else 41 | return std::fopen(filename, mode); 42 | #endif 43 | } 44 | 45 | template class basic_test_string { 46 | private: 47 | std::basic_string value_; 48 | 49 | static const Char empty[]; 50 | 51 | public: 52 | explicit basic_test_string(const Char* value = empty) : value_(value) {} 53 | 54 | auto value() const -> const std::basic_string& { return value_; } 55 | }; 56 | 57 | template const Char basic_test_string::empty[] = {0}; 58 | 59 | using test_string = basic_test_string; 60 | using test_wstring = basic_test_string; 61 | 62 | template 63 | auto operator<<(std::basic_ostream& os, const basic_test_string& s) 64 | -> std::basic_ostream& { 65 | os << s.value(); 66 | return os; 67 | } 68 | 69 | class date { 70 | int year_, month_, day_; 71 | 72 | public: 73 | date(int year, int month, int day) : year_(year), month_(month), day_(day) {} 74 | 75 | auto year() const -> int { return year_; } 76 | auto month() const -> int { return month_; } 77 | auto day() const -> int { return day_; } 78 | }; 79 | 80 | // Returns a locale with the given name if available or classic locale 81 | // otherwise. 82 | auto get_locale(const char* name, const char* alt_name = nullptr) 83 | -> std::locale; 84 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/one-arg.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019, Paul Dreik 2 | // For the license information refer to format.h. 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | #include "fuzzer-common.h" 10 | 11 | template const T* from_repr(const Repr& r) { 12 | return &r; 13 | } 14 | 15 | template <> const std::tm* from_repr(const std::time_t& t) { 16 | return std::localtime(&t); 17 | } 18 | 19 | template 20 | void invoke_fmt(const uint8_t* data, size_t size) { 21 | static_assert(sizeof(Repr) <= fixed_size, "Nfixed is too small"); 22 | if (size <= fixed_size) return; 23 | auto repr = assign_from_buf(data); 24 | const T* value = from_repr(repr); 25 | if (!value) return; 26 | data += fixed_size; 27 | size -= fixed_size; 28 | data_to_string format_str(data, size); 29 | try { 30 | #if FMT_FUZZ_FORMAT_TO_STRING 31 | std::string message = fmt::format(format_str.get(), *value); 32 | #else 33 | auto buf = fmt::memory_buffer(); 34 | fmt::format_to(std::back_inserter(buf), format_str.get(), *value); 35 | #endif 36 | } catch (std::exception&) { 37 | } 38 | } 39 | 40 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 41 | if (size <= 3) return 0; 42 | 43 | const auto first = data[0]; 44 | data++; 45 | size--; 46 | 47 | switch (first) { 48 | case 0: 49 | invoke_fmt(data, size); 50 | break; 51 | case 1: 52 | invoke_fmt(data, size); 53 | break; 54 | case 2: 55 | invoke_fmt(data, size); 56 | break; 57 | case 3: 58 | invoke_fmt(data, size); 59 | break; 60 | case 4: 61 | invoke_fmt(data, size); 62 | break; 63 | case 5: 64 | invoke_fmt(data, size); 65 | break; 66 | case 6: 67 | invoke_fmt(data, size); 68 | break; 69 | case 7: 70 | invoke_fmt(data, size); 71 | break; 72 | case 8: 73 | invoke_fmt(data, size); 74 | break; 75 | case 9: 76 | invoke_fmt(data, size); 77 | break; 78 | case 10: 79 | invoke_fmt(data, size); 80 | break; 81 | case 11: 82 | invoke_fmt(data, size); 83 | break; 84 | case 12: 85 | invoke_fmt(data, size); 86 | break; 87 | case 13: 88 | invoke_fmt(data, size); 89 | break; 90 | } 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /shared/nnue/definitions.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_ARCH_H 2 | #define INTEGRAL_ARCH_H 3 | 4 | #include 5 | 6 | #include "../multi_array.h" 7 | #include "../simd.h" 8 | 9 | namespace nnue { 10 | 11 | namespace arch { 12 | 13 | constexpr std::size_t kL1Size = 1536; 14 | constexpr std::size_t kL2Size = 16; 15 | constexpr std::size_t kL3Size = 32; 16 | constexpr std::size_t kInputBucketCount = 12; 17 | constexpr std::size_t kOutputBucketCount = 8; 18 | 19 | constexpr std::int32_t kFtQuantization = 255; 20 | constexpr std::int32_t kL1Quantization = 128; 21 | 22 | constexpr std::int32_t kEvalScale = 200; 23 | 24 | } // namespace arch 25 | 26 | // clang-format off 27 | struct RawNetwork { 28 | MultiArray feature_weights; 29 | MultiArray feature_biases; 30 | MultiArray l1_weights; 31 | MultiArray l1_biases; 32 | MultiArray l2_weights; 33 | MultiArray l2_biases; 34 | MultiArray l3_weights; 35 | MultiArray l3_biases; 36 | }; 37 | 38 | struct alignas(simd::kAlignment) Network { 39 | alignas(simd::kAlignment) MultiArray feature_weights; 40 | alignas(simd::kAlignment) MultiArray feature_biases; 41 | union { 42 | alignas(simd::kAlignment) MultiArray l1_weights; 43 | alignas(simd::kAlignment) MultiArray l1_weights_alt; 44 | }; 45 | alignas(simd::kAlignment) MultiArray l1_biases; 46 | alignas(simd::kAlignment) MultiArray l2_weights; 47 | alignas(simd::kAlignment) MultiArray l2_biases; 48 | alignas(simd::kAlignment) MultiArray l3_weights; 49 | alignas(simd::kAlignment) MultiArray l3_biases; 50 | }; 51 | // clang-format on 52 | 53 | }; // namespace nnue 54 | 55 | #endif // INTEGRAL_ARCH_H -------------------------------------------------------------------------------- /preprocess/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | set(CMAKE_CXX_STANDARD 20) 3 | 4 | # Build options for different architectures 5 | option(BUILD_NATIVE "Build with native optimizations" ${PREPROCESS_BUILD_NATIVE}) 6 | option(BUILD_VNNI512 "Build with AVX512 VNNI support" ${PREPROCESS_BUILD_VNNI512}) 7 | option(BUILD_AVX512 "Build with AVX512 optimizations" ${PREPROCESS_BUILD_AVX512}) 8 | option(BUILD_AVX2_BMI2 "Build with AVX2 + BMI2 optimizations" ${PREPROCESS_BUILD_AVX2_BMI2}) 9 | option(BUILD_AVX2 "Build with AVX2 optimizations" ${PREPROCESS_BUILD_AVX2}) 10 | option(BUILD_SSE41_POPCNT "Build with SSE4.1 + POPCNT optimizations" ${PREPROCESS_BUILD_SSE41_POPCNT}) 11 | option(BUILD_DEBUG "Build with debug information" ${PREPROCESS_BUILD_DEBUG}) 12 | option(SPARSE_PERMUTE "Use sparse permute network format" ${PREPROCESS_SPARSE_PERMUTE}) 13 | 14 | # Architecture-specific flags 15 | set(CXXFLAGS_NATIVE "-march=native") 16 | set(CXXFLAGS_VNNI512 "-march=znver4 -mtune=znver4 -DBUILD_VNNI512 -DBUILD_FAST_PEXT") 17 | set(CXXFLAGS_AVX512 "-march=x86-64-v4 -mtune=skylake-avx512 -DBUILD_AVX512 -DBUILD_FAST_PEXT") 18 | set(CXXFLAGS_AVX2_BMI2 "-march=haswell -mtune=haswell -mavx2 -mbmi2 -DBUILD_AVX2_BMI2 -DBUILD_FAST_PEXT") 19 | set(CXXFLAGS_AVX2 "-march=bdver4 -mno-tbm -mno-sse4a -mno-bmi2 -mtune=znver2 -DBUILD_AVX2") 20 | set(CXXFLAGS_SSE41_POPCNT "-march=nehalem -mtune=sandybridge -DBUILD_SSE41_POPCNT") 21 | 22 | # Apply the correct flags based on the build type 23 | if (BUILD_DEBUG) 24 | set(CMAKE_BUILD_TYPE Debug) 25 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_DEBUG} -g -O0") 26 | elseif (BUILD_VNNI512) 27 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_VNNI512} -DBUILD_VNNI512") 28 | elseif (BUILD_AVX512) 29 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_AVX512} -DBUILD_AVX512") 30 | elseif (BUILD_AVX2_BMI2) 31 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_AVX2_BMI2} -DBUILD_AVX2_BMI2") 32 | elseif (BUILD_AVX2) 33 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_AVX2} -DBUILD_AVX2") 34 | elseif (BUILD_SSE41_POPCNT) 35 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_SSE41_POPCNT} -DBUILD_SSE41_POPCNT") 36 | elseif (BUILD_NATIVE) 37 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXXFLAGS_NATIVE} -DBUILD_NATIVE") 38 | endif () 39 | 40 | # Include third-party directories 41 | include_directories(../third-party/fathom) 42 | include_directories(../third-party/fmt/include) 43 | add_definitions(-DFMT_HEADER_ONLY) 44 | 45 | add_executable(preprocess net_processing.cc) -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Creates fuzzer builds of various kinds 4 | # - oss-fuzz emulated mode (makes sure a simulated invocation by oss-fuzz works) 5 | # - libFuzzer build (you will need clang) 6 | # - afl build (you will need afl) 7 | # 8 | # 9 | # Copyright (c) 2019 Paul Dreik 10 | # 11 | # For the license information refer to format.h. 12 | 13 | set -e 14 | me=$(basename $0) 15 | root=$(readlink -f "$(dirname "$0")/../..") 16 | 17 | 18 | echo $me: root=$root 19 | 20 | here=$(pwd) 21 | 22 | CXXFLAGSALL="-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION= -g" 23 | CMAKEFLAGSALL="$root -GNinja -DCMAKE_BUILD_TYPE=Debug -DFMT_DOC=Off -DFMT_TEST=Off -DFMT_FUZZ=On -DCMAKE_CXX_STANDARD=17" 24 | 25 | CLANG=clang++-11 26 | 27 | # For performance analysis of the fuzzers. 28 | builddir=$here/build-fuzzers-perfanalysis 29 | mkdir -p $builddir 30 | cd $builddir 31 | CXX="ccache g++" CXXFLAGS="$CXXFLAGSALL -g" cmake \ 32 | $CMAKEFLAGSALL \ 33 | -DFMT_FUZZ_LINKMAIN=On \ 34 | -DCMAKE_BUILD_TYPE=Release 35 | 36 | cmake --build $builddir 37 | 38 | # Builds the fuzzers as oss-fuzz does. 39 | builddir=$here/build-fuzzers-ossfuzz 40 | mkdir -p $builddir 41 | cd $builddir 42 | CXX=$CLANG \ 43 | CXXFLAGS="$CXXFLAGSALL -fsanitize=fuzzer-no-link" cmake \ 44 | cmake $CMAKEFLAGSALL \ 45 | -DFMT_FUZZ_LINKMAIN=Off \ 46 | -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer" 47 | 48 | cmake --build $builddir 49 | 50 | 51 | # Builds fuzzers for local fuzzing with libfuzzer with asan+usan. 52 | builddir=$here/build-fuzzers-libfuzzer 53 | mkdir -p $builddir 54 | cd $builddir 55 | CXX=$CLANG \ 56 | CXXFLAGS="$CXXFLAGSALL -fsanitize=fuzzer-no-link,address,undefined" cmake \ 57 | cmake $CMAKEFLAGSALL \ 58 | -DFMT_FUZZ_LINKMAIN=Off \ 59 | -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer" 60 | 61 | cmake --build $builddir 62 | 63 | # Builds a fast fuzzer for making coverage fast. 64 | builddir=$here/build-fuzzers-fast 65 | mkdir -p $builddir 66 | cd $builddir 67 | CXX=$CLANG \ 68 | CXXFLAGS="$CXXFLAGSALL -fsanitize=fuzzer-no-link -O3" cmake \ 69 | cmake $CMAKEFLAGSALL \ 70 | -DFMT_FUZZ_LINKMAIN=Off \ 71 | -DFMT_FUZZ_LDFLAGS="-fsanitize=fuzzer" \ 72 | -DCMAKE_BUILD_TYPE=Release 73 | 74 | cmake --build $builddir 75 | 76 | 77 | # Builds fuzzers for local fuzzing with afl. 78 | builddir=$here/build-fuzzers-afl 79 | mkdir -p $builddir 80 | cd $builddir 81 | CXX="afl-g++" \ 82 | CXXFLAGS="$CXXFLAGSALL -fsanitize=address,undefined" \ 83 | cmake $CMAKEFLAGSALL \ 84 | -DFMT_FUZZ_LINKMAIN=On 85 | 86 | cmake --build $builddir 87 | 88 | 89 | echo $me: all good 90 | 91 | -------------------------------------------------------------------------------- /src/tuner/spsa.h: -------------------------------------------------------------------------------- 1 | #ifndef INTEGRAL_SPSA_H 2 | #define INTEGRAL_SPSA_H 3 | 4 | #include 5 | #include 6 | #include "../engine/uci/uci.h" 7 | 8 | // #define SPSA_TUNE 9 | #define PRINT_SPSA_INPUTS 10 | 11 | #ifdef SPSA_TUNE 12 | #define TUNABLE(name, value, min, max, disabled) \ 13 | inline Tunable name(#name, value, min, max, (max - min) / 20, disabled) 14 | 15 | #define TUNABLE_STEP(name, value, min, max, disabled, step) \ 16 | inline Tunable name(#name, value, min, max, step, disabled) 17 | 18 | constexpr double kLearningRate = 0.002; 19 | 20 | template 21 | class Tunable { 22 | public: 23 | explicit Tunable(std::string_view name, 24 | T value, 25 | T min, 26 | T max, 27 | T step = T{}, 28 | bool disabled = false) 29 | : value_(value), 30 | step_(step), 31 | learning_rate_(kLearningRate) { 32 | #ifdef SPSA_TUNE 33 | if (disabled) return; 34 | 35 | if constexpr (std::is_same_v) { 36 | uci::listener.AddOption( 37 | name, value, min, max, [this](uci::Option &option) { 38 | value_ = option.GetValue(); 39 | }); 40 | #ifdef PRINT_SPSA_INPUTS 41 | fmt::println("{}, int, {}, {}, {}, {}, {}", name, value, min, max, step_, learning_rate_); 42 | #endif 43 | } else if constexpr (std::is_same_v) { 44 | uci::listener.AddOption( 45 | name, std::to_string(value), [this](uci::Option &option) { 46 | value_ = std::stod(option.GetValue()); 47 | }); 48 | #ifdef PRINT_SPSA_INPUTS 49 | fmt::println("{}, float, {}, {}, {}, {}, {}", name, value, min, max, step_, learning_rate_); 50 | #endif 51 | } 52 | #endif 53 | } 54 | 55 | constexpr operator T() const { 56 | return value_; 57 | } 58 | 59 | [[nodiscard]] T Get() const { 60 | return value_; 61 | } 62 | 63 | [[nodiscard]] T GetStep() const { 64 | return step_; 65 | } 66 | 67 | [[nodiscard]] double GetLearningRate() const { 68 | return learning_rate_; 69 | } 70 | 71 | private: 72 | T value_; 73 | T step_; 74 | double learning_rate_; 75 | }; 76 | #else 77 | #define TUNABLE(name, value, min, max, disabled) \ 78 | static constexpr auto name = value 79 | 80 | #define TUNABLE_STEP(name, value, min, max, disabled, step) \ 81 | static constexpr auto name = value 82 | 83 | template 84 | using Tunable = T; 85 | #endif 86 | 87 | #endif // INTEGRAL_SPSA_H -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/print.less: -------------------------------------------------------------------------------- 1 | /*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */ 2 | 3 | // ========================================================================== 4 | // Print styles. 5 | // Inlined to avoid the additional HTTP request: h5bp.com/r 6 | // ========================================================================== 7 | 8 | @media print { 9 | *, 10 | *:before, 11 | *:after { 12 | background: transparent !important; 13 | color: #000 !important; // Black prints faster: h5bp.com/s 14 | box-shadow: none !important; 15 | text-shadow: none !important; 16 | } 17 | 18 | a, 19 | a:visited { 20 | text-decoration: underline; 21 | } 22 | 23 | a[href]:after { 24 | content: " (" attr(href) ")"; 25 | } 26 | 27 | abbr[title]:after { 28 | content: " (" attr(title) ")"; 29 | } 30 | 31 | // Don't show links that are fragment identifiers, 32 | // or use the `javascript:` pseudo protocol 33 | a[href^="#"]:after, 34 | a[href^="javascript:"]:after { 35 | content: ""; 36 | } 37 | 38 | pre, 39 | blockquote { 40 | border: 1px solid #999; 41 | page-break-inside: avoid; 42 | } 43 | 44 | thead { 45 | display: table-header-group; // h5bp.com/t 46 | } 47 | 48 | tr, 49 | img { 50 | page-break-inside: avoid; 51 | } 52 | 53 | img { 54 | max-width: 100% !important; 55 | } 56 | 57 | p, 58 | h2, 59 | h3 { 60 | orphans: 3; 61 | widows: 3; 62 | } 63 | 64 | h2, 65 | h3 { 66 | page-break-after: avoid; 67 | } 68 | 69 | // Bootstrap specific changes start 70 | // 71 | // Chrome (OSX) fix for https://github.com/twbs/bootstrap/issues/11245 72 | // Once fixed, we can just straight up remove this. 73 | select { 74 | background: #fff !important; 75 | } 76 | 77 | // Bootstrap components 78 | .navbar { 79 | display: none; 80 | } 81 | .btn, 82 | .dropup > .btn { 83 | > .caret { 84 | border-top-color: #000 !important; 85 | } 86 | } 87 | .label { 88 | border: 1px solid #000; 89 | } 90 | 91 | .table { 92 | border-collapse: collapse !important; 93 | 94 | td, 95 | th { 96 | background-color: #fff !important; 97 | } 98 | } 99 | .table-bordered { 100 | th, 101 | td { 102 | border: 1px solid #ddd !important; 103 | } 104 | } 105 | 106 | // Bootstrap specific changes end 107 | } 108 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/fuzzer-common.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019, Paul Dreik 2 | // For the license information refer to format.h. 3 | 4 | #ifndef FUZZER_COMMON_H 5 | #define FUZZER_COMMON_H 6 | 7 | #include 8 | 9 | #include // std::uint8_t 10 | #include // memcpy 11 | #include 12 | 13 | // One can format to either a string, or a buffer. The latter is faster, but 14 | // one may be interested in formatting to a string instead to verify it works 15 | // as intended. To avoid a combinatoric explosion, select this at compile time 16 | // instead of dynamically from the fuzz data. 17 | #define FMT_FUZZ_FORMAT_TO_STRING 0 18 | 19 | // If {fmt} is given a buffer that is separately allocated, chances that address 20 | // sanitizer detects out of bound reads is much higher. However, it slows down 21 | // the fuzzing. 22 | #define FMT_FUZZ_SEPARATE_ALLOCATION 1 23 | 24 | // The size of the largest possible type in use. 25 | // To let the the fuzzer mutation be efficient at cross pollinating between 26 | // different types, use a fixed size format. The same bit pattern, interpreted 27 | // as another type, is likely interesting. 28 | constexpr auto fixed_size = 16; 29 | 30 | // Casts data to a char pointer. 31 | template inline const char* as_chars(const T* data) { 32 | return reinterpret_cast(data); 33 | } 34 | 35 | // Casts data to a byte pointer. 36 | template inline const std::uint8_t* as_bytes(const T* data) { 37 | return reinterpret_cast(data); 38 | } 39 | 40 | // Blits bytes from data to form an (assumed trivially constructible) object 41 | // of type Item. 42 | template inline Item assign_from_buf(const std::uint8_t* data) { 43 | auto item = Item(); 44 | std::memcpy(&item, data, sizeof(Item)); 45 | return item; 46 | } 47 | 48 | // Reads a boolean value by looking at the first byte from data. 49 | template <> inline bool assign_from_buf(const std::uint8_t* data) { 50 | return *data != 0; 51 | } 52 | 53 | struct data_to_string { 54 | #if FMT_FUZZ_SEPARATE_ALLOCATION 55 | std::vector buffer; 56 | 57 | data_to_string(const uint8_t* data, size_t size, bool add_terminator = false) 58 | : buffer(size + (add_terminator ? 1 : 0)) { 59 | if (size) { 60 | std::memcpy(buffer.data(), data, size); 61 | } 62 | } 63 | 64 | fmt::string_view get() const { return {buffer.data(), buffer.size()}; } 65 | #else 66 | fmt::string_view sv; 67 | 68 | data_to_string(const uint8_t* data, size_t size, bool = false) 69 | : str(as_chars(data), size) {} 70 | 71 | fmt::string_view get() const { return sv; } 72 | #endif 73 | 74 | const char* data() const { return get().data(); } 75 | }; 76 | 77 | #endif // FUZZER_COMMON_H 78 | -------------------------------------------------------------------------------- /third-party/fmt/support/bazel/README.md: -------------------------------------------------------------------------------- 1 | # Bazel support 2 | 3 | To get [Bazel](https://bazel.build/) working with {fmt} you can copy the files `BUILD.bazel`, `WORKSPACE.bazel`, and `.bazelversion` from this folder (`support/bazel`) to the root folder of this project. This way {fmt} gets bazelized and can be used with Bazel (e.g. doing a `bazel build //...` on {fmt}). 4 | 5 | ## Using {fmt} as a dependency 6 | 7 | The following minimal example shows how to use {fmt} as a dependency within a Bazel project. 8 | 9 | The following file structure is assumed: 10 | 11 | ``` 12 | example 13 | ├── BUILD.bazel 14 | ├── main.cpp 15 | └── WORKSPACE.bazel 16 | ``` 17 | 18 | *main.cpp*: 19 | 20 | ```c++ 21 | #include "fmt/core.h" 22 | 23 | int main() { 24 | fmt::print("The answer is {}\n", 42); 25 | } 26 | ``` 27 | 28 | The expected output of this example is `The answer is 42`. 29 | 30 | *WORKSPACE.bazel*: 31 | 32 | ```python 33 | load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") 34 | 35 | git_repository( 36 | name = "fmt", 37 | branch = "master", 38 | remote = "https://github.com/fmtlib/fmt", 39 | patch_cmds = [ 40 | "mv support/bazel/.bazelversion .bazelversion", 41 | "mv support/bazel/BUILD.bazel BUILD.bazel", 42 | "mv support/bazel/WORKSPACE.bazel WORKSPACE.bazel", 43 | ], 44 | # Windows-related patch commands are only needed in the case MSYS2 is not installed. 45 | # More details about the installation process of MSYS2 on Windows systems can be found here: 46 | # https://docs.bazel.build/versions/main/install-windows.html#installing-compilers-and-language-runtimes 47 | # Even if MSYS2 is installed the Windows related patch commands can still be used. 48 | patch_cmds_win = [ 49 | "Move-Item -Path support/bazel/.bazelversion -Destination .bazelversion", 50 | "Move-Item -Path support/bazel/BUILD.bazel -Destination BUILD.bazel", 51 | "Move-Item -Path support/bazel/WORKSPACE.bazel -Destination WORKSPACE.bazel", 52 | ], 53 | ) 54 | ``` 55 | 56 | In the *WORKSPACE* file, the {fmt} GitHub repository is fetched. Using the attribute `patch_cmds` the files `BUILD.bazel`, `WORKSPACE.bazel`, and `.bazelversion` are moved to the root of the {fmt} repository. This way the {fmt} repository is recognized as a bazelized workspace. 57 | 58 | *BUILD.bazel*: 59 | 60 | ```python 61 | cc_binary( 62 | name = "Demo", 63 | srcs = ["main.cpp"], 64 | deps = ["@fmt"], 65 | ) 66 | ``` 67 | 68 | The *BUILD* file defines a binary named `Demo` that has a dependency to {fmt}. 69 | 70 | To execute the binary you can run `bazel run //:Demo`. 71 | 72 | # Using Bzlmod 73 | 74 | The [Bazel Central Registry](https://github.com/bazelbuild/bazel-central-registry/tree/main/modules/fmt) also provides support for {fmt}. 75 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/named-arg.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019, Paul Dreik 2 | // For the license information refer to format.h. 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "fuzzer-common.h" 11 | 12 | template 13 | void invoke_fmt(const uint8_t* data, size_t size, unsigned arg_name_size) { 14 | static_assert(sizeof(T) <= fixed_size, "fixed_size too small"); 15 | if (size <= fixed_size) return; 16 | const T value = assign_from_buf(data); 17 | data += fixed_size; 18 | size -= fixed_size; 19 | 20 | if (arg_name_size <= 0 || arg_name_size >= size) return; 21 | data_to_string arg_name(data, arg_name_size, true); 22 | data += arg_name_size; 23 | size -= arg_name_size; 24 | 25 | data_to_string format_str(data, size); 26 | try { 27 | #if FMT_FUZZ_FORMAT_TO_STRING 28 | std::string message = 29 | fmt::format(format_str.get(), fmt::arg(arg_name.data(), value)); 30 | #else 31 | fmt::memory_buffer out; 32 | fmt::format_to(std::back_inserter(out), format_str.get(), 33 | fmt::arg(arg_name.data(), value)); 34 | #endif 35 | } catch (std::exception&) { 36 | } 37 | } 38 | 39 | // For dynamic dispatching to an explicit instantiation. 40 | template void invoke(int type, Callback callback) { 41 | switch (type) { 42 | case 0: 43 | callback(bool()); 44 | break; 45 | case 1: 46 | callback(char()); 47 | break; 48 | case 2: 49 | using sc = signed char; 50 | callback(sc()); 51 | break; 52 | case 3: 53 | using uc = unsigned char; 54 | callback(uc()); 55 | break; 56 | case 4: 57 | callback(short()); 58 | break; 59 | case 5: 60 | using us = unsigned short; 61 | callback(us()); 62 | break; 63 | case 6: 64 | callback(int()); 65 | break; 66 | case 7: 67 | callback(unsigned()); 68 | break; 69 | case 8: 70 | callback(long()); 71 | break; 72 | case 9: 73 | using ul = unsigned long; 74 | callback(ul()); 75 | break; 76 | case 10: 77 | callback(float()); 78 | break; 79 | case 11: 80 | callback(double()); 81 | break; 82 | case 12: 83 | using LD = long double; 84 | callback(LD()); 85 | break; 86 | } 87 | } 88 | 89 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 90 | if (size <= 3) return 0; 91 | 92 | // Switch types depending on the first byte of the input. 93 | const auto type = data[0] & 0x0F; 94 | const unsigned arg_name_size = (data[0] & 0xF0) >> 4; 95 | data++; 96 | size--; 97 | 98 | invoke(type, [=](auto arg) { 99 | invoke_fmt(data, size, arg_name_size); 100 | }); 101 | return 0; 102 | } 103 | -------------------------------------------------------------------------------- /third-party/fmt/test/fuzzing/two-args.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019, Paul Dreik 2 | // For the license information refer to format.h. 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "fuzzer-common.h" 11 | 12 | template 13 | void invoke_fmt(const uint8_t* data, size_t size) { 14 | static_assert(sizeof(Item1) <= fixed_size, "size1 exceeded"); 15 | static_assert(sizeof(Item2) <= fixed_size, "size2 exceeded"); 16 | if (size <= fixed_size + fixed_size) return; 17 | 18 | const Item1 item1 = assign_from_buf(data); 19 | data += fixed_size; 20 | size -= fixed_size; 21 | 22 | const Item2 item2 = assign_from_buf(data); 23 | data += fixed_size; 24 | size -= fixed_size; 25 | 26 | auto format_str = fmt::string_view(as_chars(data), size); 27 | #if FMT_FUZZ_FORMAT_TO_STRING 28 | std::string message = fmt::format(format_str, item1, item2); 29 | #else 30 | auto buf = fmt::memory_buffer(); 31 | fmt::format_to(std::back_inserter(buf), format_str, item1, item2); 32 | #endif 33 | } 34 | 35 | // For dynamic dispatching to an explicit instantiation. 36 | template void invoke(int index, Callback callback) { 37 | switch (index) { 38 | case 0: 39 | callback(bool()); 40 | break; 41 | case 1: 42 | callback(char()); 43 | break; 44 | case 2: 45 | using sc = signed char; 46 | callback(sc()); 47 | break; 48 | case 3: 49 | using uc = unsigned char; 50 | callback(uc()); 51 | break; 52 | case 4: 53 | callback(short()); 54 | break; 55 | case 5: 56 | using us = unsigned short; 57 | callback(us()); 58 | break; 59 | case 6: 60 | callback(int()); 61 | break; 62 | case 7: 63 | callback(unsigned()); 64 | break; 65 | case 8: 66 | callback(long()); 67 | break; 68 | case 9: 69 | using ul = unsigned long; 70 | callback(ul()); 71 | break; 72 | case 10: 73 | callback(float()); 74 | break; 75 | case 11: 76 | callback(double()); 77 | break; 78 | case 12: 79 | using LD = long double; 80 | callback(LD()); 81 | break; 82 | case 13: 83 | using ptr = void*; 84 | callback(ptr()); 85 | break; 86 | } 87 | } 88 | 89 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 90 | if (size <= 3) return 0; 91 | 92 | // Switch types depending on the first byte of the input. 93 | const auto type1 = data[0] & 0x0F; 94 | const auto type2 = (data[0] & 0xF0) >> 4; 95 | data++; 96 | size--; 97 | try { 98 | invoke(type1, [=](auto param1) { 99 | invoke(type2, [=](auto param2) { 100 | invoke_fmt(data, size); 101 | }); 102 | }); 103 | } catch (std::exception&) { 104 | } 105 | return 0; 106 | } 107 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Default compiler settings 2 | CC ?= gcc 3 | CXX ?= g++ 4 | 5 | # Detect the operating system 6 | ifeq ($(OS),Windows_NT) 7 | detected_OS := Windows 8 | EXE_EXT := .exe 9 | else 10 | detected_OS := $(shell uname -s) 11 | EXE_EXT := 12 | endif 13 | 14 | # Build directory 15 | BUILD_DIR=build 16 | 17 | # CMake build option 18 | CMAKE_BUILD_OPTION ?= Release 19 | BUILD_TYPE ?= BUILD_NATIVE 20 | 21 | # Path to evaluation file (can be overridden from command line) 22 | EVALFILE ?= 23 | 24 | # Executable name (can be overridden from command line) 25 | EXE ?= integral 26 | 27 | # Whether or not datagen will be used 28 | DATAGEN ?= OFF 29 | 30 | # Standard targets 31 | .PHONY: all clean debug x86_64 x86_64_popcnt x86_64_bmi2 native 32 | 33 | all: $(BUILD_DIR) 34 | @echo Building $(EXE) with $(BUILD_TYPE)... 35 | @$(MAKE) -C $(BUILD_DIR) 36 | @echo Copying executable... 37 | @$(MAKE) copy_executable 38 | 39 | $(BUILD_DIR): 40 | ifeq ($(detected_OS),Windows) 41 | @if not exist $(BUILD_DIR) mkdir $(BUILD_DIR) 42 | else 43 | @mkdir -p $(BUILD_DIR) 44 | endif 45 | @echo Configuring CMake with BUILD_TYPE=$(BUILD_TYPE)... 46 | @cd $(BUILD_DIR) && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_OPTION) -DCMAKE_C_COMPILER=$(CC) -DCMAKE_CXX_COMPILER=$(CXX) -DEVALFILE=$(EVALFILE) -D$(BUILD_TYPE)=ON -DDATAGEN=$(DATAGEN) .. 47 | 48 | clean: 49 | ifeq ($(detected_OS),Windows) 50 | @if exist $(BUILD_DIR) rmdir /s /q $(BUILD_DIR) 51 | @del /f /q $(EXE)*$(EXE_EXT) 52 | else 53 | @rm -rf $(BUILD_DIR) 54 | @rm -f $(EXE)*$(EXE_EXT) 55 | endif 56 | 57 | copy_executable: 58 | ifeq ($(BUILD_TYPE),BUILD_DEBUG) 59 | $(eval EXE_NAME := $(EXE)_debug$(EXE_EXT)) 60 | else ifeq ($(BUILD_TYPE),BUILD_X86_64_POPCNT) 61 | $(eval EXE_NAME := $(EXE)_x86_64_popcnt$(EXE_EXT)) 62 | else ifeq ($(BUILD_TYPE),BUILD_X86_64_MODERN) 63 | $(eval EXE_NAME := $(EXE)_x86_64_modern$(EXE_EXT)) 64 | else ifeq ($(BUILD_TYPE),BUILD_X86_64_BMI2) 65 | $(eval EXE_NAME := $(EXE)_x86_64_bmi2$(EXE_EXT)) 66 | else 67 | $(eval EXE_NAME := $(EXE)$(EXE_EXT)) 68 | endif 69 | 70 | ifeq ($(detected_OS),Windows) 71 | @copy $(BUILD_DIR)\integral$(EXE_EXT) $(EXE_NAME) 72 | else 73 | @cp $(BUILD_DIR)/integral$(EXE_EXT) $(EXE_NAME) 74 | endif 75 | 76 | debug: 77 | @echo Building with debug 78 | @$(MAKE) all BUILD_TYPE=BUILD_DEBUG 79 | 80 | vnni512: 81 | @echo Building with BUILD_VNNI512 82 | @$(MAKE) all BUILD_TYPE=BUILD_VNNI512 83 | 84 | avx512: 85 | @echo Building with BUILD_AVX512 86 | @$(MAKE) all BUILD_TYPE=BUILD_AVX512 87 | 88 | avx2_bmi2: 89 | @echo Building with BUILD_AVX2_BMI2 90 | @$(MAKE) all BUILD_TYPE=BUILD_AVX2_BMI2 91 | 92 | avx2: 93 | @echo Building with BUILD_AVX2 94 | @$(MAKE) all BUILD_TYPE=BUILD_AVX2 95 | 96 | sse41_popcnt: 97 | @echo Building with BUILD_SSE41_POPCNT 98 | @$(MAKE) all BUILD_TYPE=BUILD_SSE41_POPCNT 99 | 100 | native: 101 | @echo Building with native optimizations... 102 | @$(MAKE) all BUILD_TYPE=BUILD_NATIVE -------------------------------------------------------------------------------- /third-party/fmt/doc/bootstrap/mixins/forms.less: -------------------------------------------------------------------------------- 1 | // Form validation states 2 | // 3 | // Used in forms.less to generate the form validation CSS for warnings, errors, 4 | // and successes. 5 | 6 | .form-control-validation(@text-color: #555; @border-color: #ccc; @background-color: #f5f5f5) { 7 | // Color the label and help text 8 | .help-block, 9 | .control-label, 10 | .radio, 11 | .checkbox, 12 | .radio-inline, 13 | .checkbox-inline, 14 | &.radio label, 15 | &.checkbox label, 16 | &.radio-inline label, 17 | &.checkbox-inline label { 18 | color: @text-color; 19 | } 20 | // Set the border and box shadow on specific inputs to match 21 | .form-control { 22 | border-color: @border-color; 23 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.075)); // Redeclare so transitions work 24 | &:focus { 25 | border-color: darken(@border-color, 10%); 26 | @shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px lighten(@border-color, 20%); 27 | .box-shadow(@shadow); 28 | } 29 | } 30 | // Set validation states also for addons 31 | .input-group-addon { 32 | color: @text-color; 33 | border-color: @border-color; 34 | background-color: @background-color; 35 | } 36 | // Optional feedback icon 37 | .form-control-feedback { 38 | color: @text-color; 39 | } 40 | } 41 | 42 | 43 | // Form control focus state 44 | // 45 | // Generate a customized focus state and for any input with the specified color, 46 | // which defaults to the `@input-border-focus` variable. 47 | // 48 | // We highly encourage you to not customize the default value, but instead use 49 | // this to tweak colors on an as-needed basis. This aesthetic change is based on 50 | // WebKit's default styles, but applicable to a wider range of browsers. Its 51 | // usability and accessibility should be taken into account with any change. 52 | // 53 | // Example usage: change the default blue border and shadow to white for better 54 | // contrast against a dark gray background. 55 | .form-control-focus(@color: @input-border-focus) { 56 | @color-rgba: rgba(red(@color), green(@color), blue(@color), .6); 57 | &:focus { 58 | border-color: @color; 59 | outline: 0; 60 | .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}"); 61 | } 62 | } 63 | 64 | // Form control sizing 65 | // 66 | // Relative text size, padding, and border-radii changes for form controls. For 67 | // horizontal sizing, wrap controls in the predefined grid classes. `