|
|
@ -13,10 +13,12 @@ |
|
|
|
#include <thread> |
|
|
|
#include <algorithm> |
|
|
|
#include <unistd.h> |
|
|
|
#include <fstream> |
|
|
|
|
|
|
|
//int main(int argc, char *argv[]) {
|
|
|
|
int main() { |
|
|
|
|
|
|
|
BasicRanges::build(); |
|
|
|
// BasicRanges::build();
|
|
|
|
// AllCases::build();
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +44,7 @@ int main() { |
|
|
|
// sleep(3);
|
|
|
|
|
|
|
|
// std::cout << "start benchmark" << std::endl;
|
|
|
|
auto start_time = clock(); |
|
|
|
// auto start_time = clock();
|
|
|
|
|
|
|
|
|
|
|
|
// auto fc = FastCal(RawCode::from_common_code("1a9bf0c"));
|
|
|
@ -60,11 +62,34 @@ int main() { |
|
|
|
// auto a = Analyse(RawCode::from_common_code("1a9bf0c"));
|
|
|
|
// auto a = Analyse(RawCode::from_common_code("4fea134"));
|
|
|
|
// auto a = Analyse(RawCode::from_common_code("A5D3AF"));
|
|
|
|
auto a = Analyse(RawCode::from_common_code("1FA6F80")); |
|
|
|
// auto a = Analyse(RawCode::from_common_code("1FA6F80"));
|
|
|
|
// auto a = Analyse(RawCode::from_common_code("0F5747"));
|
|
|
|
|
|
|
|
// if (argc < 2) {
|
|
|
|
// std::cout << "without input code" << std::endl;
|
|
|
|
// }
|
|
|
|
// auto a = Analyse(RawCode::from_common_code(argv[1]));
|
|
|
|
|
|
|
|
|
|
|
|
std::string input; |
|
|
|
std::cout << "Please give a common code: "; |
|
|
|
std::cin >> input; |
|
|
|
|
|
|
|
auto common_code = CommonCode::from_string(input); |
|
|
|
|
|
|
|
std::cout << ShortCode::from_common_code(common_code).to_string() << " -> "; |
|
|
|
|
|
|
|
auto start_time = clock(); |
|
|
|
|
|
|
|
auto a = Analyse(RawCode::from_common_code(common_code)); |
|
|
|
|
|
|
|
// a.build();
|
|
|
|
auto ret = a.build_until([](uint64_t code) { |
|
|
|
return ((code >> (3 * 0xD)) & 0b111) == B_2x2; |
|
|
|
}); |
|
|
|
std::cout << ret.size() << std::endl; |
|
|
|
|
|
|
|
std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl; |
|
|
|
|
|
|
|
// std::cout << "analyse complete" << std::endl;
|
|
|
|
// for (const auto &r : ret) {
|
|
|
@ -80,7 +105,15 @@ int main() { |
|
|
|
// std::cout << "backtrack complete" << std::endl;
|
|
|
|
|
|
|
|
auto g = Graph(); |
|
|
|
g.svg_demo(svg_ret); |
|
|
|
auto svg_data = g.svg_demo(svg_ret); |
|
|
|
|
|
|
|
|
|
|
|
std::ofstream output; |
|
|
|
output.open(common_code.to_string(true) + ".svg"); |
|
|
|
output << svg_data << std::endl; |
|
|
|
output.close(); |
|
|
|
|
|
|
|
// std::cout << svg_data << std::endl;
|
|
|
|
|
|
|
|
// auto start_time = clock();
|
|
|
|
|
|
|
@ -126,11 +159,12 @@ int main() { |
|
|
|
|
|
|
|
// std::cerr << (clock() - start_time) / CLOCKS_PER_SEC << "s" << std::endl;
|
|
|
|
// std::cerr << (clock() - start_time) * 1000 / CLOCKS_PER_SEC << "ms" << std::endl;
|
|
|
|
std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl; |
|
|
|
// std::cerr << (clock() - start_time) * 1000000 / CLOCKS_PER_SEC << "us" << std::endl;
|
|
|
|
|
|
|
|
// std::cout << "complete benchmark" << std::endl;
|
|
|
|
|
|
|
|
// pause();
|
|
|
|
std::cerr << "Press CTRL-C for exit..."; |
|
|
|
pause(); |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|