|
@ -3,6 +3,7 @@ |
|
|
#include <algorithm> |
|
|
#include <algorithm> |
|
|
|
|
|
|
|
|
#include <set> |
|
|
#include <set> |
|
|
|
|
|
#include <map> |
|
|
#include <unordered_set> |
|
|
#include <unordered_set> |
|
|
#include <unordered_map> |
|
|
#include <unordered_map> |
|
|
|
|
|
|
|
@ -27,74 +28,69 @@ using klotski::CommonCode; |
|
|
using klotski::Benchmark; |
|
|
using klotski::Benchmark; |
|
|
using klotski::BasicRanges; |
|
|
using klotski::BasicRanges; |
|
|
|
|
|
|
|
|
|
|
|
using klotski::TYPE_ID_LIMIT; |
|
|
|
|
|
|
|
|
void tmain() { |
|
|
void tmain() { |
|
|
// printf("tmain start\n");
|
|
|
// printf("tmain start\n");
|
|
|
|
|
|
|
|
|
// auto c = CommonCode(0x1A9BF0C00);
|
|
|
// struct group_info_t {
|
|
|
|
|
|
// uint16_t type_id;
|
|
|
// auto groups = Group::build_groups(Group::type_id(c));
|
|
|
// uint16_t group_id;
|
|
|
// for (uint32_t i = 0; i < groups.size(); ++i) {
|
|
|
// uint32_t group_index;
|
|
|
// std::cout << g.size() << std::endl;
|
|
|
// };
|
|
|
// if (std::find(groups[i].begin(), groups[i].end(), c) != groups[i].end()) {
|
|
|
//
|
|
|
// std::cout << i << " -> " << groups[i].size() << std::endl;
|
|
|
// std::vector<group_info_t> data;
|
|
|
// } else {
|
|
|
// data.resize(klotski::SHORT_CODE_LIMIT);
|
|
|
// std::cout << "not found" << std::endl;
|
|
|
// ShortCode::speed_up(ShortCode::FAST);
|
|
|
|
|
|
//
|
|
|
|
|
|
// for (uint16_t type_id = 0; type_id < klotski::TYPE_ID_LIMIT; ++type_id) {
|
|
|
|
|
|
// auto groups = Group::build_groups(type_id);
|
|
|
|
|
|
// for (uint32_t id = 0; id < groups.size(); ++id) {
|
|
|
|
|
|
//
|
|
|
|
|
|
// std::sort(groups[id].begin(), groups[id].end());
|
|
|
|
|
|
//
|
|
|
|
|
|
// for (uint32_t index = 0; index < groups[id].size(); ++index) {
|
|
|
|
|
|
// data[groups[id][index].to_short_code().unwrap()] = {
|
|
|
|
|
|
// .type_id = type_id,
|
|
|
|
|
|
// .group_id = static_cast<uint16_t>(id),
|
|
|
|
|
|
// .group_index = index,
|
|
|
|
|
|
// };
|
|
|
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
// std::cerr << type_id << std::endl;
|
|
|
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
|
|
|
// for (auto &&tmp : data) {
|
|
|
|
|
|
// std::cout << tmp.group_index << std::endl;
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
|
|
|
struct group_info_t { |
|
|
// std::vector<uint32_t> group_num;
|
|
|
uint16_t type_id; |
|
|
// for (uint16_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) {
|
|
|
uint16_t group_id; |
|
|
// group_num.emplace_back(Group::build_groups(type_id).size());
|
|
|
uint32_t group_index; |
|
|
// }
|
|
|
}; |
|
|
// for (auto &&tmp : group_num) {
|
|
|
|
|
|
// std::cout << tmp << std::endl;
|
|
|
// std::unordered_map<CommonCode, group_info_t> data;
|
|
|
// }
|
|
|
|
|
|
|
|
|
std::vector<group_info_t> data; |
|
|
|
|
|
|
|
|
|
|
|
data.resize(klotski::SHORT_CODE_LIMIT); |
|
|
|
|
|
|
|
|
|
|
|
ShortCode::speed_up(ShortCode::FAST); |
|
|
|
|
|
|
|
|
|
|
|
// uint16_t type_id = 123;
|
|
|
|
|
|
|
|
|
|
|
|
for (uint16_t type_id = 0; type_id < klotski::TYPE_ID_LIMIT; ++type_id) { |
|
|
for (uint16_t type_id = 0; type_id < TYPE_ID_LIMIT; ++type_id) { |
|
|
auto groups = Group::build_groups(type_id); |
|
|
auto groups = Group::build_groups(type_id); |
|
|
for (uint32_t id = 0; id < groups.size(); ++id) { |
|
|
std::map<CommonCode, uint32_t> seeds; |
|
|
|
|
|
for (uint32_t group_id = 0; group_id < groups.size(); ++group_id) { |
|
|
|
|
|
auto seed = *std::min_element(groups[group_id].begin(), groups[group_id].end()); |
|
|
|
|
|
seeds.emplace(std::pair<CommonCode, uint32_t>(seed, group_id)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
std::sort(groups[id].begin(), groups[id].end()); |
|
|
// std::cout << seeds.size() << std::endl;
|
|
|
|
|
|
|
|
|
for (uint32_t index = 0; index < groups[id].size(); ++index) { |
|
|
for (auto &&tmp: seeds) { |
|
|
data[groups[id][index].to_short_code().unwrap()] = { |
|
|
// std::cout << tmp.first << " -> " << tmp.second << std::endl;
|
|
|
.type_id = type_id, |
|
|
std::cout << tmp.first << std::endl; |
|
|
.group_id = static_cast<uint16_t>(id), |
|
|
|
|
|
.group_index = index, |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
// std::cout << type_id << std::endl;
|
|
|
|
|
|
std::cerr << type_id << std::endl; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// std::cout << data.size() << std::endl;
|
|
|
std::cerr << type_id << std::endl; |
|
|
|
|
|
|
|
|
for (auto &&tmp : data) { |
|
|
|
|
|
std::cout << tmp.group_index << std::endl; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// for (auto &&g : Group::build_groups(123)) {
|
|
|
|
|
|
|
|
|
|
|
|
// std::cout << *std::min_element(g.begin(), g.end()) << std::endl;
|
|
|
|
|
|
|
|
|
|
|
|
// std::cout << g.size() << std::endl;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// for (uint32_t type_id = 0; type_id < 204; ++type_id) {
|
|
|
|
|
|
// std::cout << Group::build_groups(type_id).size() << std::endl;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// printf("tmain exit\n");
|
|
|
// printf("tmain exit\n");
|
|
|
} |
|
|
} |
|
|