simple patterns for weird hyperbolic
This commit is contained in:
parent
f2af1d63f6
commit
3c600d7d6b
35
cell.cpp
35
cell.cpp
|
@ -729,10 +729,14 @@ bool ishex1(cell *c) {
|
||||||
else return c->type != S6;
|
else return c->type != S6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int val46(cell *c) {
|
||||||
|
return ctof(c) ? c->master->emeraldval :
|
||||||
|
((c->master->emeraldval & 1) ^ ((c->master->emeraldval & 2)>>1) ^ (c->spin(0)&1)) ? 8 : 4;
|
||||||
|
}
|
||||||
|
|
||||||
int emeraldval(cell *c) {
|
int emeraldval(cell *c) {
|
||||||
if(euclid) return eupattern(c);
|
if(euclid) return eupattern(c);
|
||||||
if(a46) return ctof(c) ? ((c->master->emeraldval & 2) ? 1 : 0) :
|
if(a46) return val46(c);
|
||||||
((c->master->emeraldval & 1) ^ ((c->master->emeraldval & 2)>>1) ^ (c->spin(0)&1)) ? 8 : 4;
|
|
||||||
if(sphere) return 0;
|
if(sphere) return 0;
|
||||||
if(ctof(c))
|
if(ctof(c))
|
||||||
return c->master->emeraldval >> 3;
|
return c->master->emeraldval >> 3;
|
||||||
|
@ -849,10 +853,16 @@ int eufifty(cell *c) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int val38(cell *c) {
|
||||||
|
if(ctof(c)) return c->master->fiftyval;
|
||||||
|
else return 4 ^ c->master->fiftyval ^ (c->spin(0) & 1);
|
||||||
|
}
|
||||||
|
|
||||||
int fiftyval(cell *c) {
|
int fiftyval(cell *c) {
|
||||||
|
if(a38) return val38(c);
|
||||||
if(euclid) return eufifty(c) * 32;
|
if(euclid) return eufifty(c) * 32;
|
||||||
if(sphere || S7>7 || S6>6) return 0;
|
if(sphere || S7>7 || S6>6) return 0;
|
||||||
if(c->type == 7)
|
if(ctof(c))
|
||||||
return c->master->fiftyval;
|
return c->master->fiftyval;
|
||||||
else {
|
else {
|
||||||
return bitmajority(
|
return bitmajority(
|
||||||
|
@ -953,9 +963,28 @@ int fiftyval049(cell *c) {
|
||||||
|
|
||||||
// zebraval
|
// zebraval
|
||||||
|
|
||||||
|
int dir_truncated457(cell *c) {
|
||||||
|
int wset = 0;
|
||||||
|
for(int i=0; i<4; i++)
|
||||||
|
if(zebra40(createMov(c, i*2))&2) wset |= (1<<i);
|
||||||
|
if(wset == 0) return -8;
|
||||||
|
if(wset == 15) return -10;
|
||||||
|
if(wset == 3) return 1;
|
||||||
|
if(wset == 6) return 3;
|
||||||
|
if(wset == 12) return 5;
|
||||||
|
if(wset == 9) return 7;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int zebra40(cell *c) {
|
int zebra40(cell *c) {
|
||||||
if(euclid) return eupattern(c);
|
if(euclid) return eupattern(c);
|
||||||
|
else if(a46) return val46(c);
|
||||||
else if(ctof(c)) return (c->master->zebraval/10);
|
else if(ctof(c)) return (c->master->zebraval/10);
|
||||||
|
else if(a4) {
|
||||||
|
int ws = dir_truncated457(c);
|
||||||
|
if(ws < 0) return -ws;
|
||||||
|
return 16 + (ws/2);
|
||||||
|
}
|
||||||
else if(sphere) return 0;
|
else if(sphere) return 0;
|
||||||
else if(euclid) return eupattern(c);
|
else if(euclid) return eupattern(c);
|
||||||
else if(S3 == 4 && S7 == 6) {
|
else if(S3 == 4 && S7 == 6) {
|
||||||
|
|
|
@ -79,7 +79,9 @@ heptagon *buildHeptagon(heptagon *parent, int d, hstate s, int pard = 0, int fix
|
||||||
h->emeraldval = emerald_heptagon(parent->emeraldval, d);
|
h->emeraldval = emerald_heptagon(parent->emeraldval, d);
|
||||||
h->zebraval = zebra_heptagon(parent->zebraval, d);
|
h->zebraval = zebra_heptagon(parent->zebraval, d);
|
||||||
h->fieldval = currfp.connections[fieldpattern::btspin(parent->fieldval, d)];
|
h->fieldval = currfp.connections[fieldpattern::btspin(parent->fieldval, d)];
|
||||||
if(parent->s == hsOrigin)
|
if(a38)
|
||||||
|
h->fiftyval = (parent->fiftyval ^ d ^ 1) & 1;
|
||||||
|
else if(parent->s == hsOrigin)
|
||||||
h->fiftyval = firstfiftyval(d);
|
h->fiftyval = firstfiftyval(d);
|
||||||
else
|
else
|
||||||
h->fiftyval = nextfiftyval(parent->fiftyval, parent->move[0]->fiftyval, d);
|
h->fiftyval = nextfiftyval(parent->fiftyval, parent->move[0]->fiftyval, d);
|
||||||
|
@ -206,7 +208,7 @@ heptagon *createStep(heptagon *h, int d) {
|
||||||
else if(S3 == 4) {
|
else if(S3 == 4) {
|
||||||
if(d == 1) {
|
if(d == 1) {
|
||||||
heptspin hs;
|
heptspin hs;
|
||||||
hs.h = h;
|
hs.h = h;
|
||||||
hs.spin = 0;
|
hs.spin = 0;
|
||||||
hs.mirrored = false;
|
hs.mirrored = false;
|
||||||
hs = hsstep(hs, -1);
|
hs = hsstep(hs, -1);
|
||||||
|
|
1
init.cpp
1
init.cpp
|
@ -345,6 +345,7 @@ void addMessage(string s, char spamtype = 0);
|
||||||
#define S3 ginf[geometry].vertex
|
#define S3 ginf[geometry].vertex
|
||||||
#define weirdhyperbolic (S7 > 7 || S3 > 3)
|
#define weirdhyperbolic (S7 > 7 || S3 > 3)
|
||||||
#define weirdhyperbolic (S7 > 7 || S3 > 3)
|
#define weirdhyperbolic (S7 > 7 || S3 > 3)
|
||||||
|
#define stdhyperbolic (S7 == 7 && S3 == 3)
|
||||||
|
|
||||||
#define a4 (S3 == 4)
|
#define a4 (S3 == 4)
|
||||||
#define a45 (S3 == 4 && S7 == 5)
|
#define a45 (S3 == 4 && S7 == 5)
|
||||||
|
|
121
mapeditor.cpp
121
mapeditor.cpp
|
@ -352,12 +352,41 @@ namespace mapeditor {
|
||||||
if(!c2) return 0;
|
if(!c2) return 0;
|
||||||
return neighborId(c, c2);
|
return neighborId(c, c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int patterndir46(cell *c, int bits) {
|
||||||
|
if(ctof(c)) {
|
||||||
|
int b = c->master->emeraldval & bits;
|
||||||
|
return (b&1) ^ (b & 2 ? 1 : 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return ((c->mov[0]->master->emeraldval + c->spin(0)) & 1) ? 2 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int patterndir38(cell *c) {
|
||||||
|
if(ctof(c)) return c->master->fiftyval;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int patterndir457(cell *c) {
|
||||||
|
if(!ctof(c)) {
|
||||||
|
int d = dir_truncated457(c);
|
||||||
|
if(d >= 0) return d;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for(int i=0; i<c->type; i++)
|
||||||
|
if((zebra40(createStep(c->master, i + S7/2)->c7)&2) == (zebra40(createStep(c->master, i + 1 + S7/2)->c7)&2))
|
||||||
|
return i;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int patterndir(cell *c, char w) {
|
int patterndir(cell *c, char w) {
|
||||||
switch(w) {
|
switch(w) {
|
||||||
case 'z': {
|
case 'z': {
|
||||||
int t = zebra40(c);
|
if(a46) return patterndir46(c, 3);
|
||||||
|
if(a4) return patterndir457(c);
|
||||||
|
if(a38) return patterndir38(c);
|
||||||
|
int t = zebra40(c);
|
||||||
|
|
||||||
if(euclid) return (t*4) % 6;
|
if(euclid) return (t*4) % 6;
|
||||||
|
|
||||||
int t4 = t>>2, tcdir = 0;
|
int t4 = t>>2, tcdir = 0;
|
||||||
|
@ -378,13 +407,10 @@ namespace mapeditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'f': {
|
case 'f': {
|
||||||
|
if(a46) return patterndir46(c, 1);
|
||||||
|
if(a38) return patterndir38(c);
|
||||||
|
if(a4) return patterndir457(c);
|
||||||
int t = emeraldval(c);
|
int t = emeraldval(c);
|
||||||
if(a46) {
|
|
||||||
if(ctof(c))
|
|
||||||
return (c->master->emeraldval & 1) ^ (c->master->emeraldval & 2 ? 1 : 0);
|
|
||||||
else
|
|
||||||
return ((c->mov[0]->master->emeraldval + c->spin(0)) & 1) ? 2 : 0;
|
|
||||||
}
|
|
||||||
if(euclid) return 0;
|
if(euclid) return 0;
|
||||||
int tcdir = 0, tbest = (t&3);
|
int tcdir = 0, tbest = (t&3);
|
||||||
for(int i=0; i<c->type; i++) {
|
for(int i=0; i<c->type; i++) {
|
||||||
|
@ -399,6 +425,9 @@ namespace mapeditor {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'p': {
|
case 'p': {
|
||||||
|
if(a46) return patterndir46(c, 2);
|
||||||
|
if(a4) return patterndir457(c);
|
||||||
|
if(a38) return patterndir38(c);
|
||||||
int tcdir = -1, tbest = -1;
|
int tcdir = -1, tbest = -1;
|
||||||
int pa = polara50(c);
|
int pa = polara50(c);
|
||||||
int pb = polarb50(c);
|
int pb = polarb50(c);
|
||||||
|
@ -417,12 +446,9 @@ namespace mapeditor {
|
||||||
|
|
||||||
case 0: {
|
case 0: {
|
||||||
if(euclid) return 0;
|
if(euclid) return 0;
|
||||||
if(a46) {
|
if(a46) return patterndir46(c, 1);
|
||||||
if(ctof(c))
|
if(a4) return patterndir457(c);
|
||||||
return c->master->emeraldval;
|
if(a38) return patterndir38(c);
|
||||||
else
|
|
||||||
return ((c->mov[0]->master->emeraldval + c->spin(0)) & 1) ? 2 : 0;
|
|
||||||
}
|
|
||||||
int u = nopattern(c);
|
int u = nopattern(c);
|
||||||
|
|
||||||
if(u == 6) {
|
if(u == 6) {
|
||||||
|
@ -764,25 +790,43 @@ namespace mapeditor {
|
||||||
}
|
}
|
||||||
dialog::init();
|
dialog::init();
|
||||||
|
|
||||||
if(a46)
|
if(a46) {
|
||||||
dialog::addBoolItem("two colors", (whichPattern == 'f'), 'f');
|
dialog::addBoolItem(XLAT("two colors"), (whichPattern == 'f'), 'f');
|
||||||
else
|
dialog::addBoolItem(XLAT("two colors rotated"), (whichPattern == 'z'), 'z');
|
||||||
dialog::addBoolItem(XLAT(euclid ? "three colors" : "Emerald Pattern"), (whichPattern == 'f'), 'f');
|
}
|
||||||
if(!a4)
|
else if(a4) {
|
||||||
|
dialog::addBoolItem(XLAT("Zebra Pattern"), (whichPattern == 'z'), 'z');
|
||||||
|
}
|
||||||
|
else if(a38) {
|
||||||
|
dialog::addBoolItem(XLAT("Zebra Pattern"), (whichPattern == 'z'), 'z');
|
||||||
|
dialog::addBoolItem(XLAT("broken Emerald Pattern"), (whichPattern == 'f'), 'f');
|
||||||
|
dialog::addBoolItem(XLAT("rotated pattern"), (whichPattern == 'p'), 'p');
|
||||||
|
}
|
||||||
|
else if(euclid) {
|
||||||
|
dialog::addBoolItem(XLAT("three colors"), (whichPattern == 'f'), 'f');
|
||||||
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == 'p'), 'p');
|
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == 'p'), 'p');
|
||||||
if(!a4)
|
dialog::addBoolItem(XLAT("three colors rotated"), (whichPattern == 'z'), 'z');
|
||||||
dialog::addBoolItem(XLAT(euclid ? "three colors rotated" : "Zebra Pattern"), (whichPattern == 'z'), 'z');
|
}
|
||||||
dialog::addBoolItem(XLAT("field pattern"), (whichPattern == 'F'), 'F');
|
else {
|
||||||
|
if(!stdhyperbolic)
|
||||||
|
dialog::addInfo("patterns do not work correctly in this geometry!");
|
||||||
|
|
||||||
if(whichPattern == 'f') symRotation = true;
|
dialog::addBoolItem(XLAT("Emerald Pattern"), (whichPattern == 'f'), 'f');
|
||||||
|
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == 'p'), 'p');
|
||||||
|
dialog::addBoolItem(XLAT("Zebra Pattern"), (whichPattern == 'z'), 'z');
|
||||||
|
}
|
||||||
|
if(euclid)
|
||||||
|
dialog::addBoolItem(XLAT("torus pattern"), (whichPattern == 'F'), 'F');
|
||||||
|
else if(!sphere)
|
||||||
|
dialog::addBoolItem(XLAT("field pattern"), (whichPattern == 'F'), 'F');
|
||||||
|
|
||||||
|
if(whichPattern == 'f' && stdhyperbolic) symRotation = true;
|
||||||
if(whichPattern == 'F') ;
|
if(whichPattern == 'F') ;
|
||||||
else if(!euclid) {
|
else if(!euclid) {
|
||||||
dialog::addBoolItem(XLAT("rotational symmetry"), (symRotation), '0');
|
dialog::addBoolItem(XLAT("rotational symmetry"), (symRotation), '0');
|
||||||
dialog::addBoolItem(XLAT("symmetry 0-1"), (sym01), '1');
|
dialog::addBoolItem(XLAT("symmetry 0-1"), (sym01), '1');
|
||||||
if(!a46 || !nontruncated)
|
dialog::addBoolItem(XLAT("symmetry 0-2"), (sym02), '2');
|
||||||
dialog::addBoolItem(XLAT("symmetry 0-2"), (sym02), '2');
|
dialog::addBoolItem(XLAT("symmetry 0-3"), (sym03), '3');
|
||||||
if(!a46)
|
|
||||||
dialog::addBoolItem(XLAT("symmetry 0-3"), (sym03), '3');
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dialog::addBoolItem(XLAT("edit all three colors"), (symRotation), '0');
|
dialog::addBoolItem(XLAT("edit all three colors"), (symRotation), '0');
|
||||||
|
@ -936,12 +980,17 @@ namespace mapeditor {
|
||||||
if(euclid) return (symRotation && (i<3)) ? 0 : i;
|
if(euclid) return (symRotation && (i<3)) ? 0 : i;
|
||||||
i = subpatternEmerald(i);
|
i = subpatternEmerald(i);
|
||||||
if(symRotation) {
|
if(symRotation) {
|
||||||
if(i >= 8 && i < 12) i -= 4;
|
if(a4 && !a46) {
|
||||||
if(i >= 12 && i < 16) i -= 8;
|
if(i >= 4 && i < 7) i -= 4;
|
||||||
if(i >= 20 && i < 24) i -= 4;
|
}
|
||||||
if(i >= 24 && i < 28) i -= 8;
|
else {
|
||||||
if(i >= 32 && i < 36) i -= 4;
|
if(i >= 8 && i < 12) i -= 4;
|
||||||
if(i >= 36 && i < 40) i -= 8;
|
if(i >= 12 && i < 16) i -= 8;
|
||||||
|
if(i >= 20 && i < 24) i -= 4;
|
||||||
|
if(i >= 24 && i < 28) i -= 8;
|
||||||
|
if(i >= 32 && i < 36) i -= 4;
|
||||||
|
if(i >= 36 && i < 40) i -= 8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -960,6 +1009,8 @@ namespace mapeditor {
|
||||||
case 'f':
|
case 'f':
|
||||||
return subpatternEmerald(emeraldval(c)); // 44 to 99
|
return subpatternEmerald(emeraldval(c)); // 44 to 99
|
||||||
case 'p': {
|
case 'p': {
|
||||||
|
if(a46) return subpatternEmerald(val46(c));
|
||||||
|
if(a38) return val38(c);
|
||||||
int i = fiftyval049(c);
|
int i = fiftyval049(c);
|
||||||
i *= 4;
|
i *= 4;
|
||||||
if(polara50(c)) i|=1;
|
if(polara50(c)) i|=1;
|
||||||
|
@ -978,11 +1029,13 @@ namespace mapeditor {
|
||||||
|
|
||||||
int realpattern(cell *c) {
|
int realpattern(cell *c) {
|
||||||
switch(whichPattern) {
|
switch(whichPattern) {
|
||||||
case 'z':
|
case 'z':
|
||||||
return zebra40(c); // 4 to 43
|
return zebra40(c); // 4 to 43
|
||||||
case 'f':
|
case 'f':
|
||||||
return emeraldval(c); // 44 to 99
|
return emeraldval(c); // 44 to 99
|
||||||
case 'p': {
|
case 'p': {
|
||||||
|
if(a46) return val46(c);
|
||||||
|
if(a38) return val38(c);
|
||||||
int i = fiftyval049(c);
|
int i = fiftyval049(c);
|
||||||
i *= 4;
|
i *= 4;
|
||||||
if(polara50(c)) i|=1;
|
if(polara50(c)) i|=1;
|
||||||
|
|
Loading…
Reference in New Issue