1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-10 15:59:53 +00:00

rulegen:: debug improvements

This commit is contained in:
Zeno Rogue 2022-02-01 16:57:47 +01:00
parent bff37f0274
commit 37ebe6af5d

View File

@ -1247,7 +1247,7 @@ int get_side(twalker what) {
return res; return res;
} }
int move_code(twalker cs) { EX int move_code(twalker cs) {
bool child = false; bool child = false;
if(cs.at->dist) { if(cs.at->dist) {
auto csd = get_parent_dir(cs); auto csd = get_parent_dir(cs);
@ -1635,6 +1635,8 @@ void verified_treewalk(twalker& tw, int id, int dir) {
treewalk(tw, dir); treewalk(tw, dir);
} }
EX bool view_examine_branch = false;
bool examine_branch(int id, int left, int right) { bool examine_branch(int id, int left, int right) {
auto rg = treestates[id].giver; auto rg = treestates[id].giver;
@ -1676,7 +1678,7 @@ bool examine_branch(int id, int left, int right) {
auto rl = get_rule(wl, tsl); auto rl = get_rule(wl, tsl);
auto rr = get_rule(wr, tsr); auto rr = get_rule(wr, tsr);
if(0) if(debugflags & DF_GEOM) if(view_examine_branch) if(debugflags & DF_GEOM)
println(hlog, "wl = ", wl, " -> ", wl+wstep, " R", rl, " wr = ", wr, " -> ", wr+wstep, " R", rr, " lstack = ", lstack, " rstack = ", rstack); println(hlog, "wl = ", wl, " -> ", wl+wstep, " R", rl, " wr = ", wr, " -> ", wr+wstep, " R", rr, " lstack = ", lstack, " rstack = ", rstack);
if(rl == DIR_RIGHT && rr == DIR_LEFT && lstack.empty() && rstack.empty()) { if(rl == DIR_RIGHT && rr == DIR_LEFT && lstack.empty() && rstack.empty()) {
@ -1684,7 +1686,7 @@ bool examine_branch(int id, int left, int right) {
push_deadstack(hash, wl, tsl, -1); push_deadstack(hash, wl, tsl, -1);
hash.emplace_back(-1, wl.at->dist - wr.at->dist); hash.emplace_back(-1, wl.at->dist - wr.at->dist);
push_deadstack(hash, wr, tsr, +1); push_deadstack(hash, wr, tsr, +1);
if(0) if(debugflags & DF_GEOM) if(view_examine_branch) if(debugflags & DF_GEOM)
println(hlog, "got hash: ", hash); println(hlog, "got hash: ", hash);
if(verified_branches.count(hash)) { if(verified_branches.count(hash)) {
return true; return true;
@ -1870,8 +1872,6 @@ EX void rules_iteration() {
println(hlog, "deadend states found: ", new_deadends); println(hlog, "deadend states found: ", new_deadends);
} }
// print_rules();
handle_distance_errors(); handle_distance_errors();
verified_branches.clear(); verified_branches.clear();