1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-18 03:04:48 +00:00

rulegen:: optimize in 2D, also debug information during optimize is toggleable

This commit is contained in:
Zeno Rogue 2024-03-19 18:53:09 +01:00
parent 0e018df878
commit a82d9b2266
2 changed files with 7 additions and 2 deletions

View File

@ -85,6 +85,9 @@ static constexpr flagtype w_less_smart_advance = Flag(23); /*< stop early when e
static constexpr flagtype w_no_queued_extensions = Flag(24); /*< consider extensions one by one */
static constexpr flagtype w_no_branch_skipping = Flag(24); /*< do not skip branches */
/* extra */
static constexpr flagtype w_optimize2 = Flag(25); /*< optimize in 2D */
/* for 3D honeycombs */
static constexpr flagtype w_skip_transducers = Flag(32); /*< skip the transducer test */
static constexpr flagtype w_skip_transducer_loops = Flag(33); /*< skip loops during the transducer test */
@ -2001,6 +2004,8 @@ EX void rules_iteration() {
if(examine_branch(id, fb, sb)) checks_to_skip.insert(b);
};
if(WDIM == 2 && (flags & w_optimize2)) optimize();
if(WDIM == 2) for(int id=0; id<isize(treestates); id++) if(treestates[id].is_live) {
auto r = treestates[id].rules; /* no & because treestates might have moved */
if(r.empty()) continue;

View File

@ -1430,7 +1430,7 @@ EX void optimize() {
int N = isize(treestates);
println(hlog, "optimize: changes = ", changes, " errors = ", errors, " unreachable = ", N - isize(seen));
if(rdebug_flags & 64) println(hlog, "optimize: changes = ", changes, " errors = ", errors, " unreachable = ", N - isize(seen));
if(errors) throw rulegen_retry("error found in optimize");
@ -1471,7 +1471,7 @@ EX void optimize() {
}
}
if(steps) { println(hlog, "steps = ", steps); throw rulegen_retry("unreachable found in optimize"); }
if(steps) { if(rdebug_flags & 64) println(hlog, "steps = ", steps); throw rulegen_retry("unreachable found in optimize"); }
important.clear();
for(auto s: seen) important.push_back(treestates[s].giver);