1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-26 19:37:40 +00:00

rulegen:: updated tests to use new features

This commit is contained in:
Zeno Rogue
2021-08-22 00:23:51 +02:00
parent 29f2570662
commit 3616221118

View File

@@ -2,6 +2,7 @@
#include "../hyper.h" #include "../hyper.h"
#include <fstream> #include <fstream>
#include <chrono>
namespace hr { namespace hr {
namespace rulegen { namespace rulegen {
@@ -481,6 +482,7 @@ void test_current(string tesname) {
treestates.clear(); treestates.clear();
int tstart = SDL_GetTicks(); int tstart = SDL_GetTicks();
auto begin = std::chrono::high_resolution_clock::now();
try { try {
generate_rules(); generate_rules();
status = "ACC"; status = "ACC";
@@ -503,6 +505,8 @@ void test_current(string tesname) {
message = e.what(); message = e.what();
} }
auto end = std::chrono::high_resolution_clock::now();
if(t_origin.size() && (draw_which & 2)) { if(t_origin.size() && (draw_which & 2)) {
restart_game_on(new hrmap_testproto); restart_game_on(new hrmap_testproto);
view_debug(); view_debug();
@@ -556,12 +560,19 @@ void test_current(string tesname) {
case 'C': Out("code", qcode); case 'C': Out("code", qcode);
case 't': Out("try", try_count); case 't': Out("try", try_count);
case 'T': Out("T", tstart / 1000.); case 'T': Out("T", tstart / 1000.);
case 'P': Out("Tp", std::chrono::duration_cast<std::chrono::nanoseconds>(end-begin).count() / 1000000000.);
case 'y': Out("tree", isize(treestates)); case 'y': Out("tree", isize(treestates));
case 'a': Out("amin;amax", lalign(0, areas[0], ";", areas.back())); case 'a': Out("amin;amax", lalign(0, areas[0], ";", areas.back()));
case 'h': Out("shapes", isize(arb::current.shapes)); case 'h': Out("shapes", isize(arb::current.shapes));
case 'f': Out("file", tesname); case 'f': Out("file", tesname);
case 'l': Out("shortcut", longest_shortcut()); case 'l': Out("shortcut", longest_shortcut());
case '3': Out("shqty", longest_shortcut().first);
case '4': Out("shlong", longest_shortcut().second);
case 'A': Out("analyzer", longest_analyzer()); case 'A': Out("analyzer", longest_analyzer());
case 'H': Out("hard", hard_parents);
case '1': Out("single", single_live_branches);
case '2': Out("double", double_live_branches);
case 'p': Out("premini", states_premini);
} }
println(hlog); println(hlog);
fflush(stdout); fflush(stdout);
@@ -731,8 +742,10 @@ int testargs() {
else if(argis("-trv")) { else if(argis("-trv")) {
shift(); test_rotate_val = argi(); shift(); test_rotate_val = argi();
} }
else if(argis("-resolve")) else if(argis("-ruleflag")) {
try_to_resolve_confusion = true; shift();
rulegen::flags ^= Flag(argi());
}
else if(argis("-view-debug")) else if(argis("-view-debug"))
view_debug(); view_debug();
else if(argis("-print-rules")) else if(argis("-print-rules"))