diff --git a/rogueviz/magmahep.cpp b/rogueviz/magmahep.cpp index 0fa2c0cd..62cc500d 100644 --- a/rogueviz/magmahep.cpp +++ b/rogueviz/magmahep.cpp @@ -47,6 +47,10 @@ EX transmatrix get_adj(int a, int b) { return Res; } +pair hash(hyperpoint h) { + return {int(h[0] * 1000000 + .5), int(h[1] * 1000000 + .5)}; + } + void make() { int& v = magmav; @@ -66,6 +70,26 @@ void make() { for(int i=0; i, int> counts; + + int big = v - 2; + + auto rehash = [&] (const transmatrix& T) { + for(int a=0; a 2 && a < down) + counts[hashval] += 2*v - big; + else + counts[hashval] += big; + } + }; + heps.emplace_back(Id, 0xFFFFFFFF); auto advance = [&] (int i, int j, bool mirror = false) { @@ -140,26 +164,16 @@ void make() { for(auto& h: heps) h.first = gpushxto0(center) * h.first; + counts.clear(); + for(auto& h: heps) rehash(h.first); + /* grow */ for(int a=0; a 2 && a < down) - total += 2*v - big; - else - total += big; - } - println(hlog, "total ", total); if(total == 2*v) advance(down, down, true); @@ -170,6 +184,8 @@ void make() { advance(t, 0); else break; + + rehash(heps.back().first); } }