Browse Source

build: klotski cal core analyser compile

master
Dnomd343 2 years ago
parent
commit
4550f5ed0d
  1. 4
      src/CMakeLists.txt
  2. 45
      src/klotski/CMakeLists.txt
  3. 6
      src/klotski/core/core.cc
  4. 5
      src/klotski/core/core.h
  5. 2
      src/klotski/klotski_ffi.cc
  6. 40
      src/main.cc

4
src/CMakeLists.txt

@ -8,6 +8,10 @@ include_directories(klotski/raw_code)
include_directories(klotski/short_code)
include_directories(klotski/common_code)
include_directories(klotski/core)
include_directories(klotski/analyse)
include_directories(klotski/fast_cal)
add_subdirectory(klotski)
add_executable(klotski_bin main.cc)

45
src/klotski/CMakeLists.txt

@ -2,23 +2,6 @@ cmake_minimum_required(VERSION 3.0)
################################################
include_directories(utils)
include_directories(all_cases)
include_directories(raw_code)
include_directories(short_code)
include_directories(common_code)
#include_directories(core)
#include_directories(analyse)
#include_directories(fast_cal)
#
#include_directories(graph)
#
#include_directories(benchmark)
################################################
add_subdirectory(utils)
add_subdirectory(all_cases)
@ -26,12 +9,11 @@ add_subdirectory(raw_code)
add_subdirectory(short_code)
add_subdirectory(common_code)
#add_subdirectory(core)
#add_subdirectory(analyse)
#add_subdirectory(fast_cal)
#
add_subdirectory(core)
add_subdirectory(analyse)
add_subdirectory(fast_cal)
#add_subdirectory(graph)
#
#add_subdirectory(benchmark)
################################################
@ -45,23 +27,12 @@ target_link_libraries(klotski raw_code)
target_link_libraries(klotski short_code)
target_link_libraries(klotski common_code)
################################################
target_link_libraries(klotski core)
target_link_libraries(klotski analyse)
target_link_libraries(klotski fast_cal)
#target_link_libraries(klotski utils)
#target_link_libraries(klotski all_cases)
################################################
#target_link_libraries(klotski raw_code)
#target_link_libraries(klotski short_code)
#target_link_libraries(klotski common_code)
#
#target_link_libraries(klotski core)
#target_link_libraries(klotski analyse)
#target_link_libraries(klotski fast_cal)
#
#target_link_libraries(klotski graph)
#
#target_link_libraries(klotski benchmark)
#
#target_link_libraries(klotski pthread)
################################################

6
src/klotski/core/core.cc

@ -1,6 +1,12 @@
#include "core.h"
#include "common.h"
/// block move direction
#define UP (-4 * 3)
#define LEFT (-1 * 3)
#define DOWN (+4 * 3)
#define RIGHT (+1 * 3)
/// block direction limit
#define ALLOW_UP (filter != -UP)
#define ALLOW_DOWN (filter != -DOWN)

5
src/klotski/core/core.h

@ -4,11 +4,6 @@
#include <utility>
#include <functional>
#define UP (-4 * 3)
#define LEFT (-1 * 3)
#define DOWN (+4 * 3)
#define RIGHT (+1 * 3)
class Core {
public:
/// Release with code and mask

2
src/klotski/klotski_ffi.cc

@ -1,2 +0,0 @@
#include <iostream>

40
src/main.cc

@ -1,35 +1,32 @@
#include <iostream>
//#include "core.h"
#include "common.h"
#include "all_cases.h"
#include "raw_code.h"
#include "short_code.h"
#include "common_code.h"
//#include "fast_cal.h"
//#include "analyse.h"
#include "common.h"
#include "core.h"
#include "analyse.h"
#include "fast_cal.h"
//#include "graph.h"
//#include "benchmark.h"
#include <thread>
#include <algorithm>
#include <unistd.h>
#include <fstream>
//#include <unistd.h>
//int main(int argc, char *argv[]) {
int main() {
std::cout << "start test" << std::endl;
// std::cout << (uint32_t)Common::check_range(1, Common::range_reverse(0xA9BF0C00)) << std::endl;
std::cout << (uint32_t)Common::check_range(1, Common::range_reverse(0xA9BF0C00)) << std::endl;
// AllCases::build();
// for (const auto &a : AllCases::fetch()) {
// std::cout << a.size() << std::endl;
// }
AllCases::build();
for (const auto &a : AllCases::fetch()) {
std::cout << a.size() << std::endl;
}
std::cout << RawCode::from_common_code("1a9bf0c") << std::endl;
std::cout << RawCode::create(0x0603EDF5CAFFF5E2) << std::endl;
@ -43,6 +40,21 @@ int main() {
std::cout << ShortCode::from_string("4WVE1") << std::endl;
std::cout << ShortCode::from_common_code(0x1A9BF0C00) << std::endl;
auto core = Core([](uint64_t code, uint64_t mask) {
printf("new case -> code = %015lX | mask = %015lX\n", code, mask);
});
core.next_cases(RawCode::from_common_code("1a9bf0c").unwrap(), 0);
for (const auto &c : FastCal::resolve(RawCode::from_common_code("1a9bf0c"))) {
std::cout << c << std::endl;
}
auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
for (const auto &s : a.build_resolve()) {
std::cout << s << std::endl;
}
std::cout << "end test" << std::endl;
// BasicRanges::build();

Loading…
Cancel
Save