crystal:: fiftyval set correctly -- Docks and Snake Nest work

This commit is contained in:
Zeno Rogue 2018-12-04 02:37:10 +01:00
parent 866e6f5a30
commit aa34ed80c8
1 changed files with 43 additions and 0 deletions

View File

@ -314,6 +314,47 @@ struct east_structure {
int coordid;
};
int fiftyrule(coord c) {
int res[256] = {
1,-1,32,-1,-1, 2,-1,35,32,-1, 1,-1,-1,35,-1, 2,
-1,-1,-1,-1, 4,-1,36,-1,-1,-1,-1,-1,36,-1, 4,-1,
32,-1, 1,-1,-1,34,-1, 3, 1,-1,32,-1,-1, 3,-1,34,
-1,-1,-1,-1,36,-1, 4,-1,-1,-1,-1,-1, 4,-1,36,-1,
-1, 4,-1,36,-1,-1,-1,-1,-1,36,-1, 4,-1,-1,-1,-1,
3,-1,35,-1,-1,-1,-1,-1,35,-1, 3,-1,-1,-1,-1,-1,
-1,36,-1, 4,-1,-1,-1,-1,-1, 4,-1,36,-1,-1,-1,-1,
34,-1, 2,-1,-1,-1,-1,-1, 2,-1,34,-1,-1,-1,-1,-1,
32,-1, 1,-1,-1,34,-1, 3, 1,-1,32,-1,-1, 3,-1,34,
-1,-1,-1,-1,36,-1, 4,-1,-1,-1,-1,-1, 4,-1,36,-1,
1,-1,32,-1,-1, 2,-1,35,32,-1, 1,-1,-1,35,-1, 2,
-1,-1,-1,-1, 4,-1,36,-1,-1,-1,-1,-1,36,-1, 4,-1,
-1,36,-1, 4,-1,-1,-1,-1,-1, 4,-1,36,-1,-1,-1,-1,
34,-1, 2,-1,-1,-1,-1,-1, 2,-1,34,-1,-1,-1,-1,-1,
-1, 4,-1,36,-1,-1,-1,-1,-1,36,-1, 4,-1,-1,-1,-1,
3,-1,35,-1,-1,-1,-1,-1,35,-1, 3,-1,-1,-1,-1,-1,
};
int index = 0;
for(int i=0; i<4; i++) index += (c[i] & 3) << (2 * i);
if(res[index] == -1) exit(1);
return res[index];
/*
int res = 0;
int d = (c[0]&1) + 2 * (c[1]&1) + 4 * (c[2]&1) + 8 * (c[3]&1);
if(d == 0) res = 0;
else if(d == 3 || d == 12) res = 2;
else if(d == 6 || d == 9) res = 4;
else return -1;
bool odd = (c[0]^c[1]^c[2]^c[3])&2;
if(odd)
res ^= 32;
// the '1' bit set by hand
*/
}
struct hrmap_crystal : hrmap {
heptagon *getOrigin() { return get_heptagon_at(c0, S7); }
@ -354,6 +395,8 @@ struct hrmap_crystal : hrmap {
h->cdata = NULL;
h->c7 = newCell(deg, h);
h->distance = 0;
if(ginf[gCrystal].vertex == 3)
h->fiftyval = fiftyrule(c);
for(int i=0; i<cs.dim; i++) h->distance += abs(c[i]);
h->distance /= 2;
hcoords[h] = c;