diff --git a/rulegen3.cpp b/rulegen3.cpp index bbd428b8..5448c4a2 100644 --- a/rulegen3.cpp +++ b/rulegen3.cpp @@ -229,11 +229,13 @@ void be_important(tcell *c) { imp_as_set.insert(c); } +int error_debug = 0; + void build(vstate& vs, vector& places, int where, int where_last, tcell *g) { places[where] = g; twalker wh = g; auto ts0 = get_treestate_id(wh); - println(hlog, "[", where, "<-", where_last, "] [", g, " ] expected treestate = ", vs.vcells[where].tid, " actual treestate = ", ts0); + if(error_debug >= 2) println(hlog, "[", where, "<-", where_last, "] [", g, " ] expected treestate = ", vs.vcells[where].tid, " actual treestate = ", ts0); vector v; vector spins; @@ -241,7 +243,7 @@ void build(vstate& vs, vector& places, int where, int where_last, tcell v.push_back(g->cmove(i)); spins.push_back(g->c.spin(i)); } - println(hlog, g, " -> ", v, " spins: ", spins); + if(error_debug >= 2) println(hlog, g, " -> ", v, " spins: ", spins); auto& c = vs.vcells[where]; for(int i=0; i ", p1, " actual diff = ", p1->dist, "-", p->dist, " expected diff = ", diff, " dir = ", dir, " ts = ", tsid); indenter ind(2); for(int i=0; itype; i++) { int r = get_abs_rule(tsid, i); - if(r < 0 && r != DIR_PARENT) { - println(hlog, "rule ", tie(tsid, i), " is: ", r, " which means ", rev_roadsign_id[r]); - } - else { - println(hlog, "rule ", tie(tsid, i), " is: ", r); + if(error_debug >= 2) { + if(r < 0 && r != DIR_PARENT) { + println(hlog, "rule ", tie(tsid, i), " is: ", r, " which means ", rev_roadsign_id[r]); + } + else { + println(hlog, "rule ", tie(tsid, i), " is: ", r); + } } } int r = get_abs_rule(tsid, dir); - if(r < 0 && r != DIR_PARENT) { + if(error_debug >= 2 && r < 0 && r != DIR_PARENT) { tcell *px = p; auto rr = rev_roadsign_id[r]; for(int i=0; i= 1) println(hlog, "rpath: ", vs.rpath, " does not cycle correctly"); + rpath_errors++; error_found(vs); return; } @@ -356,7 +363,9 @@ void check(vstate& vs) { if(c.adj[p.first] != -1) { int dif = (rule == DIR_PARENT) ? -1 : 1; if(p.second != dif && p.second != MYSTERY) { - println(hlog, "error: connection ", p.first, " at ", vs.current_pos, " has distance ", dif, " but ", p.second, " is expected"); + if(error_debug >= 1) + println(hlog, "error: connection ", p.first, " at ", vs.current_pos, " has distance ", dif, " but ", p.second, " is expected"); + dist_errors++; vs.recursions.push_back({vs.current_pos, p}); error_found(vs); vs.recursions.pop_back(); @@ -409,7 +418,8 @@ void check(vstate& vs) { vs.recursions.push_back({vs.current_pos, p}); auto& v = rev_roadsign_id[rule]; if(v.back() != p.second + 1 && p.second != MYSTERY) { - println(hlog, "error: side connection"); + if(error_debug >= 1) println(hlog, "error: side connection"); + side_errors++; error_found(vs); vs.recursions.pop_back(); return; @@ -1265,6 +1275,7 @@ EX void check_upto(int lev, int t) { for(ignore_level=1; ignore_level <= lev; ignore_level++) { println(hlog, "test ignore_level ", ignore_level); vs.need_cycle = false; + side_errors = rpath_errors = dist_errors = 0; for(int i=0; i impcount) throw rulegen_retry("errors found"); + if((flags & w_r3_all_errors) && isize(important) > impcount) { + println(hlog, "found errors: side ", side_errors, " dist ", dist_errors, " rpath ", rpath_errors); + throw rulegen_retry("errors found"); + } } } EX void check_road_shortcuts() { - println(hlog, "road shortcuts = ", qroad, " treestates = ", isize(treestates), " roadsigns = ", next_roadsign_id, " tcellcount = ", tcellcount); + println(hlog, "road shortcuts = ", qroad, " treestates = ", isize(treestates), " roadsigns = ", next_roadsign_id, " tcellcount = ", tcellcount, " try = ", try_count); if(qroad > last_qroad) { println(hlog, "qroad_for = ", qroad_for); println(hlog, "newcon = ", newcon, " tcellcount = ", tcellcount); newcon = 0; @@ -1318,7 +1332,7 @@ EX void check_road_shortcuts() { next_roadsign_id = -100; throw rulegen_retry("new road shortcuts"); } - println(hlog, "checking validity, important = ", important); + println(hlog, "checking validity, important = ", isize(important)); imp_as_set.clear(); for(auto t: important) imp_as_set.insert(t.at); impcount = isize(important);