1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-24 02:17:40 +00:00

reg3:: rule:: optimized link_structures

This commit is contained in:
Zeno Rogue
2020-01-29 19:23:31 +01:00
parent 64f9718a54
commit 61d76622a4

View File

@@ -914,6 +914,8 @@ EX namespace reg3 {
map<address, set<address>> nonlooping_earlier_states; map<address, set<address>> nonlooping_earlier_states;
vector<vector<int>> possible_states;
void find_mappings() { void find_mappings() {
auto &nles = nonlooping_earlier_states; auto &nles = nonlooping_earlier_states;
nles.clear(); nles.clear();
@@ -971,6 +973,10 @@ EX namespace reg3 {
} }
DEBB(DF_GEOM, ("removed cases = ", isize(bfs))); DEBB(DF_GEOM, ("removed cases = ", isize(bfs)));
possible_states.resize(qstate);
for(auto& p: nonlooping_earlier_states)
possible_states[p.first.first].push_back(p.first.second);
} }
hrmap_reg3_rule() : fp(0) { hrmap_reg3_rule() : fp(0) {
@@ -1212,10 +1218,7 @@ EX void link_structures(heptagon *h, heptagon *alt, hstate firststate) {
alt->fiftyval = cm->root[alt->fieldval]; alt->fiftyval = cm->root[alt->fieldval];
return; return;
} }
vector<int> choices; vector<int>& choices = cm->possible_states[alt->fieldval];
for(auto p: cm->nonlooping_earlier_states)
if(p.first.first == alt->fieldval)
choices.push_back(p.first.second);
vector<int> choices2; vector<int> choices2;
for(auto c: choices) { for(auto c: choices) {
bool ok = true; bool ok = true;