mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-24 06:50:09 +00:00
Working Chessboard pattern. Chessboard pattern used in the Warped Coast.
This commit is contained in:
parent
e9ab4bf2dd
commit
c5395097fe
@ -18,7 +18,7 @@ struct archimedean_tiling {
|
||||
vector<bool> invert;
|
||||
vector<int> nflags;
|
||||
|
||||
bool have_ph, have_line, have_symmetry, have_chessboard;
|
||||
bool have_ph, have_line, have_symmetry;
|
||||
|
||||
int repetition = 1;
|
||||
int N;
|
||||
@ -236,23 +236,6 @@ void archimedean_tiling::prepare() {
|
||||
}
|
||||
}
|
||||
|
||||
if(have_symmetry) {
|
||||
have_chessboard = true;
|
||||
for(int o=0; o<2; o++)
|
||||
for(int i=o; i<2*N; i+=2)
|
||||
for(int j=i+2; j<2*N; j+=4)
|
||||
if(tilegroup[i] == tilegroup[j])
|
||||
have_chessboard = false;
|
||||
for(int i=0; i<N; i+=2)
|
||||
for(int j=0; j<2*N; j++)
|
||||
if(tilegroup[j] == tilegroup[i])
|
||||
flags[j] |= sfCHESS;
|
||||
}
|
||||
else {
|
||||
have_chessboard = N % 2 == 0;
|
||||
for(int i=0; i<M; i+=4) flags[i] |= sfCHESS;
|
||||
}
|
||||
|
||||
SDEBUG( for(int i=0; i<M; i+=(have_symmetry?1:2)) {
|
||||
printf("tiling group of %2d: [%2d]%2d+Z%2d\n", i, tilegroup[i], groupoffset[i], periods[i]);
|
||||
printf("\n");
|
||||
@ -411,6 +394,8 @@ heptagon *build_child(heptagon *parent, int d, int id, int pindex) {
|
||||
int nei = neighbors_of(h);
|
||||
h->c7 = newCell(nei, h);
|
||||
h->distance = parent->distance + 1;
|
||||
if(id < 2*current.N)
|
||||
h->fieldval = parent->move(0)->fieldval + (d/2);
|
||||
return h;
|
||||
}
|
||||
|
||||
@ -663,7 +648,7 @@ int archimedean_tiling::support_graveyard() {
|
||||
}
|
||||
|
||||
bool archimedean_tiling::support_chessboard() {
|
||||
return 0;
|
||||
return N % 2 == 0;
|
||||
}
|
||||
|
||||
bool pseudohept(int id) {
|
||||
@ -671,7 +656,7 @@ bool pseudohept(int id) {
|
||||
}
|
||||
|
||||
bool chessvalue(cell *c) {
|
||||
return current.flags[id_of(c->master)] & arcm::sfCHESS;
|
||||
return c->master->fieldval & 1;
|
||||
}
|
||||
|
||||
bool linespattern(cell *c) {
|
||||
|
21
pattern2.cpp
21
pattern2.cpp
@ -1063,6 +1063,10 @@ namespace patterns {
|
||||
|
||||
}
|
||||
|
||||
bool geosupport_chessboard() {
|
||||
return archimedean ? arcm::current.support_chessboard() : (nonbitrunc && S3 == 4);
|
||||
}
|
||||
|
||||
int geosupport_threecolor() {
|
||||
if(irr::on) return 0;
|
||||
if(!nonbitrunc && S3 == 3) {
|
||||
@ -1222,12 +1226,8 @@ bool kraken_pseudohept(cell *c) {
|
||||
}
|
||||
|
||||
bool warptype(cell *c) {
|
||||
if(a4 && nonbitrunc) {
|
||||
if(euclid)
|
||||
return among(eupattern4(c), 1, 2);
|
||||
else
|
||||
return c->master->distance & 1;
|
||||
}
|
||||
if(geosupport_chessboard())
|
||||
return chessvalue(c);
|
||||
else if(gp::on || irr::on)
|
||||
return pseudohept(c);
|
||||
else
|
||||
@ -1366,7 +1366,7 @@ namespace patterns {
|
||||
return (0x202020 + col[0] + (col[1] << 8) + (col[2] << 16)) >> (err?2:0);
|
||||
}
|
||||
if(whichCanvas == 'c') {
|
||||
return (c->master->distance&1) ? 0xC0C0C0 : 0x202020;
|
||||
return chessvalue(c) ? 0xC0C0C0 : 0x202020;
|
||||
}
|
||||
if(whichCanvas == 'F') {
|
||||
return pseudohept(c) ? 0x202020 : 0xC0C0C0;
|
||||
@ -1393,7 +1393,7 @@ namespace patterns {
|
||||
}
|
||||
|
||||
dialog::addItem(XLAT("football"), 'F');
|
||||
if(S3 == 4 && nonbitrunc)
|
||||
if(geosupport_chessboard())
|
||||
dialog::addItem(XLAT("chessboard"), 'c');
|
||||
|
||||
dialog::addItem(XLAT("nice coloring"), 'T');
|
||||
@ -1490,7 +1490,7 @@ namespace patterns {
|
||||
if(stdhyperbolic || euclid)
|
||||
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == PAT_PALACE), PAT_PALACE);
|
||||
|
||||
if((nonbitrunc && S3 == 4) || (archimedean && arcm::current.support_chessboard()))
|
||||
if(geosupport_chessboard())
|
||||
dialog::addBoolItem(XLAT("chessboard"), (whichPattern == PAT_CHESS), PAT_CHESS);
|
||||
|
||||
if(a38 || a46 || euclid || S3 == 4 || S7 == 4)
|
||||
@ -1499,9 +1499,6 @@ namespace patterns {
|
||||
if(sphere)
|
||||
dialog::addBoolItem(XLAT("siblings"), (whichPattern == PAT_SIBLING), PAT_SIBLING);
|
||||
|
||||
if(archimedean)
|
||||
dialog::addBoolItem(XLAT("Archimedean"), (whichPattern == PAT_SIBLING), PAT_SIBLING);
|
||||
|
||||
if(euclid)
|
||||
dialog::addBoolItem(XLAT("torus pattern"), (whichPattern == PAT_FIELD), PAT_FIELD);
|
||||
else if(sphere)
|
||||
|
Loading…
x
Reference in New Issue
Block a user