CMakeLists.txt (2262B)
1 add_executable(perft perft.cpp) 2 3 option(STELLAR_FULL_COUNT "Make count on types of moves" OFF) 4 if(STELLAR_FULL_COUNT) 5 add_definitions(-DUSE_FULL_COUNT) 6 endif() 7 8 target_link_libraries(perft 9 PRIVATE bitboard 10 PRIVATE board 11 PRIVATE moves 12 PRIVATE piece 13 PRIVATE utils 14 ) 15 16 set_target_properties(perft PROPERTIES 17 VERSION ${PROJECT_VERSION} 18 SOVERSION ${PROJECT_VERSION_MAJOR} 19 RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" 20 ) 21 22 # position and results taken from chessprogramming.com 23 24 set(STELLAR_PERFT_START_TEST "Start" "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1") 25 set(STELLAR_PERFT_START_RESULTS 20 400 8902 197281 4865609 119060324 3195901860) 26 27 set(STELLAR_PERFT_TRICKY_TEST "Tricky" "r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 1") 28 set(STELLAR_PERFT_TRICKY_RESULTS 48 2039 97862 4085603 193690690 8031647685) 29 30 set(STELLAR_PERFT_ENDGAME_TEST "Endgame" "8/2p5/3p4/KP5r/1R3p1k/8/4P1P1/8 w - -") 31 set(STELLAR_PERFT_ENDGAME_RESULTS 14 191 2812 43238 674624 11030083 178633661 3009794393) 32 33 set(STELLAR_PERFT_MIDGAME_TEST "Midgame" "r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1") 34 set(STELLAR_PERFT_MIDGAME_RESULTS 6 264 9467 422333 15833292 706045033) 35 36 set(STELLAR_PERFT_RMIDGAME_TEST "Reverse Midgame" "r2q1rk1/pP1p2pp/Q4n2/bbp1p3/Np6/1B3NBn/pPPP1PPP/R3K2R b KQ - 0 1") 37 set(STELLAR_PERFT_RMIDGAME_RESULTS 6 264 9467 422333 15833292 706045033) 38 39 set(STELLAR_PERFT_BUGGY_TEST "Buggy" "rnbq1k1r/pp1Pbppp/2p5/8/2B5/8/PPP1NnPP/RNBQK2R w KQ - 1 8") 40 set(STELLAR_PERFT_BUGGY_RESULTS 44 1486 62379 2103487 89941194) 41 42 set(STELLAR_PERFT_TEST START MIDGAME RMIDGAME ENDGAME TRICKY BUGGY) 43 44 foreach(test_name ${STELLAR_PERFT_TEST}) 45 set(test STELLAR_PERFT_${test_name}_TEST) 46 set(res STELLAR_PERFT_${test_name}_RESULTS) 47 list(GET ${test} 0 name) 48 list(GET ${test} 1 fen) 49 list(LENGTH ${res} size) 50 foreach(depth RANGE 1 ${size}) 51 math(EXPR index "${depth} - 1") 52 list(GET ${res} ${index} test_expected) 53 set(test_name "${name} Position Depth ${depth}") 54 add_test(NAME ${test_name} COMMAND perft -f "${fen}" -t8 -d${depth}) 55 set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION ${test_expected}) 56 endforeach() 57 endforeach()