mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-18 15:00:26 +00:00
rulegen3:: when check_det fails do not assume it succeeds
This commit is contained in:
parent
f866f66582
commit
7a5b2dcf25
26
rulegen3.cpp
26
rulegen3.cpp
@ -486,14 +486,14 @@ void check(vstate& vs) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_det(vstate& vs) {
|
bool check_det(vstate& vs) {
|
||||||
indenter ind(check_debug >= 3 ? 2 : 0);
|
indenter ind(check_debug >= 3 ? 2 : 0);
|
||||||
back: ;
|
back: ;
|
||||||
if(check_debug >= 3) println(hlog, "vcells=", isize(vs.vcells), " pos=", vs.current_pos, " stack=", vs.movestack, " rpath=", vs.rpath);
|
if(check_debug >= 3) println(hlog, "vcells=", isize(vs.vcells), " pos=", vs.current_pos, " stack=", vs.movestack, " rpath=", vs.rpath);
|
||||||
|
|
||||||
if(vs.movestack.empty()) {
|
if(vs.movestack.empty()) {
|
||||||
if(check_debug >= 2) println(hlog, "rpath: ", vs.rpath, " successful");
|
if(check_debug >= 2) println(hlog, "rpath: ", vs.rpath, " successful");
|
||||||
return;
|
return true;
|
||||||
}
|
}
|
||||||
auto p = vs.movestack.back();
|
auto p = vs.movestack.back();
|
||||||
auto& c = vs.vcells[vs.current_pos];
|
auto& c = vs.vcells[vs.current_pos];
|
||||||
@ -507,7 +507,7 @@ void check_det(vstate& vs) {
|
|||||||
int dif = (rule == DIR_PARENT) ? -1 : 1;
|
int dif = (rule == DIR_PARENT) ? -1 : 1;
|
||||||
if(p.second != dif && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
|
if(p.second != dif && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
|
||||||
error_found(vs);
|
error_found(vs);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
vs.movestack.pop_back();
|
vs.movestack.pop_back();
|
||||||
goto back;
|
goto back;
|
||||||
@ -534,7 +534,7 @@ void check_det(vstate& vs) {
|
|||||||
auto& v = rev_roadsign_id[rule];
|
auto& v = rev_roadsign_id[rule];
|
||||||
if(v.back() != p.second + 1 && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
|
if(v.back() != p.second + 1 && p.second != MYSTERY && !(flags & w_ignore_transducer_dist)) {
|
||||||
error_found(vs);
|
error_found(vs);
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
vs.movestack.pop_back();
|
vs.movestack.pop_back();
|
||||||
if(check_debug >= 3) println(hlog, "side connection: ", v);
|
if(check_debug >= 3) println(hlog, "side connection: ", v);
|
||||||
@ -864,9 +864,9 @@ void throw_identity_errors(const transducer& id, const vector<int>& cyc) {
|
|||||||
vector<int> path1;
|
vector<int> path1;
|
||||||
build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int i) { return q[i].ts; });
|
build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int i) { return q[i].ts; });
|
||||||
println(hlog, "suspicious path found at ", path1);
|
println(hlog, "suspicious path found at ", path1);
|
||||||
check_det(vs);
|
bool ok = check_det(vs);
|
||||||
if(flags & w_r3_all_errors) return;
|
if(ok) throw rulegen_failure("suspicious path worked");
|
||||||
throw rulegen_failure("suspicious path worked");
|
return;
|
||||||
}
|
}
|
||||||
for(auto p: sch.at->t) {
|
for(auto p: sch.at->t) {
|
||||||
int d = p.first.first;
|
int d = p.first.first;
|
||||||
@ -921,9 +921,9 @@ void throw_distance_errors(const transducer& id, int dir, int delta) {
|
|||||||
vector<int> path1;
|
vector<int> path1;
|
||||||
build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int i) { return q[i].ts; });
|
build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int i) { return q[i].ts; });
|
||||||
println(hlog, "suspicious distance path found at ", path1);
|
println(hlog, "suspicious distance path found at ", path1);
|
||||||
check_det(vs);
|
bool ok = check_det(vs);
|
||||||
if(flags & w_r3_all_errors) return;
|
if(ok) throw rulegen_failure("suspicious distance path worked");
|
||||||
throw rulegen_failure("suspicious distance path worked");
|
return;
|
||||||
}
|
}
|
||||||
for(auto p: sch.at->t) {
|
for(auto p: sch.at->t) {
|
||||||
int d = p.first.first;
|
int d = p.first.first;
|
||||||
@ -1089,7 +1089,8 @@ EX void find_multiple_interpretation() {
|
|||||||
int at0 = at;
|
int at0 = at;
|
||||||
println(hlog, path1);
|
println(hlog, path1);
|
||||||
vs.movestack = {{xdir, MYSTERY}};
|
vs.movestack = {{xdir, MYSTERY}};
|
||||||
check_det(vs);
|
bool ok = check_det(vs);
|
||||||
|
if(!ok) return;
|
||||||
gen_path(vs, path4);
|
gen_path(vs, path4);
|
||||||
println(hlog, "path4 = ", path4);
|
println(hlog, "path4 = ", path4);
|
||||||
build_vstate(vs, path2, parent_dir2, parent_id, i, [&] (int i) { return q[i].ts2; });
|
build_vstate(vs, path2, parent_dir2, parent_id, i, [&] (int i) { return q[i].ts2; });
|
||||||
@ -1234,7 +1235,8 @@ EX void test_transducers() {
|
|||||||
vs.movestack = { { dir, MYSTERY } };
|
vs.movestack = { { dir, MYSTERY } };
|
||||||
vector<int> path1, path2;
|
vector<int> path1, path2;
|
||||||
int at = build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int j) { return q[j].ts; });
|
int at = build_vstate(vs, path1, parent_dir, parent_id, i, [&] (int j) { return q[j].ts; });
|
||||||
check_det(vs);
|
bool ok = check_det(vs);
|
||||||
|
if(!ok) return;
|
||||||
gen_path(vs, path2);
|
gen_path(vs, path2);
|
||||||
int trans = max(isize(path1), isize(path2));
|
int trans = max(isize(path1), isize(path2));
|
||||||
int ts1 = q[at].ts;
|
int ts1 = q[at].ts;
|
||||||
|
Loading…
Reference in New Issue
Block a user