mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-10-18 06:30:41 +00:00
emeraldmaps now implemented for hrmap_h3_subrule
This commit is contained in:
parent
21dfe6a27f
commit
2e2dc2aac0
126
reg3.cpp
126
reg3.cpp
@ -2034,51 +2034,12 @@ EX namespace reg3 {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hrmap_h3_rule : hrmap_h3_abstract, ruleset {
|
struct emerald_matcher {
|
||||||
|
|
||||||
heptagon *origin;
|
|
||||||
reg3::hrmap_quotient3 *emerald_map;
|
reg3::hrmap_quotient3 *emerald_map;
|
||||||
|
|
||||||
hrmap_quotient3 *qmap() override { return quotient_map; }
|
|
||||||
|
|
||||||
hrmap_h3_rule() {
|
|
||||||
|
|
||||||
println(hlog, "generating hrmap_h3_rule");
|
|
||||||
|
|
||||||
load_ruleset_new(get_rule_filename(false));
|
|
||||||
quotient_map = gen_quotient_map(minimize_quotient_maps, fp);
|
|
||||||
find_mappings();
|
|
||||||
|
|
||||||
origin = init_heptagon(S7);
|
|
||||||
heptagon& h = *origin;
|
|
||||||
h.s = hsOrigin;
|
|
||||||
h.fiftyval = root[0];
|
|
||||||
if(PURE) h.c7 = newCell(S7, origin);
|
|
||||||
|
|
||||||
emerald_map = gen_quotient_map(false, currfp);
|
|
||||||
|
|
||||||
h.emeraldval = 0;
|
|
||||||
|
|
||||||
if(!PURE) get_cell_at(origin, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int connection(int fv, int d) override {
|
|
||||||
return qmap()->allh[fv]->move(d)->fieldval;
|
|
||||||
}
|
|
||||||
|
|
||||||
heptagon *getOrigin() override {
|
|
||||||
return origin;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define DEB 0
|
|
||||||
|
|
||||||
heptagon *counterpart(heptagon *h) {
|
|
||||||
return quotient_map->allh[h->fieldval];
|
|
||||||
}
|
|
||||||
|
|
||||||
vector<short> evmemo;
|
vector<short> evmemo;
|
||||||
|
|
||||||
void find_emeraldval(heptagon *target, heptagon *parent, int d) {
|
void find_emeraldval(heptagon *target, heptagon *parent, int d, hrmap_quotient3* qmap, int parent_fieldval) {
|
||||||
generate_cellrotations();
|
generate_cellrotations();
|
||||||
auto& cr = cgi.cellrotations;
|
auto& cr = cgi.cellrotations;
|
||||||
if(evmemo.empty()) {
|
if(evmemo.empty()) {
|
||||||
@ -2100,13 +2061,13 @@ EX namespace reg3 {
|
|||||||
|
|
||||||
for(int eid=0; eid<isize(emerald_map->allh); eid++)
|
for(int eid=0; eid<isize(emerald_map->allh); eid++)
|
||||||
for(int k0=0; k0<isize(cr); k0++)
|
for(int k0=0; k0<isize(cr); k0++)
|
||||||
for(int fv=0; fv<isize(quotient_map->allh); fv++) {
|
for(int fv=0; fv<isize(qmap->allh); fv++) {
|
||||||
for(int d=0; d<S7; d++) {
|
for(int d=0; d<S7; d++) {
|
||||||
int ed = cr[k0].mapping[d];
|
int ed = cr[k0].mapping[d];
|
||||||
auto cpart = emerald_map->allh[eid];
|
auto cpart = emerald_map->allh[eid];
|
||||||
int eid1 = emerald_map->allh[eid]->move(ed)->fieldval;
|
int eid1 = emerald_map->allh[eid]->move(ed)->fieldval;
|
||||||
const transmatrix& X = cr[cr[k0].inverse_id].M;
|
const transmatrix& X = cr[cr[k0].inverse_id].M;
|
||||||
transmatrix U = quotient_map->iadj(quotient_map->allh[fv], d) * X * emerald_map->adj(cpart, ed);
|
transmatrix U = qmap->iadj(qmap->allh[fv], d) * X * emerald_map->adj(cpart, ed);
|
||||||
int k1 = matrix_hashtable[matrix_hash(U)];
|
int k1 = matrix_hashtable[matrix_hash(U)];
|
||||||
/* for(int ik1=0; ik1<isize(cr); ik1++) {
|
/* for(int ik1=0; ik1<isize(cr); ik1++) {
|
||||||
auto& mX1 = cr[ik1].M;
|
auto& mX1 = cr[ik1].M;
|
||||||
@ -2118,12 +2079,55 @@ EX namespace reg3 {
|
|||||||
println(hlog, "generated ", isize(evmemo));
|
println(hlog, "generated ", isize(evmemo));
|
||||||
}
|
}
|
||||||
int memo_id = parent->emeraldval;
|
int memo_id = parent->emeraldval;
|
||||||
memo_id = memo_id * isize(quotient_map->allh) + parent->fieldval;
|
memo_id = memo_id * isize(qmap->allh) + parent_fieldval;
|
||||||
memo_id = memo_id * S7 + d;
|
memo_id = memo_id * S7 + d;
|
||||||
target->emeraldval = evmemo[memo_id];
|
target->emeraldval = evmemo[memo_id];
|
||||||
target->zebraval = emerald_map->allh[target->emeraldval / isize(cr)]->zebraval;
|
target->zebraval = emerald_map->allh[target->emeraldval / isize(cr)]->zebraval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
struct hrmap_h3_rule : hrmap_h3_abstract, ruleset, emerald_matcher {
|
||||||
|
|
||||||
|
heptagon *origin;
|
||||||
|
|
||||||
|
hrmap_quotient3 *qmap() override { return quotient_map; }
|
||||||
|
|
||||||
|
hrmap_h3_rule() {
|
||||||
|
|
||||||
|
println(hlog, "generating hrmap_h3_rule");
|
||||||
|
|
||||||
|
load_ruleset_new(get_rule_filename(false));
|
||||||
|
quotient_map = gen_quotient_map(minimize_quotient_maps, fp);
|
||||||
|
find_mappings();
|
||||||
|
|
||||||
|
origin = init_heptagon(S7);
|
||||||
|
heptagon& h = *origin;
|
||||||
|
h.s = hsOrigin;
|
||||||
|
h.fiftyval = root[0];
|
||||||
|
if(PURE) h.c7 = newCell(S7, origin);
|
||||||
|
|
||||||
|
emerald_map = gen_quotient_map(false, currfp);
|
||||||
|
|
||||||
|
h.emeraldval = 0;
|
||||||
|
|
||||||
|
if(!PURE) get_cell_at(origin, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int connection(int fv, int d) override {
|
||||||
|
return qmap()->allh[fv]->move(d)->fieldval;
|
||||||
|
}
|
||||||
|
|
||||||
|
heptagon *getOrigin() override {
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define DEB 0
|
||||||
|
|
||||||
|
heptagon *counterpart(heptagon *h) {
|
||||||
|
return quotient_map->allh[h->fieldval];
|
||||||
|
}
|
||||||
|
|
||||||
heptagon *create_step(heptagon *parent, int d) override {
|
heptagon *create_step(heptagon *parent, int d) override {
|
||||||
int id = parent->fiftyval;
|
int id = parent->fiftyval;
|
||||||
if(id < 0) id += (1<<16);
|
if(id < 0) id += (1<<16);
|
||||||
@ -2154,7 +2158,7 @@ EX namespace reg3 {
|
|||||||
res->fieldval = fv;
|
res->fieldval = fv;
|
||||||
res->distance = parent->distance + 1;
|
res->distance = parent->distance + 1;
|
||||||
res->fiftyval = id1;
|
res->fiftyval = id1;
|
||||||
find_emeraldval(res, parent, d);
|
find_emeraldval(res, parent, d, quotient_map, parent->fieldval);
|
||||||
// res->c.connect(d2, parent, d, false);
|
// res->c.connect(d2, parent, d, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2168,7 +2172,7 @@ EX namespace reg3 {
|
|||||||
for(auto s: nonlooping_earlier_states[address{pfv, id}]) possible.push_back(s.second);
|
for(auto s: nonlooping_earlier_states[address{pfv, id}]) possible.push_back(s.second);
|
||||||
id1 = hrand_elt(possible, 0);
|
id1 = hrand_elt(possible, 0);
|
||||||
res->fiftyval = id1;
|
res->fiftyval = id1;
|
||||||
find_emeraldval(res, parent, d);
|
find_emeraldval(res, parent, d, quotient_map, parent->fieldval);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -2209,7 +2213,7 @@ EX namespace reg3 {
|
|||||||
|
|
||||||
vector<heptspin> starts = {nullptr};
|
vector<heptspin> starts = {nullptr};
|
||||||
|
|
||||||
struct hrmap_h3_subrule : hrmap, ruleset {
|
struct hrmap_h3_subrule : hrmap, ruleset, emerald_matcher {
|
||||||
|
|
||||||
heptagon *origin;
|
heptagon *origin;
|
||||||
hrmap_quotient3 *quotient_map;
|
hrmap_quotient3 *quotient_map;
|
||||||
@ -2274,12 +2278,33 @@ EX namespace reg3 {
|
|||||||
h.fieldval = 0;
|
h.fieldval = 0;
|
||||||
h.fiftyval = root[0];
|
h.fiftyval = root[0];
|
||||||
h.c7 = newCell(t, origin);
|
h.c7 = newCell(t, origin);
|
||||||
|
|
||||||
|
if(1) {
|
||||||
|
dynamicval<eVariation> dv(variation, eVariation::pure);
|
||||||
|
dynamicval<geometry_information*> dc(cgip, cgip);
|
||||||
|
check_cgi(); cgi.require_basics();
|
||||||
|
emerald_map = gen_quotient_map(false, currfp);
|
||||||
|
h.emeraldval = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
heptagon *getOrigin() override {
|
heptagon *getOrigin() override {
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void find_emeraldval_path(heptagon *res, heptagon *parent, int d, cell *cpart) {
|
||||||
|
auto& mseq = quotient_map->get_move_seq(cpart, d);
|
||||||
|
res->emeraldval = parent->emeraldval;
|
||||||
|
res->zebraval = parent->zebraval;
|
||||||
|
heptagon *h = cpart->master;
|
||||||
|
for(auto m: mseq) {
|
||||||
|
find_emeraldval(res, res, m, quotient_map, h->fieldval);
|
||||||
|
h = h->move(m);
|
||||||
|
}
|
||||||
|
|
||||||
|
hassert(h == quotient_map->acells[res->fieldval]->master);
|
||||||
|
}
|
||||||
|
|
||||||
heptagon *create_step(heptagon *parent, int d) override {
|
heptagon *create_step(heptagon *parent, int d) override {
|
||||||
heptspin parentd(parent, d);
|
heptspin parentd(parent, d);
|
||||||
if(starts[isize(starts)/2] == parentd) {
|
if(starts[isize(starts)/2] == parentd) {
|
||||||
@ -2298,8 +2323,9 @@ EX namespace reg3 {
|
|||||||
|
|
||||||
int qid = parent->fieldval;
|
int qid = parent->fieldval;
|
||||||
|
|
||||||
int d2 = quotient_map->acells[qid]->c.spin(d);
|
auto cpart = quotient_map->acells[qid];
|
||||||
int qid2 = quotient_map->local_id[quotient_map->acells[qid]->move(d)].first;
|
int d2 = cpart->c.spin(d);
|
||||||
|
int qid2 = quotient_map->local_id[cpart->move(d)].first;
|
||||||
|
|
||||||
heptagon *res = nullptr;
|
heptagon *res = nullptr;
|
||||||
|
|
||||||
@ -2314,6 +2340,7 @@ EX namespace reg3 {
|
|||||||
res->fieldval = qid2;
|
res->fieldval = qid2;
|
||||||
res->distance = parent->distance + 1;
|
res->distance = parent->distance + 1;
|
||||||
res->fiftyval = id1;
|
res->fiftyval = id1;
|
||||||
|
find_emeraldval_path(res, parent, d, cpart);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(other[pos] == ('A' + d) && other[pos+1] == ',') {
|
else if(other[pos] == ('A' + d) && other[pos+1] == ',') {
|
||||||
@ -2328,6 +2355,7 @@ EX namespace reg3 {
|
|||||||
res->fieldval = qid2;
|
res->fieldval = qid2;
|
||||||
res->distance = parent->distance - 1;
|
res->distance = parent->distance - 1;
|
||||||
res->fiftyval = id1;
|
res->fiftyval = id1;
|
||||||
|
find_emeraldval_path(res, parent, d, cpart);
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user