Browse Source

update: project file structure

master
Dnomd343 2 years ago
parent
commit
1e9dd7e1fc
  1. 6
      src/CMakeLists.txt
  2. 4
      src/all_cases/CMakeLists.txt
  3. 4
      src/common/CMakeLists.txt
  4. 9
      src/common/common.h
  5. 2
      src/common_code/CMakeLists.txt
  6. 2
      src/core/core.cc
  7. 10
      src/core/core.h
  8. 1
      src/fast_cal.cc
  9. 2
      src/raw_code/CMakeLists.txt
  10. 12
      src/raw_code/raw_code.h
  11. 2
      src/short_code/CMakeLists.txt
  12. 4
      src/utils/CMakeLists.txt
  13. 0
      src/utils/common.cc
  14. 31
      src/utils/common.h

6
src/CMakeLists.txt

@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.0)
include_directories(core)
include_directories(common)
include_directories(utils)
include_directories(all_cases)
include_directories(raw_code)
@ -9,7 +9,7 @@ include_directories(short_code)
include_directories(common_code)
add_subdirectory(core)
add_subdirectory(common)
add_subdirectory(utils)
add_subdirectory(all_cases)
add_subdirectory(raw_code)
@ -20,7 +20,7 @@ add_subdirectory(common_code)
add_executable(klotski main.cc fast_cal.cc)
target_link_libraries(klotski core)
target_link_libraries(klotski common)
target_link_libraries(klotski utils)
target_link_libraries(klotski all_cases)
target_link_libraries(klotski raw_code)

4
src/all_cases/CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(all_cases basic_ranges.cc all_cases.cc)
target_link_libraries(all_cases common)
add_library(all_cases all_cases.cc basic_ranges.cc)
target_link_libraries(all_cases utils)

4
src/common/CMakeLists.txt

@ -1,4 +0,0 @@
cmake_minimum_required(VERSION 3.0)
add_library(common common.cc)
target_link_libraries(common short_code)

9
src/common/common.h

@ -1,9 +0,0 @@
#pragma once
#include <cstdint>
class Common {
public:
static uint32_t range_reverse(uint32_t bin);
static bool check_case(uint32_t head, uint32_t range);
};

2
src/common_code/CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(common_code common_code.cc)
target_link_libraries(common_code common)
target_link_libraries(common_code utils)

2
src/core/core.cc

@ -1,5 +1,5 @@
#include "core.h"
#include "raw_code.h"
#include "common.h"
#define ALLOW_UP (filter != -UP)
#define ALLOW_DOWN (filter != -DOWN)

10
src/core/core.h

@ -7,16 +7,6 @@
#define DOWN (+12) // +4 * 3-bits
#define RIGHT (+3) // +1 * 3-bits
#define F_1x1 (uint64_t)0x7 // 111
#define F_1x2 (uint64_t)0x3F // 111 111
#define F_2x1 (uint64_t)0x7007 // 111 000 000 000 111
#define F_2x2 (uint64_t)0x3F03F // 111 111 000 000 111 111
#define F_1x1_R (uint64_t)0x38 // 111 000
#define F_1x1_D (uint64_t)0x7000 // 111 000 000 000 000
#define F_2x1_R (uint64_t)0x38038 // 111 000 000 000 111 000
#define F_1x2_D (uint64_t)0x3F000 // 111 111 000 000 000 000
class Core {
public:
void next_step(uint64_t code, uint64_t mask);

1
src/fast_cal.cc

@ -4,6 +4,7 @@
#include "core.h"
#include "fast_cal.h"
#include "raw_code.h"
#include "common.h"
struct fast_cal_t {
uint64_t code;

2
src/raw_code/CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(raw_code raw_code.cc)
target_link_libraries(raw_code common common_code)
target_link_libraries(raw_code utils common_code)

12
src/raw_code/raw_code.h

@ -3,18 +3,6 @@
#include <cstdint>
#include "common_code.h"
#define B_space 0b000
#define B_fill 0b111
#define B_1x2 0b001
#define B_2x1 0b010
#define B_1x1 0b011
#define B_2x2 0b100
#define C_1x1 (uint64_t)0x3 // 011
#define C_1x2 (uint64_t)0x39 // 111 001
#define C_2x1 (uint64_t)0x7002 // 111 000 000 000 010
#define C_2x2 (uint64_t)0x3F03C // 111 111 000 000 111 100
class CommonCode;
class RawCode {

2
src/short_code/CMakeLists.txt

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(short_code convert.cc short_code.cc data_loader.cc)
target_link_libraries(short_code common all_cases)
target_link_libraries(short_code utils all_cases)

4
src/utils/CMakeLists.txt

@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 3.0)
add_library(utils common.cc)
target_link_libraries(utils short_code)

0
src/common/common.cc → src/utils/common.cc

31
src/utils/common.h

@ -0,0 +1,31 @@
#pragma once
#include <cstdint>
#define B_space 0b000
#define B_fill 0b111
#define B_1x2 0b001
#define B_2x1 0b010
#define B_1x1 0b011
#define B_2x2 0b100
#define C_1x1 (uint64_t)0x3 // 011
#define C_1x2 (uint64_t)0x39 // 111 001
#define C_2x1 (uint64_t)0x7002 // 111 000 000 000 010
#define C_2x2 (uint64_t)0x3F03C // 111 111 000 000 111 100
#define F_1x1 (uint64_t)0x7 // 111
#define F_1x2 (uint64_t)0x3F // 111 111
#define F_2x1 (uint64_t)0x7007 // 111 000 000 000 111
#define F_2x2 (uint64_t)0x3F03F // 111 111 000 000 111 111
#define F_1x1_R (uint64_t)0x38 // 111 000
#define F_1x1_D (uint64_t)0x7000 // 111 000 000 000 000
#define F_2x1_R (uint64_t)0x38038 // 111 000 000 000 111 000
#define F_1x2_D (uint64_t)0x3F000 // 111 111 000 000 000 000
class Common {
public:
static uint32_t range_reverse(uint32_t bin);
static bool check_case(uint32_t head, uint32_t range);
};
Loading…
Cancel
Save