Skip to content

Commit 3015775

Browse files
authored
removed examples and modernize with forward declarations (#26)
* removed examples and modernize with forward declarations (bonus: make more incremental update) * fix no testers (previous PR causes the multi-platform testers to not receive a test)
1 parent bc02eeb commit 3015775

11 files changed

Lines changed: 167 additions & 290 deletions

File tree

.github/workflows/cmake-multi-platform.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ jobs:
6161
run: cmake --build ${{ steps.vars.outputs.dir }} --config ${{ matrix.build_type }}
6262

6363
- name: Test
64-
working-directory: ${{ steps.strings.outputs.build-output-dir }}
65-
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
66-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
67-
run: ctest --build-config ${{ matrix.build_type }} --verbose
64+
working-directory: ${{ steps.vars.outputs.dir }}
65+
shell: bash
66+
run: |
67+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
68+
ctest --build-config ${{ matrix.build_type }} --verbose
69+
else
70+
ctest --verbose
71+
fi

CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,9 @@ endif()
4040
set(SOURCES
4141
position.cpp
4242
attacks.cpp "zobrist.cpp"
43-
"moves_io.cpp" "printers.cpp" "repetition.h")
43+
"moves_io.cpp" "printers.cpp" "repetition.h" "fwd_decl.h")
4444
add_library(chesslib STATIC ${SOURCES})
4545
target_include_directories(chesslib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
46-
add_executable(perft_tt examples/perft_with_tt.cpp)
47-
target_link_libraries(perft_tt PRIVATE chesslib "${ASAN_RUNTIME_LIBS}")
48-
add_executable(debug_efficiency examples/dbg_efficiency.cpp)
49-
target_link_libraries(debug_efficiency PRIVATE chesslib)
5046
# --- Enable CTest integration ---
5147
enable_testing()
5248
include(FetchContent)

examples/dbg_efficiency.cpp

Lines changed: 0 additions & 6 deletions
This file was deleted.

examples/perft_with_tt.cpp

Lines changed: 0 additions & 132 deletions
This file was deleted.

fwd_decl.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#pragma once
2+
#include <cstdint>
3+
#include <type_traits>
4+
namespace chess {
5+
enum Color : uint8_t;
6+
enum PieceType : std::int8_t;
7+
8+
template <typename T, typename = void> struct is_piece_enum : std::false_type {};
9+
10+
template <typename T> struct is_piece_enum<T, std::void_t<decltype(T::PIECE_NB)>> : std::true_type {};
11+
enum CastlingRights : int8_t;
12+
enum Square : int8_t;
13+
enum Direction : int8_t;
14+
enum MoveType : uint16_t;
15+
enum File : int8_t;
16+
enum Rank : int8_t;
17+
class Move;
18+
template <typename T, typename> class _Position;
19+
using Bitboard=uint64_t;
20+
using Key = uint64_t;
21+
// bonus: define the piece enums here
22+
enum class PolyglotPiece : uint8_t;
23+
enum class EnginePiece : uint8_t;
24+
enum class ContiguousMappingPiece : uint8_t;
25+
} // namespace chess

0 commit comments

Comments
 (0)