-
Notifications
You must be signed in to change notification settings - Fork 0
chesslib integration and improvements #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
a24191c
Delete Makefile
winapiadmin 51d4c29
integrated library
winapiadmin 9492960
Create games.yml
winapiadmin c423d79
Update games.yml
winapiadmin 047a0b5
Update timeman.cpp
winapiadmin e1987a3
Update games.yml
winapiadmin 9461633
Update games.yml
winapiadmin 5035495
Update games.yml
winapiadmin ca09276
Update games.yml
winapiadmin 3503dcf
Update games.yml
winapiadmin 76b2f00
Update games.yml
winapiadmin 567967b
Update eval.cpp
winapiadmin 66ef091
Update eval.cpp
winapiadmin 55eafd9
Update eval.h
winapiadmin 5f2e240
Update movepick.cpp
winapiadmin 87018d5
Update movepick.h
winapiadmin e0113c4
Update movepick.cpp
winapiadmin 6a3b428
Update search.cpp
winapiadmin c6259a6
Update eval.h
winapiadmin 112efae
Update eval.cpp
winapiadmin 5a64699
Update movepick.h
winapiadmin cfa8687
Update search.cpp
winapiadmin e60c4a2
Update search.cpp
winapiadmin 069362e
Update movepick.cpp
winapiadmin 5d8846f
Update movepick.cpp
winapiadmin 391b6f3
Update movepick.cpp
winapiadmin 5b33054
Update movepick.cpp
winapiadmin 9a01ca5
Update movepick.cpp
winapiadmin 14a9ecc
Update games.yml
winapiadmin f16cf32
Update games.yml
winapiadmin 3e18c92
Update games.yml
winapiadmin 957b18b
extend time control (6*time)
winapiadmin bda9208
Update games.yml
winapiadmin 3f12d43
set pv if really hit TT
winapiadmin 9e86d67
Update games.yml
winapiadmin 84af61b
Update search.cpp
winapiadmin e16df82
Update games.yml
winapiadmin 40c769b
Update games.yml
winapiadmin 608c8ec
fix regression of null pointer deref
winapiadmin 66be7b7
clear PV
winapiadmin be920c1
Update search.cpp
winapiadmin 66d3364
fix overflow
winapiadmin c056095
implemented quiescence and fix illegal PV (variable shadowing)
winapiadmin 5202e7c
no functional changes
winapiadmin 9295dec
fix typo
winapiadmin 559d840
Update games.yml
winapiadmin 2f962a9
Update games.yml
winapiadmin e6b67a0
Update games.yml
winapiadmin 8a7f646
update source
winapiadmin 4e5461e
Update uci.cpp
winapiadmin 26e4720
some features and improvements (#3)
winapiadmin 29f8c08
some QoL changes and specifically, BUGS.
winapiadmin 5d6c1a8
library side fix nullmoves
winapiadmin d4336c8
Apply clang-format
actions-user 8895ce0
Update eval.cpp
winapiadmin d877e11
Update search.cpp
winapiadmin dd9a1dd
Fix typo in move type check for score calculation
winapiadmin ed208f1
Update uci.cpp
winapiadmin 4d4e1ab
Fix FEN setting in engine loop
winapiadmin 6adfd1f
Update uci.cpp
winapiadmin a522468
improvements and bugfix (#6)
winapiadmin 49cf63a
Update games.yml
winapiadmin aa08fd3
Update Makefile
winapiadmin b242210
resolved some issues, no functional changes
winapiadmin a8545a4
Apply clang-format
actions-user efa8bb4
Potential fix for pull request finding 'CodeQL / Workflow does not co…
winapiadmin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| BasedOnStyle: LLVM | ||
| IndentWidth: 4 | ||
| ContinuationIndentWidth: 4 | ||
| ColumnLimit: 128 | ||
| AllowAllArgumentsOnNextLine: false | ||
| AllowAllConstructorInitializersOnNextLine: false | ||
| BinPackParameters: false | ||
| BinPackArguments: false | ||
| BraceWrapping: | ||
| # AfterInitializerList: true | ||
| AfterFunction: true | ||
| BeforeElse: false | ||
| IndentBraces: false | ||
| AlignArrayOfStructures: Right | ||
| Cpp11BracedListStyle: false | ||
| SpacesInContainerLiterals: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: clang-format | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| push: | ||
| branches-ignore: | ||
| - main | ||
| jobs: | ||
| format: | ||
| if: github.actor != 'github-actions[bot]' | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Install clang-format | ||
| run: pip install clang-format==18.1.0 | ||
|
|
||
| - name: Run clang-format | ||
| run: | | ||
| clang-format -i $(git ls-files '*.cpp' '*.hpp' '*.h' '*.c') | ||
|
|
||
| - name: Commit and push changes | ||
| run: | | ||
| if ! git diff --quiet; then | ||
| git config user.email "actions@github.com" | ||
| git config user.name "GitHub Actions" | ||
| git commit -am "Apply clang-format" | ||
| git push | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| name: Fastchess SPRT Test (Linux) | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| base_ref: | ||
| description: "Base branch, tag, or commit" | ||
| required: false | ||
| default: "test_chesslib" | ||
| rounds: | ||
| description: "Max rounds for SPRT" | ||
| required: false | ||
| default: "6000" | ||
| tc: | ||
| description: "Time control (e.g. 60+0.6 or 10+0.1)" | ||
| required: false | ||
| default: "60+0.6" | ||
| elo0: | ||
| description: "elo0" | ||
| required: false | ||
| default: "0.5" | ||
| elo1: | ||
| description: "elo1" | ||
| required: false | ||
| default: "2.5" | ||
| output_exec: | ||
| description: "Executable output file name" | ||
| required: false | ||
| default: "engine" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
|
|
||
| build-new: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| path: new | ||
| persist-credentials: false | ||
|
|
||
| - name: Install deps | ||
| run: sudo apt update && sudo apt install -y build-essential cmake | ||
|
|
||
| - name: Build new engine | ||
| run: | | ||
| cd new | ||
| mkdir build | ||
| cd build | ||
| cmake .. -DCMAKE_BUILD_TYPE=Release | ||
| make -j$(nproc) | ||
|
|
||
| - name: Upload new engine | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: new-engine | ||
| path: new/build/engine | ||
|
|
||
|
|
||
| build-base: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| ref: ${{ github.event.inputs.base_ref }} | ||
| path: base | ||
| persist-credentials: false | ||
|
|
||
| - name: Install deps | ||
| run: sudo apt update && sudo apt install -y build-essential cmake | ||
|
|
||
| - name: Build base engine | ||
| run: | | ||
| cd base | ||
| mkdir build | ||
| cd build | ||
| cmake .. -DCMAKE_BUILD_TYPE=Release | ||
| make -j$(nproc) | ||
|
|
||
| - name: Upload base engine | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: base-engine | ||
| path: base/build/${{ github.event.inputs.output_exec }} | ||
|
|
||
|
|
||
| test: | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
| runs-on: ubuntu-latest | ||
| needs: [build-new, build-base] | ||
|
|
||
| steps: | ||
| - name: Download engines | ||
| uses: actions/download-artifact@v4 | ||
|
|
||
| - name: Install tools | ||
| env: | ||
| OUTPUT_EXEC: ${{ github.event.inputs.output_exec }} | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y wget unzip | ||
|
|
||
| wget https://github.com/Disservin/fastchess/releases/download/v1.8.0-alpha/fastchess-linux-x86-64.tar | ||
| tar -xf fastchess-linux-x86-64.tar | ||
| chmod +x fastchess-linux-x86-64/fastchess | ||
| mv fastchess-linux-x86-64/fastchess fastchess | ||
|
|
||
| wget https://github.com/official-stockfish/books/raw/refs/heads/master/UHO_Lichess_4852_v1.epd.zip | ||
| unzip UHO_Lichess_4852_v1.epd.zip | ||
|
|
||
| wget https://github.com/michiguel/Ordo/releases/download/1.0/ordo-linux64 | ||
| chmod +x ordo-linux64 | ||
|
|
||
| chmod +x new-engine/engine | ||
| chmod +x base-engine/$OUTPUT_EXEC | ||
|
|
||
| - name: Run fastchess | ||
| env: | ||
| ELO0: ${{ github.event.inputs.elo0 }} | ||
| ELO1: ${{ github.event.inputs.elo1 }} | ||
| TC: ${{ github.event.inputs.tc }} | ||
| OUTPUT_EXEC: ${{ github.event.inputs.output_exec }} | ||
| ROUNDS: ${{ github.event.inputs.rounds }} | ||
| run: | | ||
| ./fastchess -recover \ | ||
| -engine cmd=new-engine/engine name=new \ | ||
| -engine cmd=base-engine/$OUTPUT_EXEC name=base \ | ||
| -openings file=UHO_Lichess_4852_v1.epd format=epd order=random \ | ||
| -each tc=$TC \ | ||
| -rounds $ROUNDS \ | ||
| -concurrency $(nproc) \ | ||
| -pgnout notation=san nodes=true file=games.pgn \ | ||
| -sprt elo0=$ELO0 elo1=$ELO1 alpha=0.05 beta=0.05 | tee results.txt | ||
| ./ordo-linux64 -o ratings.txt -- games.pgn | ||
| - name: Upload results | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: results | ||
| path: | | ||
| games.pgn | ||
| ratings.txt | ||
| results.txt | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,76 +1,81 @@ | ||
| cmake_minimum_required(VERSION 3.10) | ||
| project(chess_engine) | ||
| project(cppchess_engine) | ||
|
|
||
| # Use C++17 | ||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
|
||
| # Optional: enable warnings (MSVC specific flags) | ||
| if (MSVC) | ||
| add_compile_options(/W4 /permissive-) | ||
| else() | ||
| add_compile_options(-Wall -Wextra -pedantic) | ||
| endif() | ||
|
|
||
| # Add the source files | ||
| set(SOURCES | ||
| main.cpp | ||
| eval.cpp | ||
| search.cpp | ||
| tt.cpp | ||
| movepick.cpp | ||
| uci.cpp | ||
| ucioptions.cpp | ||
| timeman.cpp | ||
| include(FetchContent) | ||
| set(BUILD_TESTING OFF) | ||
| FetchContent_Declare( | ||
| chesslib | ||
| GIT_REPOSITORY https://github.com/winapiadmin/chesslib.git | ||
| GIT_TAG main | ||
| ) | ||
| FetchContent_Declare( | ||
| tbprobe | ||
| GIT_REPOSITORY https://github.com/winapiadmin/tb_probing_tool.git | ||
| GIT_TAG main | ||
| ) | ||
| set(BUILD_GAVIOTA OFF CACHE BOOL "Enable Gaviota TB probing" FORCE) | ||
| option(ENGINE_TUNING "enable Texel tuning (requires csv-parser)" OFF) | ||
| FetchContent_MakeAvailable(chesslib tbprobe) | ||
| set(SOURCES | ||
| "main.cpp" | ||
| "timeman.cpp" | ||
| "eval.cpp" | ||
| "tune.cpp" | ||
| "ucioption.cpp" | ||
| "tt.cpp" | ||
| "uci.cpp" | ||
| "search.cpp" | ||
| "score.cpp" | ||
| "movepick.cpp" | ||
| "tb.cpp" | ||
| ) | ||
|
|
||
| # Define the executable | ||
| add_executable(${PROJECT_NAME} ${SOURCES}) | ||
|
|
||
| # Threading support | ||
| find_package(Threads REQUIRED) | ||
| target_link_libraries(${PROJECT_NAME} Threads::Threads) | ||
|
|
||
| # Platform-specific threading configurations | ||
| if(WIN32) | ||
| if(MSVC) | ||
| # Windows with MSVC - uses Windows threading API | ||
| target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32_LEAN_AND_MEAN) | ||
| elseif(MINGW) | ||
| # MinGW on Windows - uses pthread | ||
| target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN32_WINNT=0x0601) | ||
| # MinGW might need explicit pthread linking | ||
| if(CMAKE_THREAD_LIBS_INIT) | ||
| target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT}) | ||
| endif() | ||
| endif() | ||
| elseif(UNIX) | ||
| # Unix/Linux systems - uses pthread | ||
| if(CMAKE_THREAD_LIBS_INIT) | ||
| target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT}) | ||
| endif() | ||
| # Some older systems might need explicit -pthread flag | ||
| if(CMAKE_USE_PTHREADS_INIT) | ||
| target_compile_options(${PROJECT_NAME} PRIVATE -pthread) | ||
| target_link_options(${PROJECT_NAME} PRIVATE -pthread) | ||
| endif() | ||
| if(ENGINE_TUNING) | ||
| list(APPEND SOURCES "tune_cmd.cpp") | ||
| endif() | ||
|
|
||
| # Optional: Add atomic library support for older compilers | ||
| if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") | ||
| target_link_libraries(${PROJECT_NAME} atomic) | ||
| endif() | ||
| add_executable(engine ${SOURCES}) | ||
|
|
||
| # Set default build type if none is specified | ||
| if(NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the build type (Debug, Release, etc.)" FORCE) | ||
| target_link_libraries(engine PRIVATE chesslib syzygy_probe) | ||
| target_include_directories(engine PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${chesslib_SOURCE_DIR}) | ||
| execute_process( | ||
| COMMAND git rev-parse --short HEAD | ||
| WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| ERROR_QUIET | ||
| OUTPUT_VARIABLE GIT_SHA | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ) | ||
| if(GIT_SHA STREQUAL "") | ||
| set(GIT_SHA "unknown") | ||
| endif() | ||
| execute_process( | ||
| COMMAND git describe --tags --exact-match | ||
| WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} | ||
| OUTPUT_VARIABLE GIT_TAG | ||
| ERROR_QUIET | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ) | ||
|
|
||
| # Optional: Add specific compile flags per build type | ||
| if(NOT MSVC) | ||
| set(CMAKE_CXX_FLAGS_DEBUG "-g -march=native -mtune=native") | ||
| set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=native -mtune=native -funroll-loops -ftree-vectorize -fomit-frame-pointer") | ||
| if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT CMAKE_BUILD_TYPE) | ||
| set(BUILD_VERSION "debug-${GIT_SHA}") | ||
| elseif(GIT_TAG) | ||
| set(BUILD_VERSION "${GIT_TAG}") | ||
| else() | ||
| set(CMAKE_CXX_FLAGS_DEBUG "/Zi /Od") | ||
| set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG") | ||
| set(BUILD_VERSION "release-${GIT_SHA}") | ||
| endif() | ||
|
|
||
| message(STATUS "Build Version: ${BUILD_VERSION}") | ||
| target_compile_definitions(engine PRIVATE BUILD_VERSION="${BUILD_VERSION}") | ||
| if (ENGINE_TUNING) | ||
| FetchContent_Declare( | ||
| csv | ||
| GIT_REPOSITORY https://github.com/vincentlaucsb/csv-parser.git | ||
| GIT_TAG master | ||
| ) | ||
| FetchContent_MakeAvailable(csv) | ||
| target_link_libraries(engine PRIVATE csv) | ||
| target_compile_definitions(engine PRIVATE USE_CSV_PARSER) | ||
| endif() |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.