Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker_build_push.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and Push Docker Image
name: Build Push Linux Docker Image

on:
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: Linux Build

on:
push:
Expand All @@ -9,7 +9,7 @@ permissions:
packages: read

jobs:
linux:
linux-build:
runs-on: ubuntu-latest

container:
Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:

exit $CONFIGURE_EXIT_CODE

- name: Build
- name: Build (${{ matrix.preset }})
run: |
set +e
cmake --build --preset ${{ matrix.preset }} 2>&1 | tee build_output.txt
Expand All @@ -69,7 +69,7 @@ jobs:

exit $BUILD_EXIT_CODE

- name: Test
- name: Test (${{ matrix.preset }})
run: |
set +e
ctest --preset ${{ matrix.preset }} --output-on-failure 2>&1 | tee test_output.txt
Expand Down
93 changes: 93 additions & 0 deletions .github/workflows/windows-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Windows Build

on:
push:
workflow_dispatch:

jobs:
windows-build:
runs-on: windows-2022

strategy:
matrix:
preset: [ msvc_debug, msvc_release ]

steps:
- uses: actions/checkout@v4

- name: Configure (${{ matrix.preset }})
env:
VCPKG_ROOT: C:\vcpkg
shell: pwsh
run: |
$outputFile = "configure_output.txt"

cmake --preset ${{ matrix.preset }} 2>&1 | Tee-Object -FilePath $outputFile
$exitCode = $LASTEXITCODE

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "<details><summary>🟢 Configure Results (click to expand)</summary>"
} else {
Add-Content $env:GITHUB_STEP_SUMMARY "## 🔴 Configure Results"
}

Add-Content $env:GITHUB_STEP_SUMMARY ""
Add-Content $env:GITHUB_STEP_SUMMARY '```'
Get-Content $outputFile | Add-Content $env:GITHUB_STEP_SUMMARY
Add-Content $env:GITHUB_STEP_SUMMARY '```'

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "</details>"
}

exit $exitCode

- name: Build (${{ matrix.preset }})
shell: pwsh
run: |
$outputFile = "build_output.txt"

cmake --build --preset ${{ matrix.preset }} 2>&1 | Tee-Object -FilePath $outputFile
$exitCode = $LASTEXITCODE

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "<details><summary>🟢 Build Results (click to expand)</summary>"
} else {
Add-Content $env:GITHUB_STEP_SUMMARY "## 🔴 Build Results"
}

Add-Content $env:GITHUB_STEP_SUMMARY ""
Add-Content $env:GITHUB_STEP_SUMMARY '```'
Get-Content $outputFile | Add-Content $env:GITHUB_STEP_SUMMARY
Add-Content $env:GITHUB_STEP_SUMMARY '```'

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "</details>"
}

exit $exitCode

- name: Test (${{ matrix.preset }})
shell: pwsh
run: |
$outputFile = "test_output.txt"

ctest --preset ${{ matrix.preset }} --output-on-failure 2>&1 | Tee-Object -FilePath $outputFile
$exitCode = $LASTEXITCODE

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "<details><summary>🟢 Test Results (click to expand)</summary>"
} else {
Add-Content $env:GITHUB_STEP_SUMMARY "## 🔴 Test Results"
}

Add-Content $env:GITHUB_STEP_SUMMARY ""
Add-Content $env:GITHUB_STEP_SUMMARY '```'
Get-Content $outputFile | Add-Content $env:GITHUB_STEP_SUMMARY
Add-Content $env:GITHUB_STEP_SUMMARY '```'

if ($exitCode -eq 0) {
Add-Content $env:GITHUB_STEP_SUMMARY "</details>"
}

exit $exitCode
12 changes: 8 additions & 4 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,13 @@
},
{
"name": "msvc_debug",
"configurePreset": "msvc_debug"
"configurePreset": "msvc_debug",
"configuration": "Debug"
},
{
"name": "msvc_release",
"configurePreset": "msvc_release"
"configurePreset": "msvc_release",
"configuration": "Release"
}
],
"testPresets": [
Expand All @@ -84,11 +86,13 @@
},
{
"name": "msvc_debug",
"configurePreset": "msvc_debug"
"configurePreset": "msvc_debug",
"configuration": "Debug"
},
{
"name": "msvc_release",
"configurePreset": "msvc_release"
"configurePreset": "msvc_release",
"configuration": "Release"
}
],
"packagePresets": [
Expand Down
6 changes: 2 additions & 4 deletions docker/ubuntu/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Commands:
# [build] docker build -t ghr-chess-engine-ubuntu . -f docker/ubuntu/Dockerfile
# [run] docker run -it --rm ghr-chess-engine-ubuntu
# [configure cmake] cmake --preset=clang_release
# [build cmake] cmake --build --preset=clang_release
# [build] docker build -t bitbishop-ubuntu . -f docker/ubuntu/Dockerfile
# [run] docker run -it --rm bitbishop-ubuntu

FROM ubuntu:24.04

Expand Down
7 changes: 6 additions & 1 deletion include/bitbishop/moves/pawn_move_gen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ constexpr bool is_promotion_rank(Square sq, Color c) { return c == Color::WHITE
* @return true if the capture geometry is valid for en passant, false otherwise
*/
constexpr bool can_capture_en_passant(Square from, Square epsq, Color side) noexcept {
int df = std::abs(int(from.file()) - int(epsq.file()));
// MSVC have not yet made std::abs() constexpr for C++ 23, forcing us to define a generic constexpr one...
// For this, lets apply the abs() function manually. This is sad, but you know, MSVC...
// The code should not adapt to the compiler for the same language, the compiler should...
int df = int(from.file()) - int(epsq.file());
df = (df < 0) ? -df : df;

if (df != 1) return false;
if (side == Color::WHITE && from.rank() == 4 && epsq.rank() == 5) return true;
if (side == Color::BLACK && from.rank() == 3 && epsq.rank() == 2) return true;
Expand Down