mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
rulegen:: extra stats, extra cleanup
This commit is contained in:
parent
a272bb399d
commit
60a8992b29
25
rulegen.cpp
25
rulegen.cpp
@ -46,6 +46,12 @@ EX bool parent_debug;
|
|||||||
EX int tcellcount = 0;
|
EX int tcellcount = 0;
|
||||||
/** number of tcells united into other tcells */
|
/** number of tcells united into other tcells */
|
||||||
EX int tunified = 0;
|
EX int tunified = 0;
|
||||||
|
/** hard cases for get_parent_dir */
|
||||||
|
EX int hard_parents = 0;
|
||||||
|
/** the number of roots with single live branches */
|
||||||
|
EX int single_live_branches = 0;
|
||||||
|
/** the number of roots with double live branches */
|
||||||
|
EX int double_live_branches = 0;
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
struct tcell* tmove(tcell *c, int d);
|
struct tcell* tmove(tcell *c, int d);
|
||||||
@ -278,8 +284,6 @@ struct hr_solid_error : rulegen_retry {
|
|||||||
|
|
||||||
int solid_errors;
|
int solid_errors;
|
||||||
|
|
||||||
int get_parent_dir(tcell *c);
|
|
||||||
|
|
||||||
#if HDR
|
#if HDR
|
||||||
struct shortcut {
|
struct shortcut {
|
||||||
vector<int> pre;
|
vector<int> pre;
|
||||||
@ -632,6 +636,7 @@ EX int get_parent_dir(tcell *c) {
|
|||||||
if(ne != bestd && beats(ne, bestd)) {
|
if(ne != bestd && beats(ne, bestd)) {
|
||||||
|
|
||||||
if(try_to_resolve_confusion) {
|
if(try_to_resolve_confusion) {
|
||||||
|
hard_parents++;
|
||||||
vector<int> best;
|
vector<int> best;
|
||||||
int bestfor = ne;
|
int bestfor = ne;
|
||||||
trace_root_path(best, twalker(c, ne));
|
trace_root_path(best, twalker(c, ne));
|
||||||
@ -1411,21 +1416,29 @@ EX void rules_iteration() {
|
|||||||
verified_branches.clear();
|
verified_branches.clear();
|
||||||
|
|
||||||
int q = isize(single_live_branch_close_to_root);
|
int q = isize(single_live_branch_close_to_root);
|
||||||
|
|
||||||
|
single_live_branches = 0;
|
||||||
|
double_live_branches = 0;
|
||||||
|
|
||||||
for(int id=0; id<isize(treestates); id++) if(treestates[id].is_live) {
|
for(int id=0; id<isize(treestates); id++) if(treestates[id].is_live) {
|
||||||
auto r = treestates[id].rules; /* no & because treestates might have moved */
|
auto r = treestates[id].rules; /* no & because treestates might have moved */
|
||||||
if(r.empty()) continue;
|
if(r.empty()) continue;
|
||||||
int last_live_branch = -1;
|
int last_live_branch = -1;
|
||||||
int first_live_branch = -1;
|
int first_live_branch = -1;
|
||||||
|
int qbranches = 0;
|
||||||
for(int i=0; i<isize(r); i++)
|
for(int i=0; i<isize(r); i++)
|
||||||
if(r[i] >= 0 && treestates[r[i]].is_live) {
|
if(r[i] >= 0 && treestates[r[i]].is_live) {
|
||||||
if(first_live_branch == -1) first_live_branch = i;
|
if(first_live_branch == -1) first_live_branch = i;
|
||||||
if(last_live_branch >= 0)
|
if(last_live_branch >= 0)
|
||||||
examine_branch(id, last_live_branch, i);
|
examine_branch(id, last_live_branch, i);
|
||||||
last_live_branch = i;
|
last_live_branch = i;
|
||||||
|
qbranches++;
|
||||||
}
|
}
|
||||||
|
if(qbranches == 2) double_live_branches++;
|
||||||
if(first_live_branch == last_live_branch && treestates[id].is_root) {
|
if(first_live_branch == last_live_branch && treestates[id].is_root) {
|
||||||
println(hlog, "for id ", id, " we have a single live branch");
|
if(debugflags & DF_GEOM)
|
||||||
|
println(hlog, "for id ", id, " we have a single live branch");
|
||||||
|
single_live_branches++;
|
||||||
indenter ind(2);
|
indenter ind(2);
|
||||||
debuglist = { treestates[id].giver };
|
debuglist = { treestates[id].giver };
|
||||||
find_single_live_branch(treestates[id].giver);
|
find_single_live_branch(treestates[id].giver);
|
||||||
@ -1433,7 +1446,8 @@ EX void rules_iteration() {
|
|||||||
if(isize(single_live_branch_close_to_root) != q) {
|
if(isize(single_live_branch_close_to_root) != q) {
|
||||||
vector<tcell*> v;
|
vector<tcell*> v;
|
||||||
for(auto c: single_live_branch_close_to_root) v.push_back(c);
|
for(auto c: single_live_branch_close_to_root) v.push_back(c);
|
||||||
println(hlog, "changed single_live_branch_close_to_root from ", q, " to ", v);
|
if(debugflags & DF_GEOM)
|
||||||
|
println(hlog, "changed single_live_branch_close_to_root from ", q, " to ", v);
|
||||||
debuglist = { treestates[id].giver };
|
debuglist = { treestates[id].giver };
|
||||||
throw rulegen_retry("single live branch");
|
throw rulegen_retry("single live branch");
|
||||||
}
|
}
|
||||||
@ -1494,6 +1508,9 @@ EX void generate_rules() {
|
|||||||
clear_all();
|
clear_all();
|
||||||
|
|
||||||
analyzers.clear();
|
analyzers.clear();
|
||||||
|
important.clear();
|
||||||
|
treestates.clear();
|
||||||
|
hard_parents = single_live_branches = double_live_branches = 0;
|
||||||
|
|
||||||
t_origin.clear();
|
t_origin.clear();
|
||||||
for(auto& ts: arb::current.shapes) {
|
for(auto& ts: arb::current.shapes) {
|
||||||
|
Loading…
Reference in New Issue
Block a user