From 6981a735f91320cb9978193b6fa0d06be3304a5a Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:48:26 +0200 Subject: trying to add ci --- .github/workflow/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflow/ci.yml (limited to '.github') diff --git a/.github/workflow/ci.yml b/.github/workflow/ci.yml new file mode 100644 index 0000000..549aa68 --- /dev/null +++ b/.github/workflow/ci.yml @@ -0,0 +1,14 @@ +name: ci + +on: + push: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Force Failure + run: (exit 1)s -- cgit v1.2.3 From ccca3c79adc7ccc2d3b8ed6cf2d614ee7f26595c Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:49:04 +0200 Subject: trying to add ci --- .github/workflow/ci.yml | 14 -------------- .github/workflow/main.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 .github/workflow/ci.yml create mode 100644 .github/workflow/main.yml (limited to '.github') diff --git a/.github/workflow/ci.yml b/.github/workflow/ci.yml deleted file mode 100644 index 549aa68..0000000 --- a/.github/workflow/ci.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: ci - -on: - push: - branches: [main] - -jobs: - tests: - name: Tests - runs-on: ubuntu-latest - - steps: - - name: Force Failure - run: (exit 1)s diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml new file mode 100644 index 0000000..549aa68 --- /dev/null +++ b/.github/workflow/main.yml @@ -0,0 +1,14 @@ +name: ci + +on: + push: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Force Failure + run: (exit 1)s -- cgit v1.2.3 From d30c03b2635c02ba640e71dc9a828d8608b29a91 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:50:28 +0200 Subject: fixing typo --- .github/workflow/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml index 549aa68..f34b5a0 100644 --- a/.github/workflow/main.yml +++ b/.github/workflow/main.yml @@ -11,4 +11,4 @@ jobs: steps: - name: Force Failure - run: (exit 1)s + run: (exit 1) -- cgit v1.2.3 From e483dd5c390a8caa25b1f6bc781351fe280c5fa4 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:54:46 +0200 Subject: fixing typo --- .github/workflow/main.yml | 14 -------------- .github/workflows/main.yml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-) delete mode 100644 .github/workflow/main.yml create mode 100644 .github/workflows/main.yml (limited to '.github') diff --git a/.github/workflow/main.yml b/.github/workflow/main.yml deleted file mode 100644 index f34b5a0..0000000 --- a/.github/workflow/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: ci - -on: - push: - branches: [main] - -jobs: - tests: - name: Tests - runs-on: ubuntu-latest - - steps: - - name: Force Failure - run: (exit 1) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f34b5a0 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,14 @@ +name: ci + +on: + push: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Force Failure + run: (exit 1) -- cgit v1.2.3 From df57b72656e363d0a4db42fb6b985fceb448256a Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:56:43 +0200 Subject: Create cmake-single-platform.yml --- .github/workflows/cmake-single-platform.yml | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/cmake-single-platform.yml (limited to '.github') diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml new file mode 100644 index 0000000..4f957f3 --- /dev/null +++ b/.github/workflows/cmake-single-platform.yml @@ -0,0 +1,32 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: CMake on a single platform + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- cgit v1.2.3 From 44ff8b9029d239f31abe8f14dd25ed72f0c78cc7 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:57:11 +0200 Subject: removing tests workflow --- .github/workflows/main.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/main.yml (limited to '.github') diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index f34b5a0..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: ci - -on: - push: - branches: [main] - -jobs: - tests: - name: Tests - runs-on: ubuntu-latest - - steps: - - name: Force Failure - run: (exit 1) -- cgit v1.2.3 From 75e2d3df4e334803fc6bba3e879389f57617b667 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 15:58:55 +0200 Subject: i hate github --- .github/workflows/cmake-single-platform.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 4f957f3..10c3a98 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -25,8 +25,8 @@ jobs: - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - + run: cmake -B ${{github.workspace}}/build -S . + - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -- cgit v1.2.3 From de369006392e6e8fa2089e3cf68ce9fcbf07963d Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 16:04:06 +0200 Subject: trying to support morern print --- .github/workflows/cmake-single-platform.yml | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to '.github') diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index 10c3a98..c02bed4 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -4,9 +4,9 @@ name: CMake on a single platform on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) @@ -20,13 +20,21 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Configure CMake - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: cmake -B ${{github.workspace}}/build -S . - - - name: Build - # Build your program with the given configuration - run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} + - name: Install GCC 14 + run: | + sudo apt update + sudo apt install -y gcc-14 g++-14 + + - name: Configure CMake + env: + CC: gcc-14 + CXX: g++-14 + run: cmake -B build -S . + + - name: Build + env: + CC: gcc-14 + CXX: g++-14 + run: cmake --build build -- cgit v1.2.3 From a46558e0aab30eb88ac3cafac8d490174bd4785f Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 26 Jul 2026 16:33:03 +0200 Subject: making everything more strict + fixing the warnings/error --- .github/workflows/cmake-single-platform.yml | 5 ++++- CMakeLists.txt | 19 +++++++++++++++++++ src/board.cpp | 11 +++++------ src/board.hpp | 2 +- src/fen.cpp | 2 +- src/main.cpp | 2 +- src/moves.cpp | 5 +++-- 7 files changed, 34 insertions(+), 12 deletions(-) (limited to '.github') diff --git a/.github/workflows/cmake-single-platform.yml b/.github/workflows/cmake-single-platform.yml index c02bed4..844556e 100644 --- a/.github/workflows/cmake-single-platform.yml +++ b/.github/workflows/cmake-single-platform.yml @@ -31,10 +31,13 @@ jobs: env: CC: gcc-14 CXX: g++-14 - run: cmake -B build -S . + run: cmake -B build -S . -DCMAKE_EXPORT_COMPILE_COMMANDS=ON - name: Build env: CC: gcc-14 CXX: g++-14 run: cmake --build build + + - name: Run clang-tidy + run: clang-tidy src/*.cpp -p build diff --git a/CMakeLists.txt b/CMakeLists.txt index 3782845..3f5a42f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,3 +14,22 @@ file(GLOB_RECURSE SOURCE_FILES src/*.c src/*.cpp src/*.h src/*.hpp) add_executable(${PROJECT_NAME} ${SOURCE_FILES}) target_include_directories(${PROJECT_NAME} PRIVATE src) + +if (MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +else() + target_compile_options(${PROJECT_NAME} PRIVATE + -Wall + -Wextra + -Wpedantic + -Werror + ) +endif() + +target_compile_options(${PROJECT_NAME} PRIVATE + -fsanitize=address,undefined +) + +target_link_options(${PROJECT_NAME} PRIVATE + -fsanitize=address,undefined +) diff --git a/src/board.cpp b/src/board.cpp index 081cc7d..172a9be 100644 --- a/src/board.cpp +++ b/src/board.cpp @@ -5,13 +5,11 @@ #include #include #include -#include - -const char toChar(pieceType type) { +char toChar(pieceType type) { switch (type) { case NONE: - return '.'; + return '.'; case PAWN: return 'P'; case KNIGHT: @@ -25,7 +23,8 @@ const char toChar(pieceType type) { case KING: return 'K'; default: - assert(false && "Unknown piece"); + std::cout << "\n" << type << "\n"; + assert(false && "Unknown piece" && type); return '?'; } } @@ -90,4 +89,4 @@ void printBoard(board *b) { std::println("Castling: {}", b->castle); } -void PlayMove(Move move, board *b) { return; } +// void PlayMove(Move move, board *b) { return; } diff --git a/src/board.hpp b/src/board.hpp index 23f89ad..afdb938 100644 --- a/src/board.hpp +++ b/src/board.hpp @@ -13,7 +13,7 @@ enum pieceType { KING, }; -const char toChar(pieceType type); +char toChar(pieceType type); struct Piece { bool color; diff --git a/src/fen.cpp b/src/fen.cpp index a6773c2..9c3154c 100644 --- a/src/fen.cpp +++ b/src/fen.cpp @@ -25,7 +25,7 @@ void setBoardFen(std::string fen, board *b) { }; parserState state = POSITION; - for (int i = 0; i < fen.length(); i++) { + for (uint i = 0; i < fen.length(); i++) { std::printf("state: %d\n", state); std::printf("doing: %c\n", fen[i]); if (fen[i] == ' ') { diff --git a/src/main.cpp b/src/main.cpp index 7a6e7f4..261c19d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -127,7 +127,7 @@ int main(int argc, char **argv) { continue; } std::println(); - PlayMove(move, &b); + // PlayMove(move, &b); // todo implement b.MoveClock++; b.turn = !b.turn; printBoard(&b); diff --git a/src/moves.cpp b/src/moves.cpp index 2ff8ed6..f02dfbe 100644 --- a/src/moves.cpp +++ b/src/moves.cpp @@ -1,5 +1,6 @@ #include #include +#include #include "board.hpp" #include "moves.hpp" @@ -11,7 +12,7 @@ std::vector GetLegalMoves(board *b) { constexpr std::array rook_Moves{-1, 1, 8, -8}; constexpr std::array bishop_Moves{-9, 9, -7, 7}; - for (int i = 0; i < sizeof(b->pieces) / sizeof(b->pieces[0]); i++) { + for (uint i = 0; i < sizeof(b->pieces) / sizeof(b->pieces[0]); i++) { Piece piece = b->pieces[i]; if (piece.type == NONE) { continue; @@ -42,7 +43,7 @@ Position IndexToPosition(int i) { void GenerateSlidingMoves(board *b, int from, const std::array &directions, std::vector &moves) { - for (int i = 0; i < directions.size(); i++) { + for (uint i = 0; i < directions.size(); i++) { int direction = directions[i]; int i2 = from; -- cgit v1.2.3