#pragma once #include #include #include #include #include #include "core.h" #include "raw_code.h" // TODO: try double or 4-times size const uint32_t ANY_MAP_RESERVE = 65536; // TODO: Analyse enter klotski namespace later using namespace klotski; class Analyse { public: typedef std::function match_t; /// setting root code void set_root(const RawCode &code); explicit Analyse(const RawCode &code); /// BFS search functions void build(); std::vector build_resolve(); // TODO: build_furthest std::vector build_until(const match_t &match); /// analysed layer export // TODO: ending point search std::vector> layer_export(); std::vector layer_export(uint32_t layer_num); private: struct analyse_t { uint64_t code; uint64_t mask; uint32_t step; std::list src; }; uint64_t root; std::queue cache; std::unordered_map cases; inline Core init(uint64_t code); void new_case(uint64_t code, uint64_t mask); /// backtrack definitions public: struct track_t { // TODO: try using RawCode uint64_t code; uint32_t layer_num; std::list last; std::list next; }; // TODO: try using RawCode typedef std::vector> track_data_t; // TODO: using RawCode instead of uint64_t track_data_t backtrack(const std::vector &codes); // TODO: RawCode enable `hash` and `equal_to` trait in namespace std };