Browse Source

feat: init type for AllCases

legacy
Dnomd343 2 years ago
parent
commit
614ad48f7f
  1. 11
      klotski/all_cases.cc
  2. 9
      klotski/all_cases.h
  3. 9
      klotski/main.cc

11
klotski/all_cases.cc

@ -107,6 +107,17 @@ void AllCases::find_all_cases() { // find all valid cases
}
}
AllCases::AllCases(enum InitType init) {
switch (init) {
case InitType::WITH_ALL_CASES:
get_all_cases();
case InitType::WITH_BASIC_RANGES:
get_basic_ranges();
case WITH_NOTHING:
break;
}
}
const std::vector<uint32_t>* AllCases::get_basic_ranges() {
if (basic_ranges.empty()) {
build_basic_ranges(); // basic ranges initialize

9
klotski/all_cases.h

@ -5,7 +5,14 @@
class AllCases {
public:
// AllCases() {}
enum InitType {
WITH_NOTHING,
WITH_BASIC_RANGES,
WITH_ALL_CASES,
};
explicit AllCases(enum InitType init);
AllCases():AllCases(InitType::WITH_NOTHING) {};
const std::vector<uint32_t>* get_basic_ranges();
const std::vector<uint32_t> (*get_all_cases())[16];

9
klotski/main.cc

@ -3,10 +3,15 @@
int main() {
auto a = AllCases();
// auto a = AllCases();
// auto a = AllCases(AllCases::InitType::WITH_NOTHING);
// auto a = AllCases(AllCases::InitType::WITH_BASIC_RANGES);
auto a = AllCases(AllCases::InitType::WITH_ALL_CASES);
std::cout << "basic range size: " << a.get_basic_ranges()->size() << std::endl;
std::cout << "start get basic ranges" << std::endl;
std::cout << "basic range: " << a.get_basic_ranges()->size() << std::endl;
std::cout << "start get all cases" << std::endl;
for (const auto &temp : *a.get_all_cases()) {
std::cout << temp.size() << std::endl;
}

Loading…
Cancel
Save