2019-08-10 11:43:24 +00:00
|
|
|
// Hyperbolic Rogue -- patterns
|
|
|
|
// Copyright (C) 2011-2019 Zeno Rogue, see 'hyper.cpp' for details
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-08-10 11:43:24 +00:00
|
|
|
/** \file pattern2.cpp
|
|
|
|
* \brief various functions computing the standings of individual cells with respect to various patterns
|
|
|
|
*
|
|
|
|
* Patterns include simple ones (hexagon or heptagon, three-colorings, Chessboard)
|
|
|
|
* as well as more complex ones (Emerald, Palace, Field Pattern)
|
|
|
|
*/
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-09-05 07:15:40 +00:00
|
|
|
#include "hyper.h"
|
2018-06-10 23:58:31 +00:00
|
|
|
namespace hr {
|
|
|
|
|
2019-12-23 21:21:04 +00:00
|
|
|
#if HDR
|
|
|
|
enum cpatterntype {
|
|
|
|
cpFootball, cpThree, cpChess, cpSingle, cpSingleSym, cpOddEven, cpLarge, cpZebra, cpUnknown
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2021-04-23 18:09:23 +00:00
|
|
|
EX void enable_canvas() {
|
|
|
|
firstland = specialland = laCanvas;
|
|
|
|
randomPatternsMode = false;
|
|
|
|
land_structure = lsSingle;
|
|
|
|
}
|
|
|
|
|
2019-08-09 22:11:11 +00:00
|
|
|
EX int ctof(cell *c) {
|
|
|
|
#if CAP_IRR
|
|
|
|
if(IRREGULAR) return irr::ctof(c);
|
|
|
|
#endif
|
|
|
|
if(PURE) return 1;
|
2022-12-08 18:38:06 +00:00
|
|
|
// if(meuclid) return 0;
|
2019-08-09 22:11:11 +00:00
|
|
|
if(!c) return 1;
|
2019-12-14 11:05:01 +00:00
|
|
|
if(bt::in()) return c->type == 7;
|
2019-08-09 22:11:11 +00:00
|
|
|
return ishept(c) ? 1 : 0;
|
|
|
|
// c->type == 6 ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
EX int ctof012(cell *c) {
|
|
|
|
return ishept(c)?1:ishex1(c)?0:2;
|
|
|
|
}
|
|
|
|
|
2018-04-09 18:39:52 +00:00
|
|
|
int gp_threecolor() {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(!GOLDBERG) return 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-07-10 16:29:31 +00:00
|
|
|
if(S3 == 3 && (gp::param.first - gp::param.second) % 3 == 0) return 2;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-04-09 18:39:52 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-12-05 15:19:22 +00:00
|
|
|
int eupattern(cell *c) {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2019-11-30 17:47:43 +00:00
|
|
|
auto co = euc2_coordinates(c);
|
|
|
|
int x = co.first, y = co.second;
|
2019-11-27 00:01:20 +00:00
|
|
|
if(a4)
|
2017-12-18 20:33:11 +00:00
|
|
|
return ((x&1) + 2*(y&1)) % 3;
|
2019-11-27 00:01:20 +00:00
|
|
|
else
|
|
|
|
return gmod(y-x, 3);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 18:04:37 +00:00
|
|
|
int eupattern4(cell *c) {
|
2019-11-30 17:47:43 +00:00
|
|
|
auto co = euc2_coordinates(c);
|
|
|
|
int x = co.first, y = co.second;
|
2017-12-18 18:04:37 +00:00
|
|
|
return (x&1) + ((y&1)) * 2;
|
|
|
|
}
|
|
|
|
|
2019-08-09 22:28:28 +00:00
|
|
|
EX bool ishept(cell *c) {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
// EUCLIDEAN
|
2020-05-15 09:46:26 +00:00
|
|
|
if(euc::in() && PURE) return eupattern(c) == 0;
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(mhybrid) { cell *c1 = hybrid::get_where(c).first; return c1 == c1->master->c7; }
|
2019-11-27 00:01:20 +00:00
|
|
|
else return c == c->master->c7;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 22:28:28 +00:00
|
|
|
EX bool ishex1(cell *c) {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
// EUCLIDEAN
|
2020-05-15 09:46:26 +00:00
|
|
|
if(euc::in() && PURE) return eupattern(c) == 1;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(GOLDBERG) return c->master->c7 != c && !pseudohept(c->move(0));
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-11-27 00:01:20 +00:00
|
|
|
else return c->master->c7 != c;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2018-04-04 16:00:40 +00:00
|
|
|
bool ishex2(cell *c) {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2018-04-04 16:00:40 +00:00
|
|
|
// EUCLIDEAN
|
2020-05-15 09:46:26 +00:00
|
|
|
if(euc::in() && PURE) return eupattern(c) == 1;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(GOLDBERG) return c->master->c7 != c && gp::pseudohept_val(c) == 1;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-11-27 00:01:20 +00:00
|
|
|
else return c->master->c7 != c;
|
2018-04-04 16:00:40 +00:00
|
|
|
}
|
|
|
|
|
2020-04-12 18:34:45 +00:00
|
|
|
EX int chessvalue(cell *c) {
|
2021-02-18 14:53:21 +00:00
|
|
|
if(cgflags & qPORTALSPACE) return 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in())
|
2018-08-19 21:06:32 +00:00
|
|
|
return arcm::chessvalue(c);
|
2018-08-19 16:06:54 +00:00
|
|
|
else
|
2020-07-12 18:52:32 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_GP
|
|
|
|
if(WARPED)
|
|
|
|
return gp::untruncated_shift(c) == 2;
|
2020-09-16 16:48:32 +00:00
|
|
|
else if(UNRECTIFIED && a4) {
|
|
|
|
auto li = gp::get_local_info(c);
|
|
|
|
bool odd_a = gp::param.first & 1;
|
|
|
|
bool odd_b = gp::param.second & 1;
|
|
|
|
// odd-odd
|
|
|
|
if(odd_a && odd_b)
|
|
|
|
return (li.relative.second & 1) ^ (li.last_dir & 1) ^ (c->master->dm4 & 1) ^ ((c->master->emeraldval & 1) ? 1 : 0);
|
|
|
|
else if(odd_a || odd_b) {
|
|
|
|
/* int swapped = 0;
|
|
|
|
cellwalker cw(c, 0);
|
|
|
|
while((li.relative.first ^ li.relative.second) & 1) {
|
|
|
|
cw += wstep; cw += 2; swapped ^= 1;
|
|
|
|
} */
|
|
|
|
if((li.relative.first ^ li.relative.second) & 1)
|
|
|
|
return (li.relative.first & 1) ^ ((c->master->cmove(0)->emeraldval & 4) ? 1 : 0);
|
|
|
|
else
|
|
|
|
return (li.relative.first & 1) ^ ((c->master->emeraldval & 4) ? 1 : 0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return (li.relative.second & 1) ^ (li.last_dir & 1) ^ ((c->master->emeraldval & 1) ? 1 : 0);
|
|
|
|
}
|
2020-07-12 18:52:32 +00:00
|
|
|
else
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-19 16:06:54 +00:00
|
|
|
return celldist(c) & 1;
|
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX int emeraldval(heptagon *h) { return h->emeraldval >> 3; }
|
2018-07-16 18:05:23 +00:00
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX int emeraldval(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return eupattern(c);
|
|
|
|
if(msphere) return 0;
|
2018-04-12 18:53:50 +00:00
|
|
|
if(ctof(c))
|
2018-07-16 18:05:23 +00:00
|
|
|
return emeraldval(c->master);
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
2017-12-05 15:19:22 +00:00
|
|
|
return emerald_hexagon(
|
2018-04-12 18:53:50 +00:00
|
|
|
emeraldval(ar[0]),
|
|
|
|
emeraldval(ar[1]),
|
|
|
|
emeraldval(ar[2])
|
2017-12-05 15:19:22 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// === FIFTYVALS ===
|
|
|
|
|
|
|
|
unsigned bitmajority(unsigned a, unsigned b, unsigned c) {
|
|
|
|
return (a&b) | ((a^b)&c);
|
|
|
|
}
|
|
|
|
|
|
|
|
int eufifty(cell *c) {
|
2019-11-30 17:47:43 +00:00
|
|
|
auto co = euc2_coordinates(c);
|
|
|
|
int x = co.first, y = co.second;
|
2017-12-28 15:46:10 +00:00
|
|
|
int ix = x + 99999 + y;
|
|
|
|
int iy = y + 99999;
|
2017-12-05 15:19:22 +00:00
|
|
|
if(c->land == laWildWest)
|
|
|
|
return (ix + iy * 26 + 28) % 37;
|
|
|
|
else {
|
|
|
|
ix += (iy/3) * 3;
|
|
|
|
iy %= 3; ix %= 9;
|
|
|
|
return iy * 9 + ix;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int fiftyval(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return eufifty(c) * 32;
|
|
|
|
if(msphere || S7>7 || S6>6) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
if(ctof(c))
|
|
|
|
return c->master->fiftyval;
|
|
|
|
else {
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
2017-12-05 15:19:22 +00:00
|
|
|
return bitmajority(
|
2018-07-16 18:05:23 +00:00
|
|
|
ar[0]->fiftyval,
|
|
|
|
ar[1]->fiftyval,
|
|
|
|
ar[2]->fiftyval) + 512;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX int cdist50(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid && S3 == 4) {
|
2021-04-11 20:15:40 +00:00
|
|
|
auto co = euc2_coordinates(c);
|
|
|
|
int x = co.first, y = co.second;
|
|
|
|
return abs(szgmod(x, 5)) + abs(zgmod(y, 5));
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere || S7>7 || S6>6) return 0;
|
|
|
|
if(meuclid) {
|
2017-12-05 15:19:22 +00:00
|
|
|
if(c->land == laWildWest)
|
|
|
|
return "0123333332112332223322233211233333322"[eufifty(c)] - '0';
|
|
|
|
else return "012333321112322232222321123"[eufifty(c)] - '0';
|
|
|
|
}
|
2018-07-16 18:05:23 +00:00
|
|
|
if(ctof(c)) return cdist50(c->master->fiftyval);
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
2018-07-16 18:05:23 +00:00
|
|
|
int a0 = cdist50(ar[0]->fiftyval);
|
|
|
|
int a1 = cdist50(ar[1]->fiftyval);
|
|
|
|
int a2 = cdist50(ar[2]->fiftyval);
|
2017-12-05 15:19:22 +00:00
|
|
|
if(a0 == 0 || a1 == 0 || a2 == 0) return 1;
|
|
|
|
return a0+a1+a2-5;
|
|
|
|
}
|
|
|
|
|
|
|
|
int land50(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere || meuclid) return 0;
|
2018-07-16 18:05:23 +00:00
|
|
|
else if(ctof(c)) return land50(fiftyval(c));
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
|
|
|
for(int i=0; i<3; i++)
|
2018-07-16 18:05:23 +00:00
|
|
|
if(cdist50(ar[i]->fiftyval) < 3) return land50(ar[i]->fiftyval);
|
2017-12-05 15:19:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool polara50(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere || meuclid || S7>7 || S6>6) return false;
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(NONSTDVAR) return polara50(fiftyval(c->master->c7));
|
2018-07-16 18:05:23 +00:00
|
|
|
else if(ctof(c)) return polara50(fiftyval(c));
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
|
|
|
for(int i=0; i<3; i++)
|
2018-07-16 18:05:23 +00:00
|
|
|
if(cdist50(ar[i]->fiftyval) < 3) return polara50(ar[i]->fiftyval);
|
2018-09-05 13:37:07 +00:00
|
|
|
return false;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool polarb50(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return true;
|
|
|
|
if(msphere || meuclid || S7>7 || S6>6) return true;
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(NONSTDVAR) return polarb50(fiftyval(c->master->c7));
|
2018-07-16 18:05:23 +00:00
|
|
|
else if(ctof(c)) return polarb50(fiftyval(c));
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
|
|
|
for(int i=0; i<3; i++)
|
2018-07-16 18:05:23 +00:00
|
|
|
if(cdist50(ar[i]->fiftyval) < 3) return polarb50(ar[i]->fiftyval);
|
2018-09-05 13:37:07 +00:00
|
|
|
return false;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int elhextable[28][3] = {
|
|
|
|
{0,1,2}, {1,2,9}, {1,9,-1}, {1,8,-1}, {1,-1,-1}
|
|
|
|
};
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int fiftyval049(heptagon *h) {
|
2018-07-16 18:05:23 +00:00
|
|
|
int i = h->fiftyval / 32;
|
|
|
|
if(i <= 7) return i;
|
|
|
|
if(quotient) return 0;
|
|
|
|
vector<int> allcodes;
|
|
|
|
for(int k=0; k<7; k++) {
|
|
|
|
heptagon *h2 = createStep(h, k);
|
|
|
|
if(polara50(h2->fiftyval) == polara50(h->fiftyval) && polarb50(h2->fiftyval) == polarb50(h->fiftyval))
|
|
|
|
allcodes.push_back(fiftyval049(h2));
|
|
|
|
}
|
|
|
|
int d = allcodes[1] - allcodes[0];
|
|
|
|
if(d == -1 || d == 6) swap(allcodes[0], allcodes[1]);
|
|
|
|
// printf("%d,%d: %d\n", allcodes[0], allcodes[1], allcodes[0] + 7);
|
|
|
|
return allcodes[0] + 7;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int fiftyval049(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return fiftyval(c) / 32;
|
2018-07-16 18:05:23 +00:00
|
|
|
else if(ctof(c)) return fiftyval049(c->master);
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(msphere) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
|
|
|
int a[3], qa=0;
|
2018-09-05 13:37:07 +00:00
|
|
|
bool pa = polara50(c);
|
|
|
|
bool pb = polarb50(c);
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
|
|
|
for(int i=0; i<3; i++)
|
2018-07-16 18:05:23 +00:00
|
|
|
if(polara50(ar[i]->fiftyval) == pa && polarb50(ar[i]->fiftyval) == pb)
|
2018-04-12 18:53:50 +00:00
|
|
|
a[qa++] = fiftyval049(ar[i]);
|
2022-05-28 16:58:37 +00:00
|
|
|
// somehow sort(a, a+qa) produces a warning in gcc 12.1.0, so we sort manually
|
2017-12-05 15:19:22 +00:00
|
|
|
if(qa == 1) return 43+a[0]-1;
|
2022-05-28 16:58:37 +00:00
|
|
|
// sort the two elements
|
|
|
|
if(a[0] > a[1]) swap(a[0], a[1]);
|
2017-12-05 15:19:22 +00:00
|
|
|
if(qa == 2 && a[1] == a[0]+7) return 36+a[0]-1;
|
|
|
|
if(qa == 2 && a[1] != a[0]+7) return 29+a[0]-1;
|
2022-05-28 16:58:37 +00:00
|
|
|
// sort the three elements
|
|
|
|
if(a[1] > a[2]) swap(a[1], a[2]);
|
|
|
|
if(a[0] > a[1]) swap(a[0], a[1]);
|
2017-12-09 19:02:56 +00:00
|
|
|
// 168:
|
|
|
|
if(a[1] == 1 && a[2] == 7)
|
|
|
|
return 15 + 6; // (polarb50(c) ? 0 : 6);
|
|
|
|
if(a[2] >= 1 && a[2] <= 7) {
|
|
|
|
return 15 + a[1] - 1; // (polarb50(c) ? a[1]%7 : a[1]-1);
|
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
if(a[0] == 1 && a[1] == 7 && a[2] == 8)
|
|
|
|
return 22;
|
2017-12-09 19:02:56 +00:00
|
|
|
if(a[0] == 1 && a[1] == 7 && a[2] == 14)
|
|
|
|
return 22;
|
2017-12-05 15:19:22 +00:00
|
|
|
if(a[1] <= 7 && a[2] >= 8)
|
|
|
|
return 22 + a[1]-1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int fiftyval200(cell *c) {
|
2017-12-09 19:02:56 +00:00
|
|
|
int i = fiftyval049(c);
|
|
|
|
i *= 4;
|
|
|
|
if(polara50(c)) i|=1;
|
|
|
|
if(polarb50(c)) i|=2;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2017-12-05 15:19:22 +00:00
|
|
|
/*
|
|
|
|
{0,1,2} 15+0..15+6
|
|
|
|
{1,2,9},22+0..22+6
|
|
|
|
{1,9} 29+0..29+6
|
|
|
|
{1,8} 36+0..36+6
|
|
|
|
{1} 43+0..43+6
|
|
|
|
*/
|
|
|
|
|
|
|
|
// zebraval
|
|
|
|
|
2018-01-06 21:34:03 +00:00
|
|
|
int dir_bitrunc457(cell *c) {
|
2020-07-12 18:52:32 +00:00
|
|
|
if(GOLDBERG_INV) return c->master->zebraval / 10;
|
2017-12-05 15:19:22 +00:00
|
|
|
int wset = 0;
|
2017-12-09 07:06:41 +00:00
|
|
|
int has1 = 0;
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
int z = zebra40(createMov(c, i*2));
|
|
|
|
if(z&1) has1 = 1;
|
|
|
|
if(z&2) wset |= (1<<i);
|
|
|
|
}
|
|
|
|
if(wset == 0) return -8-has1;
|
|
|
|
if(wset == 15) return -10-has1;
|
2017-12-05 15:19:22 +00:00
|
|
|
if(wset == 3) return 1;
|
|
|
|
if(wset == 6) return 3;
|
|
|
|
if(wset == 12) return 5;
|
|
|
|
if(wset == 9) return 7;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
int val46(cell *c);
|
|
|
|
|
2019-08-09 19:00:52 +00:00
|
|
|
EX int zebra40(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return pattern_threecolor(c);
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(IRREGULAR) return c->master->zebraval/10;
|
2020-07-12 18:52:32 +00:00
|
|
|
else if(INVERSE) {
|
|
|
|
cell *c1 = gp::get_mapped(c);
|
|
|
|
return UIU(zebra40(c1));
|
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(a46) {
|
|
|
|
int v = val46(c);
|
|
|
|
if(v<4) return v;
|
|
|
|
else return 4+(v-4)/2;
|
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
else if(ctof(c)) return (c->master->zebraval/10);
|
|
|
|
else if(a4) {
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG) return zebra40(c->master->c7);
|
2018-01-06 21:34:03 +00:00
|
|
|
int ws = dir_bitrunc457(c);
|
2017-12-05 15:19:22 +00:00
|
|
|
if(ws < 0) return -ws;
|
2017-12-09 07:06:41 +00:00
|
|
|
int tot = 0;
|
|
|
|
array<int, 4> zebras;
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
zebras[i] = zebra40(createMov(c, i*2));
|
|
|
|
tot += zebras[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// break cycles
|
|
|
|
int cod = 0;
|
|
|
|
int mo = 0; for(int i=0; i<4; i++) if(zebras[i] < zebras[mo]) mo = i;
|
|
|
|
for(int i=0; i<4; i++) for(int j=1; j<i; j++)
|
|
|
|
if(zebras[(mo+i)&3] < zebras[(mo+j)&3]) cod ^= 4;
|
|
|
|
|
|
|
|
if(tot == 0+2+4+6) return 16+cod;
|
|
|
|
if(tot == 1+3+5+7) return 19+cod;
|
|
|
|
if(tot == 0+1+2+3) return 18+cod;
|
|
|
|
if(tot == 4+5+6+7) return 17+cod;
|
|
|
|
return 24;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(msphere) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
else if(S3 == 4 && S7 == 6) {
|
2018-08-17 22:46:45 +00:00
|
|
|
return 8 + ((c->master->zebraval / 10 + c->c.spin(0))%2) * 2;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2021-07-08 22:13:25 +00:00
|
|
|
else if(reg3::in()) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
|
|
|
int ii[3], z;
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
2018-07-16 18:05:23 +00:00
|
|
|
ii[0] = (ar[0]->zebraval/10);
|
|
|
|
ii[1] = (ar[1]->zebraval/10);
|
|
|
|
ii[2] = (ar[2]->zebraval/10);
|
2017-12-05 15:19:22 +00:00
|
|
|
for(int r=0; r<2; r++)
|
|
|
|
if(ii[1] < ii[0] || ii[2] < ii[0])
|
|
|
|
z = ii[0], ii[0] = ii[1], ii[1] = ii[2], ii[2] = z;
|
|
|
|
for(int i=0; i<28; i++)
|
|
|
|
if(zebratable6[i][0] == ii[0] && zebratable6[i][1] == ii[1] &&
|
|
|
|
zebratable6[i][2] == ii[2]) {
|
|
|
|
int ans = 16+i;
|
|
|
|
// if(ans >= 40) ans ^= 2;
|
|
|
|
// if(ans >= 4 && ans < 16) ans ^= 2;
|
|
|
|
return ans;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int zebra3(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) return 0;
|
2019-11-15 12:38:26 +00:00
|
|
|
else if(ctof(c)) return (c->master->zebraval/10)/4;
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(meuclid || msphere || S7>7 || S6>6) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
|
|
|
int ii[3];
|
2018-04-12 18:53:50 +00:00
|
|
|
auto ar = gp::get_masters(c);
|
2018-07-16 18:05:23 +00:00
|
|
|
ii[0] = (ar[0]->zebraval/10)/4;
|
|
|
|
ii[1] = (ar[1]->zebraval/10)/4;
|
|
|
|
ii[2] = (ar[2]->zebraval/10)/4;
|
2017-12-05 15:19:22 +00:00
|
|
|
if(ii[0] == ii[1]) return ii[0];
|
|
|
|
if(ii[1] == ii[2]) return ii[1];
|
|
|
|
if(ii[2] == ii[0]) return ii[2];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2019-08-10 08:57:14 +00:00
|
|
|
EX namespace fieldpattern {
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX pair<int, bool> fieldval(cell *c) {
|
2020-03-21 09:14:54 +00:00
|
|
|
if(WDIM == 3) return make_pair(currfp.inverses[int(c->master->fieldval) * currfp.local_group], false);
|
2020-01-15 18:18:17 +00:00
|
|
|
else if(ctof(c)) return make_pair(int(c->master->fieldval), false);
|
2018-08-17 22:46:45 +00:00
|
|
|
else return make_pair(btspin(c->master->fieldval, c->c.spin(0)), true);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX int fieldval_uniq(cell *c) {
|
2020-05-15 09:46:26 +00:00
|
|
|
if(fake::in()) return FPIU(fieldval_uniq(c));
|
2019-08-10 17:34:12 +00:00
|
|
|
if(experimental) return 0;
|
2021-07-07 16:26:03 +00:00
|
|
|
if(reg3::in() && !PURE) return 0;
|
2020-08-02 11:01:55 +00:00
|
|
|
else if(arb::in()) return arb::id_of(c->master);
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(mhybrid) {
|
2019-08-24 12:07:46 +00:00
|
|
|
auto c1 = hybrid::get_where(c).first;
|
2019-11-28 22:09:04 +00:00
|
|
|
return PIU ( fieldval_uniq(c1) );
|
2019-08-18 19:39:15 +00:00
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(msphere) {
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) return c->master->fiftyval;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(IRREGULAR) return irr::cellindex[c];
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_GP
|
2023-02-05 20:59:35 +00:00
|
|
|
else if(GOLDBERG_INV) return (get_code(gp::get_local_info(c)) << 8) | (sphere ? c->master->fieldval : c->master->fieldval / S7);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-20 14:28:47 +00:00
|
|
|
if(ctof(c)) return c->master->fieldval;
|
2017-12-05 15:19:22 +00:00
|
|
|
else return createMov(c, 0)->master->fieldval + 256 * createMov(c,2)->master->fieldval + (1<<16) * createMov(c,4)->master->fieldval;
|
|
|
|
}
|
2020-06-15 23:17:28 +00:00
|
|
|
else if(euc::in(2)) {
|
2019-11-27 00:01:20 +00:00
|
|
|
auto p = euc2_coordinates(c);
|
2022-05-21 11:08:42 +00:00
|
|
|
if(closed_manifold) return p.first + p.second * (1 << 16);
|
2019-11-27 00:01:20 +00:00
|
|
|
return gmod(p.first - 22 * p.second, 3*127);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2020-06-15 23:17:28 +00:00
|
|
|
else if(euc::in(3)) {
|
|
|
|
auto co = euc::get_ispacemap()[c->master];
|
2022-05-21 11:08:42 +00:00
|
|
|
if(closed_manifold) return co[0] + (co[1] << 10) + (co[2] << 20);
|
2020-06-15 23:17:28 +00:00
|
|
|
return gmod(co[0] + 3 * co[1] + 9 * co[2], 3*127);
|
|
|
|
}
|
2019-12-14 11:05:01 +00:00
|
|
|
else if(bt::in() || arcm::in() || nil || S3 >= OINF || (cgflags & qIDEAL)) return 0;
|
2018-11-30 13:39:23 +00:00
|
|
|
else if(&currfp == &fp_invalid) return 0;
|
2020-01-02 15:50:01 +00:00
|
|
|
else if(geometry == gSpace535) return 0;
|
2019-05-08 16:33:08 +00:00
|
|
|
else if(WDIM == 3) return c->master->fieldval;
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(ctof(c) || NONSTDVAR) return c->master->fieldval/S7;
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
|
|
|
int z = 0;
|
|
|
|
for(int u=0; u<S6; u+=2)
|
2018-08-17 22:46:45 +00:00
|
|
|
z = max(z, btspin(createMov(c, u)->master->fieldval, c->c.spin(u)));
|
2017-12-05 15:19:22 +00:00
|
|
|
return -1-z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX int fieldval_uniq_rand(cell *c, int randval) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(mhybrid) {
|
2019-08-24 12:07:46 +00:00
|
|
|
auto c1 = hybrid::get_where(c).first;
|
2019-11-28 22:09:04 +00:00
|
|
|
return PIU ( fieldval_uniq_rand(c1, randval) );
|
2019-08-20 11:15:18 +00:00
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere || meuclid || NONSTDVAR)
|
2017-12-05 15:19:22 +00:00
|
|
|
// we do not care in these cases
|
|
|
|
return fieldval_uniq(c);
|
|
|
|
if(ctof(c)) return currfp.gmul(c->master->fieldval, randval)/7;
|
|
|
|
else {
|
|
|
|
int z = 0;
|
|
|
|
for(int u=0; u<6; u+=2)
|
2018-08-17 22:46:45 +00:00
|
|
|
z = max(z, btspin(currfp.gmul(createMov(c, u)->master->fieldval, randval), c->c.spin(u)));
|
2017-12-05 15:19:22 +00:00
|
|
|
return -1-z;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pair<int, int> subval(cell *c, int _subpathid = subpathid, int _subpathorder = subpathorder) {
|
2021-03-11 09:00:41 +00:00
|
|
|
|
|
|
|
if(_subpathid == -1)
|
|
|
|
_subpathid = currfp.matcode[currfp.strtomatrix("RRRPRRRRRPRRRP")];
|
|
|
|
if(_subpathorder == -1)
|
|
|
|
_subpathorder = currfp.order(currfp.matrices[subpathid]);
|
|
|
|
|
2017-12-05 15:19:22 +00:00
|
|
|
if(!ctof(c)) {
|
|
|
|
auto m = subval(createMov(c, 0));
|
|
|
|
for(int u=2; u<S6; u+=2)
|
|
|
|
m = min(m, subval(createMov(c, u)));
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pair<int, int> pbest, pcur;
|
|
|
|
pcur.first = c->master->fieldval;
|
|
|
|
pcur.second = 0;
|
|
|
|
pbest = pcur;
|
|
|
|
for(int i=0; i<_subpathorder; i++) {
|
|
|
|
pcur.first = currfp.gmul(pcur.first, _subpathid);
|
|
|
|
pcur.second++;
|
|
|
|
if(pcur < pbest) pbest = pcur;
|
|
|
|
}
|
|
|
|
return pbest;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX }
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX int getHemisphere(heptagon *h, int which) {
|
2018-07-17 00:39:12 +00:00
|
|
|
int id = h->fiftyval;
|
|
|
|
if(S7 == 5) {
|
|
|
|
int hemitable[3][12] = {
|
|
|
|
{ 6, 3, 3, 3, 3, 3,-6,-3,-3,-3,-3,-3},
|
|
|
|
{ 6, 3, 6, 3, 0, 0,-6,-3,-6,-3, 0, 0},
|
|
|
|
{-3, 0, 3, 0,-6,-6, 3, 0,-3, 0, 6, 6}
|
|
|
|
};
|
|
|
|
return hemitable[which][id];
|
|
|
|
}
|
2019-11-15 12:38:26 +00:00
|
|
|
else if(S7 == 4 && which < 6) {
|
2018-07-17 00:39:12 +00:00
|
|
|
int hemitable[3][6] = {
|
|
|
|
{ 2, 2, 2,-1,-1,-1},
|
|
|
|
{ 2,-1, 2, 2,-1,-1},
|
|
|
|
{ 2,-1,-1, 2, 2,-1},
|
|
|
|
};
|
|
|
|
return hemitable[which][id];
|
|
|
|
}
|
|
|
|
else if(S7 == 3) {
|
|
|
|
int hemitable[3][4] = {
|
|
|
|
{ 2, 2,-1,-1},
|
|
|
|
{ 2,-1, 2,-1},
|
|
|
|
{ 2,-1,-1, 2},
|
|
|
|
};
|
|
|
|
return hemitable[which][id];
|
|
|
|
}
|
|
|
|
else return 0;
|
|
|
|
}
|
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX int getHemisphere(cell *c, int which) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid && quotient) return 0;
|
|
|
|
if(mhybrid) { auto d = hybrid::get_where(c); return PIU(getHemisphere(d.first, which)); }
|
|
|
|
if(WDIM == 3 && !mhybrid) {
|
2019-03-02 23:43:31 +00:00
|
|
|
hyperpoint p = tC0(calc_relative_matrix(c, currentmap->gamestart(), C0));
|
|
|
|
return int(p[which] * 6 + 10.5) - 10;
|
2019-03-02 00:40:54 +00:00
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
if(which == 0 && GOLDBERG && has_nice_dual()) {
|
2018-04-10 06:05:35 +00:00
|
|
|
set<cell*> visited;
|
|
|
|
vector<cell*> q;
|
|
|
|
vector<int> type;
|
|
|
|
auto visit = [&] (cell *c, int t) {
|
|
|
|
if(visited.count(c)) return;
|
|
|
|
visited.insert(c);
|
|
|
|
q.push_back(c);
|
|
|
|
type.push_back(t);
|
|
|
|
};
|
|
|
|
|
|
|
|
cellwalker cw(currentmap->gamestart(), 0);
|
|
|
|
int ct = 1;
|
2018-08-17 22:46:45 +00:00
|
|
|
visit(cw.at, ct);
|
2018-04-10 06:05:35 +00:00
|
|
|
do {
|
|
|
|
cw = cw + wstep;
|
2018-08-17 22:46:45 +00:00
|
|
|
visit(cw.at, -ct);
|
2018-04-10 06:05:35 +00:00
|
|
|
cw = cw + (2*ct) + wstep + ct;
|
|
|
|
ct = -ct;
|
|
|
|
}
|
2018-08-17 22:46:45 +00:00
|
|
|
while(cw.at != currentmap->gamestart());
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(q); i++)
|
2018-04-10 06:05:35 +00:00
|
|
|
forCellCM(c2, q[i])
|
|
|
|
if(pseudohept(q[i]) || pseudohept(c2))
|
|
|
|
visit(c2, type[i]);
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(q); i++) if(q[i] == c) return type[i];
|
2018-04-10 06:05:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2018-07-17 00:39:12 +00:00
|
|
|
if(ctof(c))
|
|
|
|
return getHemisphere(c->master, which);
|
2017-12-05 15:19:22 +00:00
|
|
|
else {
|
|
|
|
int score = 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
if(0) ;
|
|
|
|
#if CAP_GP
|
|
|
|
else if(GOLDBERG) {
|
2018-04-10 06:05:35 +00:00
|
|
|
auto li = gp::get_local_info(c);
|
2018-04-10 22:55:05 +00:00
|
|
|
gp::be_in_triangle(li);
|
2019-05-26 16:04:02 +00:00
|
|
|
auto corner = cgi.gpdata->corners * gp::loctoh_ort(li.relative);
|
2018-04-10 06:05:35 +00:00
|
|
|
ld scored =
|
|
|
|
corner[0] * getHemisphere(c->master->c7, which)
|
2018-08-17 22:46:45 +00:00
|
|
|
+ corner[1] * getHemisphere(c->master->move(li.last_dir)->c7, which)
|
|
|
|
+ corner[2] * getHemisphere(c->master->modmove(li.last_dir+1)->c7, which);
|
2018-04-10 06:05:35 +00:00
|
|
|
int score = int(scored + 10.5) - 10;
|
|
|
|
ld error = scored - score;
|
|
|
|
if(score == 0 && error > .001) score++;
|
|
|
|
if(score == 0 && error < -.001) score--;
|
|
|
|
return score;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(IRREGULAR) {
|
2018-07-17 00:39:12 +00:00
|
|
|
auto m = irr::get_masters(c);
|
|
|
|
for(int i=0; i<3; i++)
|
|
|
|
score += getHemisphere(m[i], which);
|
|
|
|
return score / 3;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-04-10 06:05:35 +00:00
|
|
|
else {
|
|
|
|
for(int i=0; i<6; i+=2)
|
2018-08-17 22:46:45 +00:00
|
|
|
score += getHemisphere(c->move(i), which) * (c->c.mirror(i) ? -1 : 1);
|
2018-04-10 06:05:35 +00:00
|
|
|
return score/3;
|
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-01 10:02:26 +00:00
|
|
|
/** \brief Various functions related to map patterns. */
|
2019-08-09 21:08:42 +00:00
|
|
|
EX namespace patterns {
|
|
|
|
|
|
|
|
#if HDR
|
|
|
|
enum ePattern : char {
|
|
|
|
PAT_NONE = 0,
|
|
|
|
PAT_TYPES = 'T',
|
|
|
|
PAT_ZEBRA = 'z',
|
|
|
|
PAT_EMERALD = 'f',
|
|
|
|
PAT_PALACE = 'p',
|
|
|
|
PAT_FIELD = 'F',
|
|
|
|
PAT_DOWN = 'H',
|
|
|
|
PAT_COLORING = 'C',
|
|
|
|
PAT_SIBLING = 'S',
|
|
|
|
PAT_CHESS = 'c',
|
|
|
|
PAT_SINGLETYPE = 't'
|
|
|
|
};
|
|
|
|
|
|
|
|
static const int SPF_ROT = 1;
|
|
|
|
static const int SPF_SYM01 = 2;
|
|
|
|
static const int SPF_SYM02 = 4;
|
|
|
|
static const int SPF_SYM03 = 8;
|
|
|
|
static const int SPF_CHANGEROT = 16;
|
|
|
|
static const int SPF_TWOCOL = 32;
|
|
|
|
static const int SPF_EXTRASYM = 64;
|
|
|
|
static const int SPF_ALTERNATE = 128;
|
|
|
|
static const int SPF_FOOTBALL = 256;
|
|
|
|
static const int SPF_FULLSYM = 512;
|
|
|
|
static const int SPF_DOCKS = 1024;
|
|
|
|
static const int SPF_NO_SUBCODES = 2048;
|
|
|
|
|
|
|
|
static const int SPF_SYM0123 = SPF_SYM01 | SPF_SYM02 | SPF_SYM03;
|
|
|
|
|
|
|
|
struct patterninfo {
|
|
|
|
int id;
|
|
|
|
int dir;
|
|
|
|
bool reflect;
|
2020-06-02 00:27:53 +00:00
|
|
|
/** 1 if all symmetries, c->type if no symmetries */
|
2019-08-09 21:08:42 +00:00
|
|
|
int symmetries;
|
|
|
|
};
|
|
|
|
#endif
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2017-12-22 21:33:25 +00:00
|
|
|
void valSibling(cell *c, patterninfo& si, int sub, int pat) {
|
2017-12-09 07:06:41 +00:00
|
|
|
if(ctof(c)) {
|
|
|
|
int d = c->master->fieldval;
|
|
|
|
si.id = (d < siblings[d]) ? 0 : 1;
|
|
|
|
if(sub & SPF_ROT) si.id = 0;
|
|
|
|
for(int i=0; i<S7; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int di = c->master->move(i)->fieldval;
|
2017-12-09 07:06:41 +00:00
|
|
|
if(di == siblings[d]) si.dir = i;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
si.reflect = false;
|
|
|
|
}
|
|
|
|
else {
|
2021-07-11 21:22:00 +00:00
|
|
|
int ids = 0, td = 0;
|
2017-12-09 07:06:41 +00:00
|
|
|
for(int i=0; i<S3; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int d = c->move(2*i)->master->fieldval;
|
2021-07-11 21:22:00 +00:00
|
|
|
ids |= (1<<d);
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
for(int i=0; i<S3; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int d = c->move(2*i)->master->fieldval;
|
2017-12-09 07:06:41 +00:00
|
|
|
if(ids & (1<<siblings[d])) td += d;
|
|
|
|
}
|
|
|
|
if(td) {
|
|
|
|
si.id = 4;
|
|
|
|
for(int i=0; i<S3; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int d = c->move(2*i)->master->fieldval;
|
2017-12-09 07:06:41 +00:00
|
|
|
if(!(ids & (1<<siblings[d]))) si.dir = 2*i;
|
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
/* if(!(sub & SPF_ROT)) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int d0 = c->modmove(si.dir+2)->master->fieldval;
|
2017-12-09 19:02:56 +00:00
|
|
|
if(d0 < siblings[d0]) si.id += 8;
|
|
|
|
} */
|
2017-12-09 07:06:41 +00:00
|
|
|
si.reflect = false;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
si.id = 8;
|
|
|
|
si.dir = 0; // whatever
|
|
|
|
patterninfo si2;
|
2018-08-17 22:46:45 +00:00
|
|
|
valSibling(c->move(0), si2, sub, pat);
|
|
|
|
int di = si2.dir - c->c.spin(0);
|
2017-12-09 07:06:41 +00:00
|
|
|
di %= S7;
|
|
|
|
if(di<0) di += S7;
|
2017-12-22 21:33:25 +00:00
|
|
|
if(pat == PAT_SIBLING) si.reflect = di > S7/2;
|
2017-12-09 19:02:56 +00:00
|
|
|
if(sub & SPF_ROT) si.symmetries = 2;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX int downdir(cell *c, const cellfunction& cf) {
|
2018-09-27 19:52:13 +00:00
|
|
|
return parent_id(c, 1, cf) + 1;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
void applySym0123(int& i, int sub) {
|
|
|
|
bool sym01 = sub & SPF_SYM01;
|
|
|
|
bool sym02 = sub & SPF_SYM02;
|
|
|
|
bool sym03 = sub & SPF_SYM03;
|
|
|
|
if((sym01?1:0)+(sym02?1:0)+(sym03?1:0) >= 2) i &= ~3;
|
|
|
|
if(sym01 && (i&1)) i ^= 1;
|
|
|
|
if(sym02 && (i&2)) i ^= 2;
|
|
|
|
if(sym03 && (i&2)) i ^= 3;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
void applyAlt(patterninfo& si, int sub, int pat) {
|
|
|
|
if(sub & SPF_ALTERNATE) {
|
|
|
|
si.id += 4;
|
|
|
|
si.id %= 12;
|
|
|
|
}
|
|
|
|
if(pat == PAT_COLORING && (sub & SPF_FOOTBALL)) {
|
|
|
|
if(si.id == 4) si.dir++;
|
|
|
|
si.id = !si.id;
|
|
|
|
if(si.id && (sub & SPF_EXTRASYM))
|
|
|
|
si.symmetries = si.id ? 1 : 2;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-09 19:02:56 +00:00
|
|
|
void val46(cell *c, patterninfo &si, int sub, int pat) {
|
2017-12-09 07:06:41 +00:00
|
|
|
if(ctof(c)) {
|
|
|
|
si.id = c->master->emeraldval >> 1;
|
|
|
|
applySym0123(si.id, sub);
|
2017-12-22 00:25:05 +00:00
|
|
|
if(sub & SPF_CHANGEROT)
|
|
|
|
si.dir = (c->master->emeraldval&1);
|
|
|
|
else
|
|
|
|
si.dir = (c->master->emeraldval&1) ^ (c->master->emeraldval>>1);
|
2017-12-09 19:02:56 +00:00
|
|
|
si.symmetries = 2;
|
2017-12-19 13:35:34 +00:00
|
|
|
applyAlt(si, sub, pat);
|
2017-12-09 19:02:56 +00:00
|
|
|
/* printf("[%3d] ", c->master->emeraldval);
|
|
|
|
for(int i=0; i<6; i++) printf("%2d", val46(createMov(c, i)));
|
|
|
|
printf("\n"); */
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-08-17 22:46:45 +00:00
|
|
|
si.id = ((c->master->emeraldval & 1) ^ ((c->master->emeraldval & 2)>>1) ^ (c->c.spin(0)&1)) ? 8 : 4;
|
|
|
|
si.dir = ((c->move(0)->master->emeraldval + c->c.spin(0)) & 1) ? 2 : 0;
|
2017-12-09 07:06:41 +00:00
|
|
|
if(createMov(c, si.dir)->master->emeraldval & 4)
|
|
|
|
si.dir += 4;
|
2017-12-09 19:02:56 +00:00
|
|
|
|
|
|
|
if((sub & SPF_TWOCOL) && (pat == PAT_COLORING)) si.id = 4;
|
2017-12-19 13:35:34 +00:00
|
|
|
else if(pat == PAT_COLORING && si.id == 4) si.dir++;
|
2017-12-09 19:02:56 +00:00
|
|
|
|
|
|
|
if(sub & SPF_SYM01) si.symmetries = 2;
|
|
|
|
else if(sub & SPF_SYM03) si.symmetries = 2;
|
|
|
|
else if(sub & SPF_SYM02) si.symmetries = 4;
|
2017-12-19 13:35:34 +00:00
|
|
|
|
|
|
|
applyAlt(si, sub, pat);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// if(a46) return patterndir46(c, w == PAT_ZEBRA ? 3 : w == PAT_PALACE ? 2 : 1);
|
|
|
|
|
2017-12-09 19:02:56 +00:00
|
|
|
int inr(int a, int b, int c) { return a >= b && a < c; }
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
void val457(cell *c, patterninfo &si, int sub) {
|
|
|
|
si.id = zebra40(c);
|
2017-12-09 19:02:56 +00:00
|
|
|
if(inr(si.id, 8, 12)) si.symmetries = 4;
|
2017-12-09 07:06:41 +00:00
|
|
|
applySym0123(si.id, sub);
|
|
|
|
if(sub & SPF_ROT) {
|
|
|
|
if(si.id >= 4 && si.id < 7) si.id -= 4;
|
|
|
|
if(si.id >= 20 && si.id < 23) si.id -= 4;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
if(ctof(c)) {
|
2017-12-05 15:19:22 +00:00
|
|
|
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))
|
2017-12-09 07:06:41 +00:00
|
|
|
si.dir = i;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
else {
|
2018-01-06 21:34:03 +00:00
|
|
|
int d = dir_bitrunc457(c);
|
2017-12-09 07:06:41 +00:00
|
|
|
if(d >= 0) si.dir = d;
|
|
|
|
else si.dir = (zebra40(createMov(c, 0)) & 4) ? 2 : 0;
|
|
|
|
}
|
|
|
|
}
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void val38(cell *c, patterninfo &si, int sub, int pat) {
|
2017-12-09 07:06:41 +00:00
|
|
|
bool symRotation = sub & SPF_ROT;
|
|
|
|
|
|
|
|
if(ctof(c)) {
|
|
|
|
if(!symRotation)
|
|
|
|
si.id = (c->master->fiftyval >> 1) & 3;
|
2017-12-09 19:02:56 +00:00
|
|
|
else
|
|
|
|
si.id = 0;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(!BITRUNCATED && gp_threecolor() != 2)
|
2017-12-09 19:02:56 +00:00
|
|
|
si.id *= 4;
|
|
|
|
else
|
|
|
|
si.id += 4;
|
2018-08-28 15:17:34 +00:00
|
|
|
si.dir = (pat == PAT_COLORING && BITRUNCATED ? 1 : 0) + (c->master->fiftyval | (c->master->fiftyval & 8 ? 0 : 2));
|
2017-12-09 19:02:56 +00:00
|
|
|
si.symmetries = 2;
|
2017-12-19 13:35:34 +00:00
|
|
|
si.id += 8;
|
|
|
|
si.id %= 12;
|
|
|
|
applyAlt(si, sub, pat);
|
2017-12-29 00:10:47 +00:00
|
|
|
if((sub & SPF_DOCKS) && (c->master->fiftyval & 32))
|
|
|
|
si.id += 16, si.symmetries = 4;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
else {
|
2018-08-17 22:46:45 +00:00
|
|
|
int sp = c->c.spin(0);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG) {
|
2018-04-09 15:40:12 +00:00
|
|
|
sp = gp::last_dir(c);
|
2018-07-07 09:05:48 +00:00
|
|
|
sp ^= int(ishex2(c));
|
2018-04-04 16:00:40 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-28 15:17:34 +00:00
|
|
|
if(geometry == gBolza2 && (!GOLDBERG || gp_threecolor() == 2)) {
|
2018-06-21 23:48:46 +00:00
|
|
|
patterninfo si0;
|
|
|
|
patterninfo si1;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG) {
|
2018-06-22 02:42:58 +00:00
|
|
|
auto li = gp::get_local_info(c);
|
|
|
|
val38(c->master->c7, si0, 0, PAT_COLORING);
|
2018-08-17 22:46:45 +00:00
|
|
|
val38(c->master->move(li.last_dir)->c7, si1, 0, PAT_COLORING);
|
2018-06-22 02:42:58 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
2018-08-17 22:46:45 +00:00
|
|
|
val38(c->move(0), si0, 0, PAT_COLORING);
|
|
|
|
val38(c->move(2), si1, 0, PAT_COLORING);
|
2019-02-17 17:28:20 +00:00
|
|
|
}
|
2018-06-21 23:48:46 +00:00
|
|
|
if((si0.id+1) % 3 == (si1.id) % 3)
|
|
|
|
si.id = 8;
|
|
|
|
else
|
|
|
|
si.id = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
si.id = 8 * ((c->master->fiftyval & 1) ^ (sp & 1));
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG && pseudohept(c)) si.id = 4;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-29 00:10:47 +00:00
|
|
|
bool dock = false;
|
2017-12-09 19:02:56 +00:00
|
|
|
for(int i=0; i<c->type; i+=2) {
|
2017-12-29 00:10:47 +00:00
|
|
|
int fiv = createMov(c, i)->master->fiftyval;
|
|
|
|
int fv = (fiv >> 1) & 3;
|
|
|
|
if(fv == 0) {
|
|
|
|
si.dir = (si.id == 8 && pat == PAT_COLORING ? 1 : 0) + i;
|
|
|
|
if(fiv & 32) dock = true;
|
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
}
|
|
|
|
if(symRotation) si.symmetries = 2;
|
2017-12-19 13:35:34 +00:00
|
|
|
si.id += 8;
|
|
|
|
si.id %= 12;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG && pat == PAT_COLORING)
|
2018-04-05 22:40:53 +00:00
|
|
|
for(int i=0; i<c->type; i++) {
|
|
|
|
cell *c2 = createMov(c, i);
|
|
|
|
int id2 = 4;
|
|
|
|
if(!pseudohept(c2)) {
|
2018-08-17 22:46:45 +00:00
|
|
|
int sp2 = c2->c.spin(0);
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG) {
|
2018-04-09 15:40:12 +00:00
|
|
|
sp2 = gp::last_dir(c2);
|
2018-07-07 09:05:48 +00:00
|
|
|
sp2 ^= int(ishex2(c2));
|
2018-04-05 22:40:53 +00:00
|
|
|
}
|
|
|
|
id2 = 8 * ((c2->master->fiftyval & 1) ^ (sp2 & 1));
|
|
|
|
}
|
|
|
|
// printf("%p %2d : %d %d\n", c, si.id, i, id2);
|
|
|
|
if((id2+4) % 12 == si.id) si.dir = i;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-19 13:35:34 +00:00
|
|
|
applyAlt(si, sub, pat);
|
2017-12-29 00:10:47 +00:00
|
|
|
if(dock && (sub & SPF_DOCKS)) si.id += 16;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
void valEuclid6(cell *c, patterninfo &si, int sub) {
|
2017-12-09 07:06:41 +00:00
|
|
|
bool symRotation = sub & SPF_ROT;
|
2017-12-09 19:02:56 +00:00
|
|
|
si.id = ishept(c) ? 4 : ishex1(c) ? 8 : 0;
|
|
|
|
if(sub & SPF_CHANGEROT) {
|
2017-12-09 07:06:41 +00:00
|
|
|
si.dir = (zebra40(c)*4) % 6;
|
2017-12-09 19:02:56 +00:00
|
|
|
}
|
2017-12-21 10:36:07 +00:00
|
|
|
if(symRotation) si.id = 1;
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && (sub & SPF_FULLSYM))
|
2017-12-21 10:36:07 +00:00
|
|
|
si.symmetries = 1;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
void valEuclid4(cell *c, patterninfo &si, int sub) {
|
|
|
|
si.id = eupattern4(c);
|
|
|
|
applySym0123(si.id, sub);
|
|
|
|
if(sub & SPF_CHANGEROT) {
|
|
|
|
int dirt[] = {0,1,3,2};
|
|
|
|
si.dir = dirt[si.id];
|
|
|
|
if(c->type == 8) si.dir *= 2;
|
|
|
|
}
|
|
|
|
if(sub & SPF_SYM03) {
|
|
|
|
si.id *= 4;
|
|
|
|
applyAlt(si, sub, PAT_COLORING);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
si.symmetries = (sub & SPF_EXTRASYM) ? c->type/4 : c->type;
|
|
|
|
}
|
|
|
|
|
2017-12-09 19:02:56 +00:00
|
|
|
void val_all(cell *c, patterninfo &si, int sub, int pat) {
|
2021-06-16 10:45:16 +00:00
|
|
|
if(IRREGULAR || arcm::in() || bt::in() || arb::in() || WDIM == 3 || currentmap->strict_tree_rules()) si.symmetries = c->type;
|
2018-07-16 18:05:23 +00:00
|
|
|
else if(a46) val46(c, si, sub, pat);
|
2017-12-09 19:02:56 +00:00
|
|
|
else if(a38) val38(c, si, sub, pat);
|
2023-03-23 00:32:24 +00:00
|
|
|
else if(S7 < 6 && S3 == 3 && !INVERSE && !aperiodic) valSibling(c, si, sub, pat);
|
2019-12-14 10:26:03 +00:00
|
|
|
else if(euc::in(2,4)) valEuclid4(c, si, sub);
|
|
|
|
else if(euc::in(2,6)) valEuclid6(c, si, sub);
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(a4) val457(c, si, sub);
|
2017-12-09 19:02:56 +00:00
|
|
|
else si.symmetries = ctof(c) ? 1 : 2;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
2017-12-14 01:53:29 +00:00
|
|
|
void val_warped(cell *c, patterninfo& si) {
|
|
|
|
int u = ishept(c)?1:0;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(S3 != 3 || S7 != 7 || NONSTDVAR) {
|
2018-08-05 11:53:24 +00:00
|
|
|
si.id = u;
|
|
|
|
si.dir = 1;
|
|
|
|
return;
|
|
|
|
}
|
2017-12-14 01:53:29 +00:00
|
|
|
int qhex = 0;
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int v=0; v<c->type; v++) if(c->move(v) && !isWarped(c->move(v))) {
|
2017-12-14 01:53:29 +00:00
|
|
|
u += 2;
|
2018-08-17 22:46:45 +00:00
|
|
|
if(!ishept(c->move(v))) qhex++;
|
2017-12-14 01:53:29 +00:00
|
|
|
}
|
2018-04-04 13:05:12 +00:00
|
|
|
if(u == 8 && qhex == 2) u = 12;
|
|
|
|
else if(u == 2 && qhex == 1) u = 8;
|
|
|
|
else if(u == 6 && qhex == 2) u = 10;
|
2017-12-14 01:53:29 +00:00
|
|
|
si.id = u;
|
|
|
|
|
|
|
|
if(u == 6) {
|
|
|
|
for(int i=1; i<c->type; i+=2) if(!isWarped(createMov(c,i)))
|
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 2 || u == 3 || u == 8) {
|
|
|
|
for(int i=0; i<c->type; i++) if(!isWarped(createMov(c,i)))
|
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 4 || u == 10) {
|
|
|
|
for(int i=0; i<c->type; i+=2) if(!isWarped(createMov(c,i)))
|
|
|
|
si.dir = i;
|
|
|
|
if(u == 4)
|
2018-08-05 11:53:24 +00:00
|
|
|
si.reflect = !isWarped(createMov(c, (si.dir+1)%S6));
|
2017-12-14 01:53:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 6) {
|
|
|
|
for(int i=1; i<c->type; i+=2) if(!isWarped(createMov(c,i)))
|
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 5) {
|
2018-08-05 11:53:24 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(!isWarped(createMov(c,(i+S7/2)%S7)) && !isWarped(createMov(c,(i+(S7+1)/2)%S7)))
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 9) {
|
2018-08-05 11:53:24 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(!isWarped(createMov(c,(i+2)%S7)) && !isWarped(createMov(c,(i+S7-2)%S7)))
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 11) {
|
2018-08-05 11:53:24 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(isWarped(createMov(c,(i)%S7)) && isWarped(createMov(c,(i+1)%S7)))
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 12) {
|
|
|
|
for(int i=0; i<c->type; i+=2) if(isWarped(createMov(c,i))) {
|
|
|
|
si.dir = i;
|
2018-08-05 11:53:24 +00:00
|
|
|
si.reflect = !isWarped(createMov(c, (i+1)%S6));
|
2017-12-14 01:53:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(u == 7) {
|
2018-08-05 11:53:24 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(!isWarped(createMov(c,(i+1)%S7)) && !isWarped(createMov(c,(i+S7-1)%S7)))
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void val_nopattern(cell *c, patterninfo& si, int sub) {
|
2017-12-09 07:06:41 +00:00
|
|
|
// use val_all for nicer rotation
|
2017-12-09 19:02:56 +00:00
|
|
|
val_all(c, si, 0, 0);
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
// get id:
|
2018-08-28 15:17:34 +00:00
|
|
|
if((GOLDBERG? (S3==3) : !weirdhyperbolic) && isWarped(c))
|
2017-12-14 01:53:29 +00:00
|
|
|
val_warped(c, si);
|
2017-12-09 07:06:41 +00:00
|
|
|
else {
|
2018-06-17 10:02:47 +00:00
|
|
|
si.id = pseudohept(c) ? 1 : 0;
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in()) {
|
2017-12-14 01:53:29 +00:00
|
|
|
si.dir = ishex1(c) ? 0 : 3;
|
2017-12-09 19:02:56 +00:00
|
|
|
if(ctof(c)) si.symmetries = 3;
|
|
|
|
if(subpattern_flags & SPF_EXTRASYM)
|
|
|
|
si.symmetries /= 3;
|
2017-12-21 10:36:07 +00:00
|
|
|
if(subpattern_flags & SPF_FULLSYM)
|
|
|
|
si.symmetries = 1;
|
2017-12-09 19:02:56 +00:00
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere && BITRUNCATED && !(S7 == 3))
|
2017-12-09 19:02:56 +00:00
|
|
|
si.symmetries = ctof(c) ? 1 : 2;
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere && (sub & SPF_EXTRASYM)) {
|
2017-12-19 13:35:34 +00:00
|
|
|
si.symmetries = ctof(c) ? 1 : 2;
|
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
if(a38)
|
2018-08-28 15:17:34 +00:00
|
|
|
si.symmetries = (ctof(c) && BITRUNCATED) ? 1 : 2;
|
2017-12-09 19:02:56 +00:00
|
|
|
if(a457) {
|
|
|
|
si.symmetries = ctof(c) ? 1 : 2;
|
|
|
|
if(!ctof(c)) si.dir = 0;
|
|
|
|
}
|
|
|
|
if(a46) {
|
|
|
|
si.symmetries = ctof(c) ? 1 : 2;
|
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2018-04-04 15:59:24 +00:00
|
|
|
|
2019-08-09 12:12:33 +00:00
|
|
|
if(GOLDBERG && has_nice_dual() && !ishept(c) && ishex1(c)) si.dir = gmod(si.dir+3, S6);
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX ePattern whichPattern = PAT_NONE;
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX int subpattern_flags;
|
2017-12-09 19:02:56 +00:00
|
|
|
|
|
|
|
void val_threecolors(cell *c, patterninfo& si, int sub) {
|
|
|
|
int pcol = pattern_threecolor(c);
|
|
|
|
si.id = pcol * 4;
|
|
|
|
pcol = (pcol+1) % 3;
|
|
|
|
si.dir = -1;
|
|
|
|
for(int i=0; i<c->type; i++)
|
|
|
|
if(pattern_threecolor(createMov(c, i)) == pcol) {
|
|
|
|
if(si.dir == -1) si.dir = i;
|
|
|
|
else {
|
|
|
|
si.symmetries = i - si.dir;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && (sub & SPF_CHANGEROT)) {
|
2019-11-27 00:01:20 +00:00
|
|
|
if(GOLDBERG) {
|
|
|
|
auto li = gp::get_local_info(c);
|
|
|
|
if(li.first_dir >= 0)
|
|
|
|
si.dir = gmod(zebra40(c)*4 - li.total_dir - li.last_dir, 6);
|
|
|
|
else
|
|
|
|
si.dir = gmod(zebra40(c)*4, 6);
|
|
|
|
}
|
|
|
|
else if(c == c->master->c7)
|
|
|
|
si.dir = (zebra40(c)*4) % 6;
|
|
|
|
else
|
|
|
|
si.dir = (zebra40(c)*4 + 9 - c->c.spin(0)) % 6;
|
|
|
|
}
|
2017-12-21 10:36:07 +00:00
|
|
|
if(sub & SPF_ROT) si.id = 1;
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && !(sub & SPF_EXTRASYM)) {
|
2017-12-19 13:35:34 +00:00
|
|
|
si.symmetries = 6;
|
2017-12-09 19:02:56 +00:00
|
|
|
}
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && (sub & SPF_FULLSYM))
|
2017-12-21 10:36:07 +00:00
|
|
|
si.symmetries = 1;
|
2018-08-20 13:24:44 +00:00
|
|
|
applyAlt(si, sub, PAT_COLORING);
|
2017-12-09 19:02:56 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX patterninfo getpatterninfo(cell *c, ePattern pat, int sub) {
|
2020-06-03 09:46:50 +00:00
|
|
|
if(fake::in()) return FPIU(getpatterninfo(c, pat, sub));
|
2018-08-30 17:14:04 +00:00
|
|
|
if(!(sub & SPF_NO_SUBCODES)) {
|
|
|
|
auto si = getpatterninfo(c, pat, sub | SPF_NO_SUBCODES);
|
2019-02-17 17:28:20 +00:00
|
|
|
if(1) ;
|
|
|
|
#if CAP_IRR
|
|
|
|
else if(IRREGULAR)
|
2018-08-30 17:14:04 +00:00
|
|
|
si.id += irr::cellindex[c] << 8;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
else if(arcm::in())
|
2018-08-30 17:14:04 +00:00
|
|
|
si.id += (arcm::id_of(c->master) << 8) + (arcm::parent_index_of(c->master) << 16);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_GP
|
2018-08-30 17:14:04 +00:00
|
|
|
else if(GOLDBERG) {
|
2019-08-09 12:39:21 +00:00
|
|
|
if(c == c->master->c7) si.id += (c->c.fix(si.dir) << 8);
|
|
|
|
else si.id += (get_code(gp::get_local_info(c)) << 16) | (c->c.fix(si.dir) << 8);
|
2018-08-30 17:14:04 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-30 17:14:04 +00:00
|
|
|
return si;
|
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
bool symRotation = sub & SPF_ROT;
|
2017-12-09 19:02:56 +00:00
|
|
|
// bool sym0 = sub & (SPF_SYM01 | SPF_SYM02 | SPF_SYM03);
|
2018-08-02 20:25:08 +00:00
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
patterninfo si;
|
|
|
|
si.dir = 0; si.reflect = false; si.id = ctof(c);
|
2017-12-09 19:02:56 +00:00
|
|
|
si.symmetries = c->type;
|
2018-08-09 17:28:53 +00:00
|
|
|
|
2019-12-14 11:05:01 +00:00
|
|
|
if(bt::in()) {
|
2018-08-09 17:28:53 +00:00
|
|
|
if(pat == PAT_SINGLETYPE) si.id = 0;
|
2018-08-27 17:37:35 +00:00
|
|
|
else si.id = c->type & 1;
|
2018-08-09 17:28:53 +00:00
|
|
|
si.dir = 2;
|
|
|
|
return si;
|
|
|
|
}
|
2018-08-19 13:15:47 +00:00
|
|
|
|
2018-08-02 20:25:08 +00:00
|
|
|
if(pat == PAT_SINGLETYPE) {
|
|
|
|
si.id = 0; si.symmetries = 1;
|
|
|
|
if(sub & SPF_TWOCOL) si.id = c->type & 1;
|
|
|
|
if(sub & SPF_EXTRASYM) si.reflect = true;
|
|
|
|
return si;
|
|
|
|
}
|
2021-06-16 10:45:16 +00:00
|
|
|
|
|
|
|
if(currentmap->strict_tree_rules()) return si;
|
2020-05-30 18:06:58 +00:00
|
|
|
|
|
|
|
if(arb::in()) {
|
|
|
|
si.id = arb::id_of(c->master);
|
|
|
|
si.dir = 0;
|
2020-06-02 00:27:53 +00:00
|
|
|
si.symmetries = c->type / arb::current.shapes[si.id].repeat_value;
|
2020-05-30 18:06:58 +00:00
|
|
|
si.reflect = false;
|
|
|
|
return si;
|
|
|
|
}
|
|
|
|
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() && pat == 0) {
|
2018-08-20 13:24:44 +00:00
|
|
|
if(sub & SPF_FOOTBALL) {
|
|
|
|
val_threecolors(c, si, sub);
|
|
|
|
return si;
|
|
|
|
}
|
2018-08-19 21:06:32 +00:00
|
|
|
int id = arcm::id_of(c->master);
|
2018-08-20 00:02:45 +00:00
|
|
|
auto& ca = arcm::current;
|
|
|
|
si.id = ca.tilegroup[id];
|
|
|
|
si.symmetries = ca.periods[si.id];
|
|
|
|
si.dir = ca.groupoffset[id];
|
|
|
|
if((sub & SPF_EXTRASYM) && ca.have_symmetry && ca.tilegroup[id^1] < ca.tilegroup[id])
|
|
|
|
si.id = ca.tilegroup[id^1],
|
2018-08-19 13:15:47 +00:00
|
|
|
si.reflect = true;
|
|
|
|
return si;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-19 13:15:47 +00:00
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
if(pat == PAT_ZEBRA && stdhyperbolic) {
|
|
|
|
|
|
|
|
si.id = zebra40(c); // 4 to 43
|
|
|
|
int t4 = si.id>>2, tcdir = 0;
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE) tcdir = si.id^1;
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
else if(t4 == 10) tcdir = si.id-20;
|
|
|
|
else if(t4 >= 4 && t4 < 7) tcdir = 40 + (si.id&3);
|
|
|
|
else if(t4 >= 1 && t4 < 4) tcdir = si.id+12;
|
|
|
|
else if(t4 >= 7 && t4 < 10) tcdir = si.id-24;
|
|
|
|
|
2018-08-17 22:46:45 +00:00
|
|
|
for(int i=0; i<c->type; i++) if(c->move(i) && zebra40(c->move(i)) == tcdir)
|
2017-12-09 07:06:41 +00:00
|
|
|
si.dir = i;
|
|
|
|
|
|
|
|
applySym0123(si.id, sub);
|
|
|
|
|
|
|
|
if(symRotation) {
|
|
|
|
if(si.id >= 8 && si.id < 12) si.id -= 4;
|
|
|
|
if(si.id >= 12 && si.id < 16) si.id -= 8;
|
|
|
|
if(si.id >= 20 && si.id < 24) si.id -= 4;
|
|
|
|
if(si.id >= 24 && si.id < 28) si.id -= 8;
|
|
|
|
if(si.id >= 32 && si.id < 36) si.id -= 4;
|
|
|
|
if(si.id >= 36 && si.id < 40) si.id -= 8;
|
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
|
|
|
|
if(si.id >= 40 && si.id < 44 && symRotation)
|
|
|
|
si.symmetries = 2;
|
|
|
|
|
|
|
|
if(si.id >= 40 && si.id < 44 && (sub & (SPF_SYM02 | SPF_SYM03)))
|
|
|
|
si.symmetries = 2;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(pat == PAT_EMERALD && (stdhyperbolic || a38)) {
|
|
|
|
si.id = emeraldval(c); // 44 to 99
|
2022-12-08 18:38:06 +00:00
|
|
|
if(!meuclid) {
|
2017-12-09 07:06:41 +00:00
|
|
|
int tcdir = 0, tbest = (si.id&3);
|
|
|
|
for(int i=0; i<c->type; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
cell *c2 = c->move(i);
|
2017-12-09 07:06:41 +00:00
|
|
|
if(c2) {
|
|
|
|
int t2 = emeraldval(c2);
|
|
|
|
if((si.id&3) == (t2&3) && t2 > tbest)
|
|
|
|
tbest = t2, tcdir = i;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
si.dir = tcdir;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
applySym0123(si.id, sub);
|
2017-12-09 19:02:56 +00:00
|
|
|
if(si.id >= 44 && si.id < 48)
|
|
|
|
si.symmetries = 2;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(pat == PAT_PALACE && stdhyperbolic) {
|
2017-12-09 19:02:56 +00:00
|
|
|
si.id = fiftyval200(c);
|
|
|
|
|
|
|
|
si.reflect = polara50(c);
|
|
|
|
|
|
|
|
int look_for = -1;
|
|
|
|
int shft = 0;
|
|
|
|
if(inr(si.id, 0, 4)) {
|
2018-08-28 15:17:34 +00:00
|
|
|
look_for = si.id + (PURE ? 4 : 60);
|
2017-12-09 19:02:56 +00:00
|
|
|
if(symRotation) si.symmetries = 1;
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(inr(si.id, 4, 32)) look_for = si.id + (PURE ? 28 : 168);
|
|
|
|
else if(inr(si.id, 32, 60)) look_for = si.id + (PURE ? -28 : 112);
|
2017-12-09 19:02:56 +00:00
|
|
|
else if(inr(si.id, 60, 88)) look_for = si.id - 56, shft = si.reflect ? 1 : 5;
|
|
|
|
else if(inr(si.id, 88, 116)) look_for = si.id - 84, shft = 3;
|
|
|
|
else if(inr(si.id, 116, 144)) look_for = si.id + 56;
|
|
|
|
else if(inr(si.id, 144, 172)) look_for = si.id + 28;
|
|
|
|
else if(inr(si.id, 172, 200)) look_for = si.id - 28;
|
|
|
|
|
|
|
|
si.dir = -1;
|
2017-12-09 07:06:41 +00:00
|
|
|
for(int i=0; i<c->type; i++) {
|
2017-12-09 19:02:56 +00:00
|
|
|
cell *c2 = createMov(c, i);
|
|
|
|
if(fiftyval200(c2) == look_for)
|
|
|
|
si.dir = (i + shft) % c->type;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
|
|
|
|
if(si.dir == -1) {
|
|
|
|
si.dir = 0;
|
|
|
|
if(c->cpdist <= 1) printf("Not found for ID = %d (lf=%d)\n", si.id, look_for);
|
|
|
|
c->item = itBuggy;
|
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
applySym0123(si.id, sub);
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2017-12-09 19:02:56 +00:00
|
|
|
if(symRotation && si.id >= 4)
|
2017-12-09 07:06:41 +00:00
|
|
|
si.id -= ((si.id/4-1) % 7) * 4;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(pat == PAT_PALACE && meuclid) {
|
2017-12-09 07:06:41 +00:00
|
|
|
si.id = fiftyval049(c);
|
2017-12-09 19:02:56 +00:00
|
|
|
si.symmetries = 6;
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
2017-12-29 00:10:47 +00:00
|
|
|
else if(pat == PAT_PALACE) {
|
|
|
|
val_nopattern(c, si, sub);
|
|
|
|
si.id = c->master->fiftyval;
|
|
|
|
}
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(pat == PAT_DOWN) {
|
2018-09-27 19:52:13 +00:00
|
|
|
si.id = towerval(c, coastvalEdge);
|
|
|
|
si.dir = downdir(c, coastvalEdge);
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2017-12-09 07:06:41 +00:00
|
|
|
else if(pat == PAT_FIELD) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid)
|
2017-12-09 07:06:41 +00:00
|
|
|
// use the torus ID
|
|
|
|
si.id = fieldpattern::fieldval_uniq(c);
|
2020-09-15 17:20:49 +00:00
|
|
|
else if(PURE && standard_tiling())
|
2017-12-09 07:06:41 +00:00
|
|
|
// use the actual field codes
|
|
|
|
si.id = fieldpattern::fieldval(c).first;
|
|
|
|
else
|
|
|
|
// use the small numbers from windmap
|
|
|
|
si.id = windmap::getId(c);
|
|
|
|
// todo dir
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(msphere && pat == PAT_SIBLING) {
|
2017-12-09 19:02:56 +00:00
|
|
|
val_all(c, si, sub, pat);
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
else if(a457 && pat == PAT_ZEBRA) {
|
2017-12-09 19:02:56 +00:00
|
|
|
val_all(c, si, sub, pat);
|
|
|
|
}
|
2018-06-17 10:02:47 +00:00
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(GOLDBERG) {
|
2018-06-17 10:02:47 +00:00
|
|
|
bool football = (pat == PAT_COLORING && (sub & SPF_FOOTBALL)) || pat == 0;
|
|
|
|
if(football) val_nopattern(c, si, sub);
|
|
|
|
else val_threecolors(c, si, sub);
|
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(pat == PAT_COLORING && (S7 == 4 || meuclid || (a38 && gp_threecolor() == 1) || arcm::in())) {
|
2017-12-09 19:02:56 +00:00
|
|
|
val_threecolors(c, si, sub);
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
|
|
|
|
2017-12-09 19:02:56 +00:00
|
|
|
else if(pat == PAT_COLORING && (a46 || a38)) {
|
|
|
|
val_all(c, si, sub, pat);
|
2017-12-09 07:06:41 +00:00
|
|
|
}
|
2017-12-19 13:35:34 +00:00
|
|
|
|
|
|
|
else if(pat == PAT_CHESS) {
|
|
|
|
val_nopattern(c, si, sub);
|
2018-08-19 16:06:54 +00:00
|
|
|
si.id = chessvalue(c);
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
else
|
2017-12-14 01:53:29 +00:00
|
|
|
val_nopattern(c, si, sub);
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
return si;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
#if HDR
|
|
|
|
inline patterninfo getpatterninfo0(cell *c) {
|
|
|
|
return getpatterninfo(c, whichPattern, subpattern_flags);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
EX }
|
2017-12-05 15:19:22 +00:00
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX bool geosupport_chessboard() {
|
2018-08-30 00:11:43 +00:00
|
|
|
return
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
(arcm::in() && PURE) ? arcm::current.support_chessboard() :
|
|
|
|
(arcm::in() && DUAL) ? arcm::current.support_threecolor_bitruncated() :
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2020-07-12 18:52:32 +00:00
|
|
|
WARPED ? true :
|
|
|
|
INVERSE ? false :
|
2023-03-23 00:32:24 +00:00
|
|
|
(bt::in() || aperiodic) ? 0 :
|
2019-10-10 11:09:31 +00:00
|
|
|
(S3 >= OINF) ? true :
|
2019-12-14 11:31:20 +00:00
|
|
|
(valence() % 2 == 0);
|
2018-08-20 09:59:43 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int geosupport_threecolor() {
|
2018-08-28 15:17:34 +00:00
|
|
|
if(IRREGULAR) return 0;
|
2023-03-23 00:32:24 +00:00
|
|
|
if(aperiodic || bt::in()) return 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() && PURE) return arcm::current.support_threecolor();
|
|
|
|
if(arcm::in() && BITRUNCATED) return arcm::current.support_threecolor_bitruncated();
|
|
|
|
if(arcm::in() && DUAL) return 0; // it sometimes does support threecolor, but it can be obtained in other ways then
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2020-07-12 18:52:32 +00:00
|
|
|
if(INVERSE) return 0;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(BITRUNCATED && S3 == 3) {
|
2017-12-05 15:19:22 +00:00
|
|
|
if(S7 % 2) return 1;
|
|
|
|
return 2;
|
|
|
|
}
|
2019-10-10 11:09:31 +00:00
|
|
|
if(S3 >= OINF) return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
if((S7 % 2 == 0) && (S3 == 3))
|
|
|
|
return 2;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a46 && PURE)
|
2018-05-15 21:24:04 +00:00
|
|
|
return 1;
|
2017-12-05 15:19:22 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-09 20:07:03 +00:00
|
|
|
EX int geosupport_football() {
|
2018-01-06 21:34:03 +00:00
|
|
|
// always works in bitrunc geometries
|
2018-08-28 15:17:34 +00:00
|
|
|
if(BITRUNCATED) return 2;
|
2020-07-12 18:52:32 +00:00
|
|
|
if(INVERSE) return 0;
|
2023-03-23 00:32:24 +00:00
|
|
|
if(bt::in() || aperiodic) return 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
|
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() && DUAL) return false;
|
2018-08-30 00:11:43 +00:00
|
|
|
// it sometimes does support football, but it can be obtained in other ways then
|
2018-08-19 11:47:51 +00:00
|
|
|
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() /* PURE */) return arcm::current.support_football();
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-19 11:47:51 +00:00
|
|
|
|
2019-12-27 21:59:50 +00:00
|
|
|
if(arb::in()) return arb::current.have_ph;
|
|
|
|
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
if(IRREGULAR) return irr::bitruncations_performed ? 2 : 1;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-05 15:19:22 +00:00
|
|
|
|
|
|
|
// always works in patterns supporting three-color
|
2018-05-01 17:35:41 +00:00
|
|
|
int tc = max(geosupport_threecolor(), gp_threecolor());
|
2018-04-15 11:04:34 +00:00
|
|
|
if(tc) return tc;
|
|
|
|
|
|
|
|
if(S3 == 3 && S7 == 7) return 1;
|
2018-05-07 19:47:10 +00:00
|
|
|
// nice chessboard pattern, but not the actual Graveyard
|
|
|
|
if(S3 == 4 && !(S7&1)) return 1;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(S3 == 4 && GOLDBERG) return 1;
|
2018-04-15 11:04:34 +00:00
|
|
|
return 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX int pattern_threecolor(cell *c) {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) {
|
2018-08-29 02:28:34 +00:00
|
|
|
if(PURE)
|
2018-08-30 14:02:35 +00:00
|
|
|
return arcm::threecolor(c);
|
2018-08-29 02:28:34 +00:00
|
|
|
else /* if(BITRUNCATED) */
|
|
|
|
return c->master->rval1;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-12-27 21:59:50 +00:00
|
|
|
if(arb::in()) return arb::id_of(c->master) % 3;
|
2019-12-14 11:05:01 +00:00
|
|
|
if(IRREGULAR || bt::in()) return !pseudohept(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-04-09 18:39:52 +00:00
|
|
|
if(S3 == 3 && !(S7&1) && gp_threecolor() == 1 && c->master->c7 != c) {
|
|
|
|
auto li = gp::get_local_info(c);
|
2020-01-18 15:03:32 +00:00
|
|
|
int rel = gmod(li.relative.first - li.relative.second, 3);
|
|
|
|
int par = gmod(gp::param.first - gp::param.second, 3);
|
2018-04-09 18:39:52 +00:00
|
|
|
if(rel == 0)
|
|
|
|
return pattern_threecolor(c->master->c7);
|
|
|
|
else if(rel == par)
|
2019-08-09 12:12:33 +00:00
|
|
|
return pattern_threecolor(c->master->cmove(li.last_dir)->c7);
|
2018-04-09 18:39:52 +00:00
|
|
|
else
|
2019-08-09 12:12:33 +00:00
|
|
|
return pattern_threecolor(c->master->cmodmove(li.last_dir+1)->c7);
|
2018-04-09 18:39:52 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-05 15:19:22 +00:00
|
|
|
if(a38) {
|
2018-08-28 15:17:34 +00:00
|
|
|
// if(GOLDBERG && gp_threecolor() == 2 && gp::pseudohept_val(c) == 0) return 0;
|
2017-12-09 07:06:41 +00:00
|
|
|
patterns::patterninfo si;
|
2018-08-28 15:17:34 +00:00
|
|
|
patterns::val38(c, si, !BITRUNCATED ? 0 : patterns::SPF_ROT, patterns::PAT_COLORING);
|
2017-12-21 15:34:26 +00:00
|
|
|
return si.id >> 2;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && gp_threecolor() == 2) {
|
2019-11-27 00:01:20 +00:00
|
|
|
auto li = gp::get_local_info(c);
|
|
|
|
int rel = gmod(li.relative.first - li.relative.second, 3);
|
|
|
|
if(rel && (li.last_dir&1)) rel = 3 - rel;
|
|
|
|
return rel;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a4 && GOLDBERG) {
|
2018-07-10 11:15:26 +00:00
|
|
|
patterns::patterninfo si;
|
|
|
|
auto li = gp::get_local_info(c);
|
|
|
|
if(S7 & 1) return (li.relative.first&1) + (li.relative.second&1)*2;
|
|
|
|
patterns::val46(c->master->c7, si, 0, patterns::PAT_COLORING);
|
|
|
|
int i = si.id;
|
|
|
|
if(i&2) i ^= 1;
|
|
|
|
patterns::val46(createStep(c->master, li.last_dir)->c7, si, 0, patterns::PAT_COLORING);
|
|
|
|
if(si.id&2) si.id ^= 1;
|
|
|
|
int i2 = i ^ si.id;
|
|
|
|
int i3 = 3 - i2;
|
|
|
|
if(gp::param.first % 2 == 0 && gp::param.second % 2 == 0) i = 0;
|
|
|
|
if(li.relative.first & 1) i ^= i3;
|
|
|
|
if(li.relative.second & 1) i ^= i2;
|
|
|
|
return i;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a46 && BITRUNCATED) {
|
2017-12-09 07:06:41 +00:00
|
|
|
patterns::patterninfo si;
|
2017-12-09 19:02:56 +00:00
|
|
|
patterns::val46(c, si, 0, patterns::PAT_COLORING);
|
2017-12-09 07:06:41 +00:00
|
|
|
int i = si.id;
|
2017-12-05 15:19:22 +00:00
|
|
|
return i >> 2;
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid) {
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a4 && PURE) return eupattern4(c);
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6) && !BITRUNCATED) return eupattern(c) % 3;
|
2019-11-27 00:01:20 +00:00
|
|
|
return c == c->master->c7 ? 0 : (c->c.spin(0)&1) ? 1 : 2;
|
2017-12-18 18:04:37 +00:00
|
|
|
}
|
2019-10-10 11:09:31 +00:00
|
|
|
if(S3 >= OINF) return c->master->distance % 3;
|
2017-12-18 12:00:36 +00:00
|
|
|
if(S7 == 4 && S3 == 3) {
|
2017-12-05 15:19:22 +00:00
|
|
|
int codesN[6] = {0,1,2,1,2,0};
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-04-09 18:39:52 +00:00
|
|
|
if(gp_threecolor() == 2) {
|
2018-04-09 15:40:12 +00:00
|
|
|
auto li = gp::get_local_info(c);
|
2020-01-18 15:03:32 +00:00
|
|
|
int sp = gmod(li.relative.first + 2 * li.relative.second, 3);
|
2018-04-06 10:20:22 +00:00
|
|
|
if(sp != 0) {
|
|
|
|
if(li.last_dir & 1)
|
|
|
|
sp = 3 - sp;
|
|
|
|
if(among(c->master->fiftyval, 1, 3, 5))
|
|
|
|
sp = 3 - sp;
|
|
|
|
}
|
|
|
|
return sp;
|
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2018-08-28 15:17:34 +00:00
|
|
|
if(PURE)
|
2017-12-05 15:19:22 +00:00
|
|
|
return codesN[c->master->fiftyval];
|
|
|
|
if(ctof(c))
|
|
|
|
return 0;
|
|
|
|
else for(int i=0; i<3; i++) {
|
2018-08-17 22:46:45 +00:00
|
|
|
cell *c2 = c->move(i);
|
2017-12-05 15:19:22 +00:00
|
|
|
if(c2->master->fiftyval == 0)
|
2018-08-17 22:46:45 +00:00
|
|
|
return 1 + (c->c.spin(i)&1);
|
2017-12-05 15:19:22 +00:00
|
|
|
if(c2->master->fiftyval == 5)
|
2018-08-17 22:46:45 +00:00
|
|
|
return 2 - (c->c.spin(i)&1);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
if(stdhyperbolic && PURE) {
|
2017-12-05 15:19:22 +00:00
|
|
|
int z = zebra40(c);
|
|
|
|
if(z == 5 || z == 8 || z == 15) return 0;
|
2018-04-11 21:37:55 +00:00
|
|
|
if(c->land == laSnakeNest) {
|
|
|
|
if(z == 10 || z == 12 || z == 7) return 2;
|
|
|
|
if(z == 6 || z == 9) return 3;
|
|
|
|
if(z == 14 || z == 11) return 4;
|
|
|
|
}
|
2017-12-05 15:19:22 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a46 && !BITRUNCATED) {
|
2017-12-19 13:35:34 +00:00
|
|
|
patterns::patterninfo si;
|
|
|
|
patterns::val46(c, si, 0, patterns::PAT_COLORING);
|
|
|
|
return si.id;
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
if(S7 == 5 && PURE && S3 == 3) {
|
2017-12-05 15:19:22 +00:00
|
|
|
const int codes[12] = {1, 2, 0, 3, 2, 0, 0, 1, 3, 1, 2, 3};
|
|
|
|
return codes[c->master->fiftyval];
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
if(S7 == 3 && PURE)
|
2017-12-05 15:19:22 +00:00
|
|
|
return c->master->fiftyval;
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-04-11 21:37:55 +00:00
|
|
|
if(gp_threecolor() && (S7&1))
|
|
|
|
return gp::pseudohept_val(c) > 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-09 01:20:10 +00:00
|
|
|
return !ishept(c);
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// returns ishept in the normal tiling;
|
|
|
|
// in the 'pure heptagonal' tiling, returns true for a set of cells
|
|
|
|
// which roughly corresponds to the heptagons in the normal tiling
|
2019-08-09 21:24:33 +00:00
|
|
|
EX bool pseudohept(cell *c) {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
if(IRREGULAR) return irr::pseudohept(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2022-12-08 18:38:06 +00:00
|
|
|
if(mhybrid) { auto d = hybrid::get_where(c); return ((!mproduct) || (d.second & 1)) && PIU(pseudohept(d.first)); }
|
2019-02-27 13:40:56 +00:00
|
|
|
#if CAP_BT
|
2019-08-06 18:59:43 +00:00
|
|
|
if(nil) return c->master->zebraval & c->master->emeraldval & c->master->fieldval & 1;
|
2019-08-02 20:10:59 +00:00
|
|
|
if(sol) return (c->master->emeraldval % 3 == 2) && (c->master->zebraval % 3 == 2) && (c->master->distance % 2);
|
2019-10-02 17:22:43 +00:00
|
|
|
if(nih) return c->master->zebraval % 3 == 2 && c->master->emeraldval % 2 == 1 && (c->master->distance % 2);
|
2019-12-14 11:12:24 +00:00
|
|
|
if(kite::in()) return kite::getshape(c->master) == kite::pDart;
|
2023-03-24 22:19:32 +00:00
|
|
|
if(hat::in()) return hat::pseudohept(c);
|
2019-12-14 11:05:01 +00:00
|
|
|
if(bt::in()) return bt::pseudohept(c);
|
2019-02-27 13:40:56 +00:00
|
|
|
#endif
|
2019-10-10 11:09:31 +00:00
|
|
|
if(S3 >= OINF) return c->master->distance % 3 == 1;
|
2019-02-27 22:30:26 +00:00
|
|
|
#if MAXMDIM == 4
|
2019-05-08 16:33:08 +00:00
|
|
|
if(WDIM == 3) {
|
2019-03-21 18:23:27 +00:00
|
|
|
if(geometry == gField435) return false;
|
2020-05-15 09:46:26 +00:00
|
|
|
else if(euc::in()) return euc::pseudohept(c);
|
2019-03-02 23:43:31 +00:00
|
|
|
else return reg3::pseudohept(c);
|
2019-02-27 13:40:56 +00:00
|
|
|
}
|
|
|
|
#endif
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) return arcm::pseudohept(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2019-12-27 21:59:50 +00:00
|
|
|
if(arb::in()) return arb::pseudohept(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2020-07-12 18:52:32 +00:00
|
|
|
if(INVERSE) return false;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG && gp_threecolor() == 2)
|
2018-04-09 18:39:52 +00:00
|
|
|
return gp::pseudohept_val(c) == 0;
|
2018-08-28 15:17:34 +00:00
|
|
|
if(GOLDBERG && gp_threecolor() == 1 && (S7&1) && (S3 == 3))
|
2018-04-10 18:26:33 +00:00
|
|
|
return gp::pseudohept_val(c) == 0;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-05 18:43:45 +00:00
|
|
|
return pattern_threecolor(c) == 0;
|
2017-12-05 15:19:22 +00:00
|
|
|
}
|
|
|
|
|
2018-05-04 10:49:50 +00:00
|
|
|
// while Krakens movement is usually restricted to non-pseudohept cells,
|
|
|
|
// there is one special case when this does not work (because non-pseudohept cells have varying degrees)
|
2019-09-05 10:00:55 +00:00
|
|
|
EX bool kraken_pseudohept(cell *c) {
|
2019-02-17 17:28:20 +00:00
|
|
|
if(0);
|
|
|
|
#if CAP_GP
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(!meuclid && S3 == 4 && GOLDBERG && (gp::param.first % 2 || gp::param.second % 2 || S7 % 2))
|
2018-07-10 11:15:26 +00:00
|
|
|
return ishept(c);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_IRR
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(IRREGULAR)
|
2018-07-16 19:41:59 +00:00
|
|
|
return c->type != 6;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
else if(arcm::in() && PURE)
|
2018-08-30 14:08:28 +00:00
|
|
|
return c->type != isize(arcm::current.triangles[0]);
|
2019-12-14 10:42:16 +00:00
|
|
|
else if(arcm::in() && BITRUNCATED)
|
2018-08-30 00:11:43 +00:00
|
|
|
return pseudohept(c);
|
2019-12-14 10:42:16 +00:00
|
|
|
else if(arcm::in() && DUAL)
|
2018-08-30 14:08:28 +00:00
|
|
|
return false;
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(!meuclid && S3 == 3 && !(S7&1) && gp_threecolor() == 1)
|
2018-05-04 10:49:50 +00:00
|
|
|
return ishept(c);
|
|
|
|
else
|
|
|
|
return pseudohept(c);
|
|
|
|
}
|
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX bool warptype(cell *c) {
|
2018-08-20 09:59:43 +00:00
|
|
|
if(geosupport_chessboard())
|
|
|
|
return chessvalue(c);
|
2018-08-28 15:17:34 +00:00
|
|
|
else if(NONSTDVAR)
|
2018-04-04 13:05:12 +00:00
|
|
|
return pseudohept(c);
|
|
|
|
else
|
|
|
|
return pattern_threecolor(c) == 0;
|
2017-12-18 20:15:03 +00:00
|
|
|
}
|
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX map<char, colortable> colortables = {
|
2018-11-08 15:21:33 +00:00
|
|
|
{'A', {
|
|
|
|
0xF04040, 0x40F040, 0x4040F0,
|
|
|
|
0xD0D000, 0xD000D0, 0x00D0D0,
|
|
|
|
0xC0C0C0, 0x404040, 0x808080,
|
|
|
|
0xF08040, 0xF04080, 0x40F080,
|
|
|
|
0x4080F0, 0x8040F0, 0x80F040,
|
|
|
|
0xFFD500 }},
|
2022-10-06 11:35:56 +00:00
|
|
|
{'R', { // reverse versions of 'A'
|
2022-10-06 08:08:10 +00:00
|
|
|
0xF04080, 0x40F080, 0x3030D0,
|
|
|
|
0xA0A060, 0xA000F0, 0x00A060,
|
|
|
|
0xC0C0F0, 0x404070, 0x8080C0,
|
|
|
|
0xF08080, 0xF040C0, 0x40F0C0,
|
|
|
|
0x3060D0, 0x6030D0, 0x80F080,
|
|
|
|
0xFFD580 }},
|
2018-11-08 15:21:33 +00:00
|
|
|
{'B', {
|
|
|
|
// trying to get colors as in Wikipedia [ https://en.wikipedia.org/wiki/Euclidean_tilings_by_convex_regular_polygons#k-uniform_tilings ]
|
|
|
|
0, 0, 0xFFFFFF, 0xFFFF00,
|
|
|
|
0xFF0000, 0xC000C0 /* unknown5 */, 0x00FF00, 0x00C0C0 /* unknown7 */, 0xFF8000,
|
|
|
|
0xFFFF80, 0xC040C0, 0xFFD500, 0x000080,
|
|
|
|
0x404040, 0x606060, 0x808080
|
|
|
|
}},
|
2022-02-01 16:09:36 +00:00
|
|
|
{'a', {0x800000, 0x503000, 0x206000, 0x202020, 0x004040, 0x001070, 0x606060, 0x500030}},
|
2019-10-06 11:03:21 +00:00
|
|
|
{'e', {0x404040, 0x1800000, 0x1008000, 0x000080 }},
|
|
|
|
{'b', {0x404040, 0x1800000, 0x1008000, 0x000080 }},
|
|
|
|
{'z', {0x1C0C0C0, 0x1E0E0E0, 0x404040, 0x606060 }},
|
|
|
|
{'x', {0xC0C0C0, 0x1800000, 0x1008000, 0x000080 }},
|
|
|
|
{'t', {0x804040, 0x1408040, 0x404080, 0x1808040 }},
|
|
|
|
{'c', {0x202020, 0x1C0C0C0}},
|
|
|
|
{'F', {0x1C0C0C0, 0x202020}},
|
|
|
|
{'w', {0x303030, 0x1C0C0C0}},
|
2018-11-10 18:51:06 +00:00
|
|
|
{'v', {0xC00000, 0xC08000, 0xC0C000, 0x00C000, 0xC0C0, 0x00C0, 0xC000C0}},
|
2019-10-06 11:03:35 +00:00
|
|
|
{'j', {0x100FFFF, 0x100FF00, 0x1FFFF00, 0x1FF8000, 0x1FF0000, 0x1FF00FF}},
|
2019-11-08 14:02:03 +00:00
|
|
|
{'!', {0x1202020, 0x1000080, 0x1008000, 0x1008080, 0x1800000, 0x1800080, 0x1808000, 0x1C0C0C0,
|
|
|
|
0x1808080, 0x10000FF, 0x100FF00, 0x100FFFF, 0x1FF0000, 0x1FF00FF, 0x1FFFF00, 0x1FFFFFF}},
|
2018-11-08 15:21:33 +00:00
|
|
|
};
|
|
|
|
|
2019-03-12 01:42:18 +00:00
|
|
|
color_t random_landscape(cell *c, int mul, int div, int step, color_t base) {
|
2018-11-08 15:21:33 +00:00
|
|
|
int col[4];
|
|
|
|
for(int j=0; j<4; j++) {
|
|
|
|
col[j] = getCdata(c, j);
|
|
|
|
col[j] *= mul;
|
|
|
|
col[j] %= 240;
|
|
|
|
if(col[j] > 120) col[j] = 240 - col[j];
|
|
|
|
if(col[j] < -120) col[j] = -240 - col[j];
|
|
|
|
}
|
|
|
|
col[0] /= div;
|
|
|
|
col[1] /= div;
|
|
|
|
col[2] /= div;
|
|
|
|
if(ISWEB) for(int a=0; a<3; a++) col[a] = (col[a] + step/2) / step * step;
|
2019-10-06 11:03:21 +00:00
|
|
|
color_t res = base + col[0] + (col[1] << 8) + (col[2] << 16);
|
|
|
|
if(WDIM == 3 && (getBits(c) & 1)) res |= 0x1000000;
|
|
|
|
return res;
|
2018-11-08 15:21:33 +00:00
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX namespace patterns {
|
|
|
|
EX int canvasback = linf[laCanvas].color >> 2;
|
|
|
|
EX int subcanvas;
|
|
|
|
EX bool displaycodes;
|
|
|
|
EX char whichShape = 0;
|
|
|
|
EX char whichCanvas = 0;
|
2019-11-16 00:38:55 +00:00
|
|
|
EX bool innerwalls;
|
2018-11-10 18:51:06 +00:00
|
|
|
|
|
|
|
int sevenval(cell *c) {
|
2022-12-08 18:38:06 +00:00
|
|
|
if(!meuclid) return 0;
|
2019-11-27 00:01:20 +00:00
|
|
|
auto p = euc2_coordinates(c);
|
2018-11-10 18:51:06 +00:00
|
|
|
return gmod(p.first - p.second * 2, 7);
|
|
|
|
}
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-09-05 10:00:55 +00:00
|
|
|
EX string color_formula = "to01(rgb(x,y,z))";
|
2019-01-28 20:43:13 +00:00
|
|
|
|
2020-01-15 17:24:18 +00:00
|
|
|
map<cell*, color_t> computed_nearer_map;
|
|
|
|
|
|
|
|
color_t nearer_map(cell *c) {
|
|
|
|
if(computed_nearer_map.count(c)) return computed_nearer_map[c];
|
2022-05-21 11:08:42 +00:00
|
|
|
if(!closed_manifold) return 0;
|
2020-01-15 17:24:18 +00:00
|
|
|
|
|
|
|
cell *sc = currentmap->gamestart();
|
|
|
|
auto ac = currentmap->allcells();
|
2021-07-09 12:04:04 +00:00
|
|
|
vector<int> bydist(100, 0);
|
|
|
|
vector<int> bynei(FULL_EDGE+1, 0);
|
2020-01-15 17:24:18 +00:00
|
|
|
int maxd = 0;
|
|
|
|
for(cell *d: ac) {
|
|
|
|
int di = celldistance(sc, d);
|
2021-07-09 12:04:04 +00:00
|
|
|
if(di<100) bydist[di]++;
|
2020-01-15 17:24:18 +00:00
|
|
|
maxd = max(maxd, di);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto& cnm = computed_nearer_map;
|
|
|
|
|
|
|
|
for(cell *d: ac) cnm[d] = 0x101010;
|
|
|
|
|
|
|
|
for(cell *d: ac) if(celldistance(sc, d) == maxd) {
|
|
|
|
for(cell *e: ac) if(celldistance(sc, e) > celldistance(d, e)) {
|
|
|
|
cnm[e] = 0x1FF4040;
|
|
|
|
int nei = 0;
|
|
|
|
forCellEx(f, e) if(celldistance(sc, f) > celldistance(d, f)) nei++;
|
|
|
|
bynei[nei]++;
|
|
|
|
if(nei == 6) cnm[e] = 0x1FFFF80;
|
|
|
|
if(nei == S7) cnm[e] = 0x404040;
|
|
|
|
}
|
|
|
|
if(0) for(cell *e: ac) if(celldistance(sc, e) == celldistance(d, e))
|
|
|
|
cnm[e] = 0x140FF40;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
println(hlog, "bydist = ", bydist, " bynei = ", bynei);
|
|
|
|
|
|
|
|
return cnm[c];
|
|
|
|
}
|
2020-01-15 21:12:57 +00:00
|
|
|
|
|
|
|
map<cell*, color_t> computed_furthest_map;
|
|
|
|
|
2020-01-25 18:24:51 +00:00
|
|
|
color_t furthest_map(cell *c, int reduce) {
|
2020-01-15 21:12:57 +00:00
|
|
|
auto& cfm = computed_furthest_map;
|
|
|
|
if(cfm.count(c)) return cfm[c];
|
2022-05-21 11:08:42 +00:00
|
|
|
if(!closed_manifold) return 0;
|
2020-01-15 21:12:57 +00:00
|
|
|
|
|
|
|
cell *sc = currentmap->gamestart();
|
|
|
|
auto ac = currentmap->allcells();
|
2021-07-09 12:04:04 +00:00
|
|
|
vector<int> bydist(100, 0);
|
|
|
|
vector<int> bynei(FULL_EDGE+1, 0);
|
2020-01-15 21:12:57 +00:00
|
|
|
int maxd = 0;
|
|
|
|
for(cell *d: ac) {
|
|
|
|
int di = celldistance(sc, d);
|
2021-07-09 12:04:04 +00:00
|
|
|
if(di<100) bydist[di]++;
|
2020-01-15 21:12:57 +00:00
|
|
|
maxd = max(maxd, di);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(cell *d: ac) cfm[d] = 0x101010;
|
|
|
|
|
2020-01-25 18:24:51 +00:00
|
|
|
for(cell *d: ac) if(celldistance(sc, d) == maxd - reduce)
|
2020-01-15 21:12:57 +00:00
|
|
|
cfm[d] = 0x1FFFF80;
|
|
|
|
|
|
|
|
println(hlog, "bydist = ", bydist);
|
|
|
|
|
|
|
|
return cfm[c];
|
|
|
|
}
|
2020-01-15 17:24:18 +00:00
|
|
|
|
2020-01-15 21:12:57 +00:00
|
|
|
|
2019-01-28 20:43:13 +00:00
|
|
|
cld compute_map_function(cell *c, int p, const string& formula) {
|
|
|
|
exp_parser ep;
|
|
|
|
ep.extra_params["p"] = p;
|
2019-11-15 12:38:26 +00:00
|
|
|
|
|
|
|
hyperpoint h = calc_relative_matrix(c, currentmap->gamestart(), C0) * C0;
|
|
|
|
ep.extra_params["x"] = h[0];
|
|
|
|
ep.extra_params["y"] = h[1];
|
|
|
|
ep.extra_params["z"] = h[2];
|
2021-03-30 09:27:48 +00:00
|
|
|
#if MAXMDIM >= 4
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["w"] = h[3];
|
2021-03-30 09:27:48 +00:00
|
|
|
#endif
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["z40"] = zebra40(c);
|
|
|
|
ep.extra_params["z3"] = zebra3(c);
|
|
|
|
ep.extra_params["ev"] = emeraldval(c);
|
|
|
|
ep.extra_params["fv50"] = fiftyval(c);
|
|
|
|
ep.extra_params["pa"] = polara50(c);
|
|
|
|
ep.extra_params["pb"] = polarb50(c);
|
|
|
|
ep.extra_params["pd"] = cdist50(c);
|
|
|
|
ep.extra_params["fu"] = fieldpattern::fieldval_uniq(c);
|
|
|
|
ep.extra_params["threecolor"] = pattern_threecolor(c);
|
|
|
|
ep.extra_params["chess"] = chessvalue(c);
|
|
|
|
ep.extra_params["ph"] = pseudohept(c);
|
|
|
|
ep.extra_params["kph"] = kraken_pseudohept(c);
|
2019-11-27 00:01:20 +00:00
|
|
|
if(true) {
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["md"] = c->master->distance;
|
|
|
|
ep.extra_params["me"] = c->master->emeraldval;
|
|
|
|
ep.extra_params["mf"] = c->master->fieldval;
|
|
|
|
ep.extra_params["mz"] = c->master->zebraval;
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if(msphere) {
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["h0"] = getHemisphere(c, 0);
|
|
|
|
ep.extra_params["h1"] = getHemisphere(c, 1);
|
|
|
|
ep.extra_params["h2"] = getHemisphere(c, 2);
|
|
|
|
}
|
|
|
|
if(euclid) {
|
2019-11-30 17:47:43 +00:00
|
|
|
auto co = euc2_coordinates(c);
|
|
|
|
int x = co.first, y = co.second;
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["ex"] = x;
|
|
|
|
ep.extra_params["ey"] = y;
|
|
|
|
if(S7 == 6) ep.extra_params["ez"] = -x-y;
|
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_CRYSTAL
|
2019-11-15 12:38:26 +00:00
|
|
|
if(cryst) {
|
|
|
|
crystal::ldcoord co = crystal::get_ldcoord(c);
|
|
|
|
for(int i=0; i<crystal::MAXDIM; i++)
|
|
|
|
ep.extra_params["x"+its(i)] = co[i];
|
2019-01-28 20:43:13 +00:00
|
|
|
}
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2021-03-30 09:27:48 +00:00
|
|
|
#if CAP_SOLV
|
2019-11-15 12:38:26 +00:00
|
|
|
if(asonov::in()) {
|
|
|
|
auto co = asonov::get_coord(c->master);
|
|
|
|
ep.extra_params["ax"] = szgmod(co[0], asonov::period_xy);
|
|
|
|
ep.extra_params["ay"] = szgmod(co[1], asonov::period_xy);
|
|
|
|
ep.extra_params["az"] = szgmod(co[2], asonov::period_z);
|
|
|
|
}
|
2021-03-30 09:27:48 +00:00
|
|
|
#endif
|
2019-11-15 12:38:26 +00:00
|
|
|
if(nil) {
|
|
|
|
auto co = nilv::get_coord(c->master);
|
|
|
|
ep.extra_params["nx"] = szgmod(co[0], nilv::nilperiod[0]);
|
|
|
|
ep.extra_params["ny"] = szgmod(co[1], nilv::nilperiod[1]);
|
|
|
|
ep.extra_params["nz"] = szgmod(co[2], nilv::nilperiod[2]);
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(mhybrid)
|
2019-11-15 12:38:26 +00:00
|
|
|
ep.extra_params["level"] = hybrid::get_where(c).second;
|
|
|
|
|
|
|
|
if(geometry_supports_cdata()) {
|
|
|
|
ep.extra_params["d0"] = getCdata(c, 0);
|
|
|
|
ep.extra_params["d1"] = getCdata(c, 1);
|
|
|
|
ep.extra_params["d2"] = getCdata(c, 2);
|
|
|
|
ep.extra_params["d3"] = getCdata(c, 3);
|
|
|
|
}
|
|
|
|
|
2019-01-28 20:43:13 +00:00
|
|
|
ep.s = formula;
|
2019-12-23 20:44:51 +00:00
|
|
|
try {
|
|
|
|
return ep.parse();
|
|
|
|
}
|
2021-06-29 05:39:11 +00:00
|
|
|
catch(hr_parse_exception&) {
|
2019-12-23 20:44:51 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2019-01-28 20:43:13 +00:00
|
|
|
}
|
|
|
|
|
2022-10-24 07:39:36 +00:00
|
|
|
EX color_t compute_cell_color(cell *c) {
|
|
|
|
color_t res;
|
|
|
|
for(int i=0; i<4; i++) {
|
|
|
|
ld v = real(compute_map_function(c, 1+i, color_formula));
|
|
|
|
if(i == 3) part(res, i) = (v > 0);
|
|
|
|
else if(v < 0) part(res, i) = 0;
|
|
|
|
else if(v > 1) part(res, i) = 255;
|
|
|
|
else part(res, i) = int(v * 255 + .5);
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2020-04-11 18:47:14 +00:00
|
|
|
EX hookset<int(cell*)> hooks_generate_canvas;
|
2022-04-28 06:24:13 +00:00
|
|
|
|
|
|
|
EX color_t apeirogonal_color = 0xFFFFFFFF;
|
|
|
|
|
2020-04-29 13:16:12 +00:00
|
|
|
EX int jhole = 0;
|
|
|
|
EX int jblock = 0;
|
|
|
|
EX int rwalls = 50;
|
2020-05-31 15:12:31 +00:00
|
|
|
|
|
|
|
EX void edit_rwalls() {
|
|
|
|
if(WDIM == 2) return;
|
|
|
|
dialog::editNumber(rwalls, 0, 100, 10, 50, XLAT("probability of a wall (%)"), "");
|
|
|
|
dialog::reaction = [] { stop_game(); start_game(); };
|
|
|
|
}
|
2019-09-08 10:24:50 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX int generateCanvas(cell *c) {
|
2019-09-08 10:24:50 +00:00
|
|
|
|
|
|
|
int i = callhandlers(-1, hooks_generate_canvas, c);
|
|
|
|
if(i != -1) return i;
|
2022-04-26 14:17:01 +00:00
|
|
|
if(arb::apeirogon_consistent_coloring && arb::is_apeirogonal(c)) {
|
2022-04-22 22:57:57 +00:00
|
|
|
for(cell *c1: {c->move(c->type-1), c->move(c->type-2), c->cmove(c->type-1)->move(c->type-1), c->cmove(c->type-2)->move(c->type-2)})
|
|
|
|
if(c1 && c1->mpdist <= BARLEV) return c1->landparam;
|
|
|
|
}
|
|
|
|
|
2018-11-08 15:21:33 +00:00
|
|
|
switch(whichCanvas) {
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_CRYSTAL
|
2020-01-02 15:56:25 +00:00
|
|
|
case 'K': case '#': case '=': case 'O': case '/': case '@':
|
2019-10-25 10:47:03 +00:00
|
|
|
if(nil)
|
|
|
|
return nilv::colorize(c, whichCanvas);
|
|
|
|
else
|
|
|
|
return crystal::colorize(c, whichCanvas);
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2022-10-06 11:35:56 +00:00
|
|
|
case 'A': case 'R':
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2022-10-06 07:57:18 +00:00
|
|
|
if(arcm::in()) {
|
2022-10-06 08:08:21 +00:00
|
|
|
int id = arcm::id_of(c->master);
|
|
|
|
int tid = arcm::current.tilegroup[id];
|
|
|
|
int tid2 = arcm::current.tilegroup[id^1];
|
|
|
|
bool mirrored = (id&1) && (tid != tid2);
|
|
|
|
if(tid2 >= 0) tid = min(tid, tid2);
|
2022-10-06 11:35:56 +00:00
|
|
|
return colortables[mirrored ? whichCanvas : 'A'][tid];
|
2022-10-06 07:57:18 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2022-10-06 07:57:18 +00:00
|
|
|
if(arb::in()) {
|
|
|
|
int id = shvid(c);
|
|
|
|
auto& sh = arb::current.shapes[id];
|
|
|
|
int oid = sh.orig_id;
|
|
|
|
bool mirrored = c->master->emeraldval || sh.is_mirrored;
|
2022-10-06 11:35:56 +00:00
|
|
|
return colortables[mirrored ? whichCanvas : 'A'][oid];
|
2022-10-06 07:57:18 +00:00
|
|
|
}
|
2021-07-31 13:10:30 +00:00
|
|
|
return colortables['A'][shvid(c)];
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'B':
|
2022-04-28 06:24:13 +00:00
|
|
|
if(arb::is_apeirogonal(c)) return apeirogonal_color;
|
2018-11-08 15:21:33 +00:00
|
|
|
return colortables['B'][c->type & 15];
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'C': {
|
|
|
|
if(!hyperbolic) return canvasback;
|
|
|
|
using namespace fieldpattern;
|
|
|
|
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
|
|
|
if(z < currfp.circrad) return 0x00C000;
|
|
|
|
int z2 = currfp.getdist(fieldval(c), make_pair(currfp.otherpole,false));
|
|
|
|
if(z2 < currfp.disthep[currfp.otherpole] - currfp.circrad)
|
|
|
|
return 0x3000;
|
|
|
|
return 0x6000;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'D': {
|
|
|
|
if(!hyperbolic) return canvasback;
|
|
|
|
using namespace fieldpattern;
|
|
|
|
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
|
|
|
return 255 * (currfp.maxdist+1-z) / currfp.maxdist;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'N': {
|
|
|
|
if(!hyperbolic) return canvasback;
|
|
|
|
using namespace fieldpattern;
|
|
|
|
int z = currfp.getdist(fieldval(c), make_pair(0,false));
|
|
|
|
int z2 = currfp.getdist(fieldval(c), make_pair(currfp.otherpole,false));
|
|
|
|
if(z < z2) return 0x00C000;
|
|
|
|
if(z > z2) return 0xC00000;
|
|
|
|
return 0xCCCC00;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2019-11-30 12:27:55 +00:00
|
|
|
case 'M': {
|
|
|
|
int d = celldist(c);
|
|
|
|
color_t res = gradient(0, canvasback, 0, min(1.8/(1+d), 1.), 1);
|
|
|
|
if(d > 3) res |= 0x1000000;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
case 'P': {
|
2019-12-23 19:52:25 +00:00
|
|
|
cell *s = currentmap->gamestart()->move(0);
|
2021-07-31 09:55:27 +00:00
|
|
|
if(exhaustive_distance_appropriate() && !keep_distances_from.count(s))
|
2019-12-23 19:52:25 +00:00
|
|
|
permanent_long_distances(s);
|
|
|
|
int d = celldistance(s, c);
|
2019-12-14 10:54:13 +00:00
|
|
|
color_t res = distcolors[d];
|
2019-11-30 12:27:55 +00:00
|
|
|
if(d > 3) res |= 0x1000000;
|
|
|
|
return res;
|
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'S':
|
|
|
|
if(!hyperbolic) return canvasback;
|
|
|
|
return 0x3F1F0F * fieldpattern::subval(c).second + 0x000080;
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2020-05-31 15:12:31 +00:00
|
|
|
case 'g': {
|
|
|
|
color_t r = canvasback;
|
|
|
|
if(hrand(100) < rwalls) r |= 0x1000000;
|
|
|
|
if(c == cwt.at) r &= 0xFFFFFF;
|
|
|
|
return r;
|
|
|
|
}
|
2019-11-02 10:51:16 +00:00
|
|
|
case 'r': {
|
2020-04-29 13:16:12 +00:00
|
|
|
color_t r = hrand(0xFFFFFF + 1);
|
|
|
|
if(hrand(100) < rwalls) r |= 0x1000000;
|
2020-07-03 13:20:53 +00:00
|
|
|
if(c == cwt.at && rwalls <= 100) r &= 0xFFFFFF;
|
2019-11-02 10:51:16 +00:00
|
|
|
return r;
|
|
|
|
}
|
2021-07-09 12:04:04 +00:00
|
|
|
case 'I': {
|
|
|
|
color_t r = 0xFFD500;
|
|
|
|
if(c->type != (variation == eVariation::dual_subcubes ? 6 : 14)) r |= 0x1000000;
|
|
|
|
return r;
|
|
|
|
}
|
2019-11-02 09:40:47 +00:00
|
|
|
case '^': {
|
|
|
|
int x = c->master->fieldval & 4095;
|
|
|
|
int y = (c->master->fieldval >> 12) & 4095;
|
|
|
|
ignore(x);
|
|
|
|
if(c->master->distance % 3) return 0;
|
2019-12-14 11:05:01 +00:00
|
|
|
if(c->c.spin(bt::updir()) != 1) return 0;
|
2019-11-02 09:40:47 +00:00
|
|
|
// if(c->master->distance % 2 == 0) return 0;
|
|
|
|
if(hrand(100) == 0) return 0;
|
|
|
|
return 0x1000000 | (0xFFFFFF & (0x671349 + y * 0x512369));
|
2019-11-08 14:02:03 +00:00
|
|
|
if(hrand(100) >= 1) return 0;
|
|
|
|
return 0x1000000 | hrand(0x1000000);
|
2019-11-02 09:40:47 +00:00
|
|
|
// if(c->master->distance == 1) return 0x1FF0000;
|
|
|
|
// if(c->master->distance == -1) return 0x100FF00;
|
|
|
|
// return 0;
|
|
|
|
}
|
|
|
|
case '!': {
|
|
|
|
if(c == currentmap->gamestart()) return 0;
|
2019-11-08 14:02:03 +00:00
|
|
|
for(int a=0; a<S7; a++) if(c == currentmap->gamestart()->move(a))
|
|
|
|
{
|
|
|
|
if(among(a,4,5,10,11)) return 0;
|
|
|
|
return colortables['!'][a];
|
|
|
|
}
|
2019-11-02 09:40:47 +00:00
|
|
|
return hrand(0x1000000) | 0x1000000;
|
|
|
|
}
|
|
|
|
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'e':
|
|
|
|
return colortables['e'][emeraldval(c)];
|
|
|
|
case 'a': {
|
|
|
|
color_t col = colortables['a'][land50(c)];
|
|
|
|
if(polara50(c)) col += 0x181818;
|
|
|
|
return col;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'b':
|
|
|
|
return colortables['b'][polara50(c) + 2 * polarb50(c)];
|
|
|
|
case 'z':
|
|
|
|
return colortables['z'][zebra40(c)];
|
|
|
|
case 't': {
|
|
|
|
int fv = zebra40(c);
|
|
|
|
if(fv/4 == 4 || fv/4 == 6 || fv/4 == 5 || fv/4 == 10) fv ^= 2;
|
|
|
|
return colortables['t'][fv];
|
|
|
|
}
|
|
|
|
case 'x':
|
|
|
|
return colortables['x'][zebra3(c)];
|
|
|
|
case 'w':
|
|
|
|
return colortables['w'][randpattern(c, subcanvas) ? 1 : 0];
|
2020-05-08 19:21:01 +00:00
|
|
|
case 'H':
|
|
|
|
return colortables['c'][c->master->c7 == c ? 0 : 1];
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'l':
|
2019-03-12 01:42:18 +00:00
|
|
|
return random_landscape(c, 3, 1, 17, 0x808080);
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'd':
|
2019-03-12 01:42:18 +00:00
|
|
|
return random_landscape(c, 6, 8, 2, 0x101010);
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'h':
|
2019-03-12 01:42:18 +00:00
|
|
|
return random_landscape(c, 6, 4, 4, 0x202020);
|
2018-11-08 15:21:33 +00:00
|
|
|
case 'c':
|
|
|
|
return colortables['c'][chessvalue(c)];
|
|
|
|
case 'F':
|
|
|
|
return colortables['F'][pseudohept(c)];
|
|
|
|
case 'T':
|
|
|
|
return nestcolors[pattern_threecolor(c)];
|
2018-11-10 18:51:06 +00:00
|
|
|
case 'v':
|
|
|
|
return colortables['v'][sevenval(c)];
|
2019-10-06 11:03:35 +00:00
|
|
|
case 'j': {
|
2020-04-29 13:16:12 +00:00
|
|
|
if(c == currentmap->gamestart()) return canvasback;
|
2019-10-06 11:03:35 +00:00
|
|
|
int d = c->master->distance;
|
2020-02-07 17:36:37 +00:00
|
|
|
if(geometry == gNil) d = c->master->zebraval;
|
2020-05-15 09:49:25 +00:00
|
|
|
if(euc::in()) d = euc::get_ispacemap()[c->master][0];
|
2020-04-29 13:16:12 +00:00
|
|
|
if(d % 2 == 0 || d < -5 || d > 5) return hrand(100) < jblock ? 0xFFFFFFFF : canvasback;
|
|
|
|
return hrand(100) < jhole ? canvasback : colortables['j'][(d+5)/2];
|
2019-10-06 11:03:35 +00:00
|
|
|
}
|
2020-02-08 09:50:04 +00:00
|
|
|
case 'J': {
|
2020-04-29 13:16:12 +00:00
|
|
|
if(c == currentmap->gamestart()) return canvasback;
|
2020-02-08 09:50:04 +00:00
|
|
|
int d = c->master->distance;
|
|
|
|
if(geometry == gNil) d = c->master->zebraval;
|
2020-04-29 13:16:12 +00:00
|
|
|
if((d&3) != 2) return hrand(100) < jblock ? 0xFFFFFFFF : canvasback;
|
|
|
|
return hrand(100) < jhole ? canvasback : colortables['j'][(d+10)/4];
|
|
|
|
}
|
|
|
|
case 'G': {
|
|
|
|
color_t r = hrand(0xFFFFFF + 1);
|
|
|
|
if(hrand(100) < rwalls && pseudohept(c) && c != cwt.at) r |= 0x1000000;
|
|
|
|
return r;
|
2020-02-08 09:50:04 +00:00
|
|
|
}
|
2019-01-28 20:43:13 +00:00
|
|
|
case 'f': {
|
2022-10-24 07:39:36 +00:00
|
|
|
return compute_cell_color(c);
|
2019-01-28 20:43:13 +00:00
|
|
|
}
|
2019-09-12 22:32:05 +00:00
|
|
|
case 'k': {
|
|
|
|
/* just keep the old color */
|
|
|
|
return c->landparam;
|
|
|
|
}
|
2020-01-15 17:24:18 +00:00
|
|
|
case 'Z': {
|
2023-03-23 00:34:58 +00:00
|
|
|
if(hat::in()) return hat::hatcolor(c, 6);
|
2020-01-15 17:24:18 +00:00
|
|
|
return nearer_map(c);
|
|
|
|
}
|
2020-01-15 21:12:57 +00:00
|
|
|
case 'Y': {
|
2023-03-23 00:34:58 +00:00
|
|
|
if(hat::in()) return hat::hatcolor(c, 7);
|
2020-01-25 18:24:51 +00:00
|
|
|
return furthest_map(c, 0);
|
|
|
|
}
|
|
|
|
case 'X': {
|
2023-03-23 00:34:58 +00:00
|
|
|
if(hat::in()) return hat::hatcolor(c, 8);
|
2020-01-25 18:24:51 +00:00
|
|
|
return furthest_map(c, 1);
|
|
|
|
}
|
|
|
|
case 'W': {
|
|
|
|
return furthest_map(c, 2);
|
2020-01-15 21:12:57 +00:00
|
|
|
}
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
return canvasback;
|
|
|
|
}
|
|
|
|
|
2019-01-16 23:59:45 +00:00
|
|
|
void showPrePatternP(bool instant) {
|
2018-01-25 22:47:28 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2018-01-25 22:47:28 +00:00
|
|
|
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::init("predesigned patterns");
|
2019-10-06 11:03:21 +00:00
|
|
|
dialog::addItem(WDIM == 3 ? XLAT("empty") : XLAT("single color"), 'g');
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::addItem(XLAT("random colors"), 'r');
|
2019-10-06 11:03:35 +00:00
|
|
|
|
|
|
|
if(WDIM == 2) dialog::addItem(XLAT("distance from origin"), 'M');
|
|
|
|
dialog::addSelItem(XLAT("rainbow by distance"), "binary/Solv", 'j');
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2019-07-21 20:56:10 +00:00
|
|
|
if(geometry_supports_cdata()) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addItem(XLAT("rainbow landscape"), 'l');
|
|
|
|
dialog::addItem(XLAT("dark rainbow landscape"), 'd');
|
|
|
|
}
|
|
|
|
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::addItem(XLAT("football"), 'F');
|
2018-08-20 09:59:43 +00:00
|
|
|
if(geosupport_chessboard())
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addItem(XLAT("chessboard"), 'c');
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
dialog::addItem(XLAT("nice coloring"), 'T');
|
|
|
|
|
2019-12-14 10:26:03 +00:00
|
|
|
if(euc::in(2,6))
|
2018-11-10 18:51:06 +00:00
|
|
|
dialog::addItem(XLAT("seven-coloring"), 'v');
|
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
if(stdhyperbolic) {
|
|
|
|
dialog::addSelItem(XLAT("emerald pattern"), "emerald", 'e');
|
|
|
|
dialog::addSelItem(XLAT("four elements"), "palace", 'b');
|
|
|
|
dialog::addSelItem(XLAT("eight domains"), "palace", 'a');
|
2017-12-22 00:25:05 +00:00
|
|
|
dialog::addSelItem(XLAT("zebra pattern"), "zebra", 'z');
|
|
|
|
dialog::addSelItem(XLAT("four triangles"), "zebra", 't');
|
|
|
|
dialog::addSelItem(XLAT("three stripes"), "zebra", 'x');
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2017-12-22 00:25:05 +00:00
|
|
|
|
|
|
|
if(a4)
|
|
|
|
dialog::addSelItem(XLAT("zebra pattern"), "coloring", 'z');
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
dialog::addSelItem(XLAT("random black-and-white"), "current", 'w');
|
|
|
|
|
2019-02-17 17:33:15 +00:00
|
|
|
#if CAP_FIELD
|
2022-12-08 18:38:06 +00:00
|
|
|
if(!msphere) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addSelItem(XLAT("field pattern C"), "field", 'C');
|
|
|
|
dialog::addSelItem(XLAT("field pattern D"), "field", 'D');
|
|
|
|
dialog::addSelItem(XLAT("field pattern N"), "field", 'N');
|
|
|
|
dialog::addSelItem(XLAT("field pattern S"), "field", 'S');
|
|
|
|
}
|
2019-02-17 17:33:15 +00:00
|
|
|
#endif
|
2018-08-19 11:47:51 +00:00
|
|
|
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in())
|
2018-08-19 11:47:51 +00:00
|
|
|
dialog::addSelItem(XLAT("Archimedean"), "Archimedean", 'A');
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-08-22 10:14:39 +00:00
|
|
|
if(cryst)
|
2018-11-30 15:31:55 +00:00
|
|
|
dialog::addSelItem(XLAT("Crystal coordinates"), "Crystal", 'K');
|
2019-10-12 11:12:15 +00:00
|
|
|
|
|
|
|
if(cryst || geometry == gSpace344) {
|
|
|
|
dialog::addSelItem(XLAT("Cage"), "Crystal", '#');
|
|
|
|
dialog::addSelItem(XLAT("Hyperplanes"), "Crystal", '=');
|
|
|
|
dialog::addSelItem(XLAT("Honeycomb"), "Crystal", 'O');
|
2019-10-25 10:47:03 +00:00
|
|
|
dialog::addSelItem(XLAT("Diagonal"), "Crystal", '/');
|
|
|
|
}
|
|
|
|
if(nil) {
|
|
|
|
dialog::addSelItem(XLAT("Penrose staircase"), "Nil", '/');
|
2019-10-12 11:12:15 +00:00
|
|
|
}
|
2020-01-15 17:24:18 +00:00
|
|
|
|
2022-05-21 11:08:42 +00:00
|
|
|
if(closed_manifold) {
|
2020-01-15 17:24:18 +00:00
|
|
|
dialog::addSelItem(XLAT("nearer end"), "bounded", 'Z');
|
2020-01-15 21:12:57 +00:00
|
|
|
dialog::addSelItem(XLAT("furthest from start"), "bounded", 'Y');
|
|
|
|
}
|
2018-11-30 15:31:55 +00:00
|
|
|
|
2023-03-23 00:34:58 +00:00
|
|
|
if(hat::in()) {
|
|
|
|
dialog::addSelItem(XLAT("hat in cluster"), "hat", 'Z');
|
|
|
|
dialog::addSelItem(XLAT("hat clusters"), "hat", 'Y');
|
|
|
|
dialog::addSelItem(XLAT("hat superclusters"), "hat", 'X');
|
|
|
|
}
|
|
|
|
|
2021-07-31 13:10:30 +00:00
|
|
|
dialog::addSelItem(XLAT("types"), "types", 'A');
|
2022-10-06 11:35:56 +00:00
|
|
|
dialog::addSelItem(XLAT("types (mark reverse)"), "types", 'R');
|
2018-08-20 13:49:17 +00:00
|
|
|
dialog::addSelItem(XLAT("sides"), "sides", 'B');
|
|
|
|
|
2019-02-08 15:52:44 +00:00
|
|
|
if(!ISMOBILE)
|
|
|
|
dialog::addSelItem(XLAT("formula"), "formula", 'f');
|
2019-01-28 20:43:13 +00:00
|
|
|
|
2018-04-21 15:57:30 +00:00
|
|
|
dialog::addBreak(100);
|
2019-02-09 12:20:25 +00:00
|
|
|
|
2023-02-18 17:43:30 +00:00
|
|
|
dialog::addBoolItem_action(XLAT("display the inner walls"), innerwalls, '1');
|
2020-07-12 18:53:45 +00:00
|
|
|
|
|
|
|
if(geosupport_threecolor() == 2) {
|
|
|
|
dialog::addBoolItem(XLAT("display only hexagons"), (whichShape == '6'), '6');
|
|
|
|
dialog::addBoolItem(XLAT("display only heptagons"), (whichShape == '7'), '7');
|
|
|
|
dialog::addBoolItem(XLAT("display the triheptagonal grid"), (whichShape == '8'), '8');
|
|
|
|
}
|
|
|
|
|
|
|
|
if(geosupport_chessboard()) {
|
|
|
|
dialog::addBoolItem(XLAT("display only chessboard white"), (whichShape == '6'), '6');
|
|
|
|
dialog::addBoolItem(XLAT("display only chessboard black"), (whichShape == '7'), '7');
|
|
|
|
}
|
|
|
|
|
2019-02-09 12:20:25 +00:00
|
|
|
dialog::addBoolItem(XLAT("display full floors"), (whichShape == '9'), '9');
|
2023-02-18 17:43:30 +00:00
|
|
|
dialog::addBoolItem(XLAT("display small floors"), (whichShape == '5'), '5');
|
|
|
|
|
2022-10-06 10:26:17 +00:00
|
|
|
add_edit(global_boundary_ratio);
|
2020-01-28 15:42:07 +00:00
|
|
|
dialog::addSelItem(XLAT("floor type"), XLATN(winf[canvas_default_wall].name), 'i');
|
2019-02-09 12:20:25 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
dialog::addItem(XLAT("line patterns"), 'L');
|
2019-02-09 11:23:20 +00:00
|
|
|
|
|
|
|
dialog::addBack();
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::display();
|
|
|
|
|
2019-01-16 23:59:45 +00:00
|
|
|
keyhandler = [instant] (int sym, int uni) {
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::handleNavigation(sym, uni);
|
2017-12-19 13:35:34 +00:00
|
|
|
if(uni == 'g') {
|
|
|
|
static unsigned c = (canvasback << 8) | 0xFF;
|
2017-12-19 15:40:24 +00:00
|
|
|
static unsigned canvasbacks[] = {
|
|
|
|
6, 0xFFFFFFFF, 0x101010FF, 0x404040FF, 0x808080FF, 0x800000FF, unsigned(linf[laCanvas].color >> 2) << 8
|
2017-12-19 13:35:34 +00:00
|
|
|
};
|
|
|
|
dialog::openColorDialog(c, canvasbacks);
|
2019-01-16 23:59:45 +00:00
|
|
|
dialog::reaction = [instant] () {
|
|
|
|
if(instant) {
|
|
|
|
stop_game();
|
|
|
|
whichCanvas = 'g';
|
|
|
|
canvasback = c >> 8;
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2019-01-16 23:59:45 +00:00
|
|
|
start_game();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
whichCanvas = 'g';
|
|
|
|
canvasback = c >> 8;
|
|
|
|
}
|
2017-12-19 13:35:34 +00:00
|
|
|
};
|
2020-05-31 15:12:31 +00:00
|
|
|
dialog::reaction_final = edit_rwalls;
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2018-04-21 15:57:30 +00:00
|
|
|
else if(uni == 'i') {
|
2020-01-28 15:42:07 +00:00
|
|
|
if(instant)
|
2019-01-16 23:59:45 +00:00
|
|
|
stop_game();
|
2020-01-28 15:42:07 +00:00
|
|
|
|
|
|
|
vector<eWall> choices = {waNone, waInvisibleFloor, waChasm, waEternalFire, waStone, waSea, waBarrier, waCavewall};
|
|
|
|
for(int i=0; i<isize(choices); i++)
|
|
|
|
if(canvas_default_wall == choices[i]) {
|
|
|
|
canvas_default_wall = choices[(i+1) % isize(choices)];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if(instant) {
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2019-01-16 23:59:45 +00:00
|
|
|
start_game();
|
|
|
|
}
|
2018-04-21 15:57:30 +00:00
|
|
|
}
|
2019-01-28 20:43:13 +00:00
|
|
|
|
2023-02-18 17:43:30 +00:00
|
|
|
else if((uni >= '2' && uni <= '9')) {
|
2019-02-09 12:20:25 +00:00
|
|
|
if(whichShape == uni) whichShape = 0;
|
|
|
|
else whichShape = uni;
|
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
else if(uni == 'L')
|
2019-02-09 12:20:25 +00:00
|
|
|
pushScreen(linepatterns::showMenu);
|
|
|
|
|
2019-01-28 20:43:13 +00:00
|
|
|
else if(uni == 'f') {
|
2019-11-15 12:38:26 +00:00
|
|
|
string s = XLAT(
|
2019-01-28 20:43:13 +00:00
|
|
|
"This lets you specify the color pattern as a function of the cell. "
|
|
|
|
"Available parameters:\n\n"
|
|
|
|
"x, y, z (hyperboloid/sphere/plane coordinates in non-crystal geometries)\n"
|
|
|
|
"ex, ey, ez (in Euclidean geometries)\n"
|
|
|
|
"x0, x1, x2... (crystal geometry only)\n"
|
2019-11-15 12:38:26 +00:00
|
|
|
"0 is black, 1 is white, rgb(1,0,0) is red, ifp(p-2,1,0) is blue (p=1 for red, 2 for green, 3 for blue).");
|
|
|
|
|
|
|
|
if(MDIM == 4) s += XLAT(
|
|
|
|
"w (fourth coordinate)\n"
|
|
|
|
"wallif(condition, color)\n"
|
2019-01-28 20:43:13 +00:00
|
|
|
);
|
2019-11-15 12:38:26 +00:00
|
|
|
|
2020-03-05 21:35:41 +00:00
|
|
|
s += XLAT("see compute_map_function in pattern2.cpp for more\n");
|
2021-02-01 12:42:12 +00:00
|
|
|
|
2019-11-15 12:38:26 +00:00
|
|
|
dialog::edit_string(color_formula, "formula", s);
|
2021-02-01 12:42:12 +00:00
|
|
|
|
|
|
|
dialog::extra_options = dialog::parser_help;
|
2019-01-28 20:43:13 +00:00
|
|
|
dialog::reaction_final = [instant] () {
|
|
|
|
if(instant) stop_game();
|
|
|
|
whichCanvas = 'f';
|
|
|
|
if(instant) {
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2019-01-28 20:43:13 +00:00
|
|
|
start_game();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-10-26 13:42:20 +00:00
|
|
|
else if((uni >= 'a' && uni <= 'z') || (uni >= 'A' && uni <= 'Z') || among(uni, '#', '=', '/')) {
|
2019-01-16 23:59:45 +00:00
|
|
|
if(instant)
|
|
|
|
stop_game();
|
2017-12-09 02:48:30 +00:00
|
|
|
whichCanvas = uni;
|
|
|
|
subcanvas = rand();
|
2019-01-16 23:59:45 +00:00
|
|
|
if(instant) {
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2019-01-16 23:59:45 +00:00
|
|
|
start_game();
|
|
|
|
}
|
2020-05-31 15:12:31 +00:00
|
|
|
if(uni == 'r')
|
|
|
|
edit_rwalls();
|
2017-12-22 00:25:05 +00:00
|
|
|
if(uni == 'x' || uni == 'z' || uni == 't')
|
|
|
|
whichPattern = PAT_ZEBRA, subpattern_flags = SPF_SYM0123 | SPF_ROT;
|
|
|
|
if(uni == 'e')
|
|
|
|
whichPattern = PAT_EMERALD, subpattern_flags = SPF_SYM0123 | SPF_ROT;
|
|
|
|
if(uni == 'b')
|
|
|
|
whichPattern = PAT_PALACE, subpattern_flags = SPF_SYM0123 | SPF_ROT;
|
|
|
|
if(uni == 'z' && a46)
|
|
|
|
whichPattern = PAT_COLORING, subpattern_flags = SPF_CHANGEROT | SPF_SYM0123;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
else if(doexiton(sym, uni)) popScreen();
|
|
|
|
};
|
|
|
|
}
|
2019-01-16 23:59:45 +00:00
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX void showPrePattern() { showPrePatternP(true); }
|
2019-09-05 10:00:55 +00:00
|
|
|
EX void showPrePatternNoninstant() { showPrePatternP(false); }
|
2019-01-16 23:59:45 +00:00
|
|
|
|
2018-08-21 22:14:31 +00:00
|
|
|
|
|
|
|
#if CAP_TEXTURE
|
|
|
|
#define REMAP_TEXTURE texture::config.remap()
|
|
|
|
#else
|
2018-09-05 13:30:18 +00:00
|
|
|
#define REMAP_TEXTURE (void)0
|
2018-08-21 22:14:31 +00:00
|
|
|
#endif
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void showPattern() {
|
2017-12-09 02:48:30 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
{
|
2018-08-28 02:05:32 +00:00
|
|
|
dynamicval<bool> dc(displaycodes, whichPattern);
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
dialog::init();
|
2018-08-28 02:05:32 +00:00
|
|
|
|
|
|
|
dialog::addBoolItem(XLAT("cell types"), (whichPattern == PAT_TYPES), PAT_TYPES);
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
if(stdhyperbolic || a4)
|
|
|
|
dialog::addBoolItem(XLAT("Zebra Pattern"), (whichPattern == PAT_ZEBRA), PAT_ZEBRA);
|
|
|
|
|
|
|
|
if(stdhyperbolic)
|
|
|
|
dialog::addBoolItem(XLAT("Emerald Pattern"), (whichPattern == PAT_EMERALD), PAT_EMERALD);
|
|
|
|
else if(a38)
|
|
|
|
dialog::addBoolItem(XLAT("broken Emerald Pattern"), (whichPattern == PAT_EMERALD), PAT_EMERALD);
|
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if(stdhyperbolic || meuclid)
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("Palace Pattern"), (whichPattern == PAT_PALACE), PAT_PALACE);
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2018-08-20 09:59:43 +00:00
|
|
|
if(geosupport_chessboard())
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("chessboard"), (whichPattern == PAT_CHESS), PAT_CHESS);
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2018-08-20 13:24:44 +00:00
|
|
|
if(geosupport_threecolor() == 2)
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("coloring"), (whichPattern == PAT_COLORING), PAT_COLORING);
|
|
|
|
|
2018-08-20 13:24:44 +00:00
|
|
|
if(sphere_narcm)
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("siblings"), (whichPattern == PAT_SIBLING), PAT_SIBLING);
|
2018-08-19 13:15:47 +00:00
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid)
|
2018-08-30 17:17:40 +00:00
|
|
|
dialog::addBoolItem(XLAT("torus"), (whichPattern == PAT_FIELD), PAT_FIELD);
|
2022-12-08 18:38:06 +00:00
|
|
|
else if(msphere)
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("single cells"), (whichPattern == PAT_FIELD), PAT_FIELD);
|
2017-12-09 02:48:30 +00:00
|
|
|
else
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("field pattern"), (whichPattern == PAT_FIELD), PAT_FIELD);
|
2018-08-02 20:25:08 +00:00
|
|
|
|
|
|
|
dialog::addBoolItem(XLAT("single type"), (whichPattern == PAT_SINGLETYPE), PAT_SINGLETYPE);
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2018-08-30 17:14:04 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
|
2017-12-09 07:06:41 +00:00
|
|
|
if(
|
|
|
|
(whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) ||
|
|
|
|
(whichPattern == PAT_PALACE && stdhyperbolic) ||
|
|
|
|
(whichPattern == PAT_ZEBRA && stdhyperbolic) ||
|
2022-12-08 18:38:06 +00:00
|
|
|
(whichPattern == PAT_SIBLING && msphere) ||
|
2017-12-09 07:06:41 +00:00
|
|
|
(whichPattern == PAT_ZEBRA && a457)) {
|
|
|
|
dialog::addBoolItem(XLAT("rotational symmetry"), subpattern_flags & SPF_ROT, '0');
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if((meuclid && whichPattern == PAT_COLORING) ||
|
2017-12-14 01:53:29 +00:00
|
|
|
(a38 && whichPattern == PAT_COLORING) ||
|
2018-08-28 15:17:34 +00:00
|
|
|
(a4 && !BITRUNCATED && whichPattern == PAT_COLORING && !a46))
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("edit all three colors"), subpattern_flags & SPF_ROT, '0');
|
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid && whichPattern == PAT_COLORING)
|
2017-12-22 00:25:05 +00:00
|
|
|
dialog::addBoolItem(XLAT("rotate the color groups"), subpattern_flags & SPF_CHANGEROT, '4');
|
|
|
|
|
|
|
|
if(a46 && whichPattern == PAT_COLORING)
|
2017-12-09 07:06:41 +00:00
|
|
|
dialog::addBoolItem(XLAT("rotate the color groups"), subpattern_flags & SPF_CHANGEROT, '4');
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a46 && whichPattern == PAT_COLORING && BITRUNCATED)
|
2018-01-06 21:34:03 +00:00
|
|
|
dialog::addBoolItem(XLAT("edit both bitrunc colors"), subpattern_flags & SPF_TWOCOL, '5');
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
if(
|
|
|
|
(whichPattern == PAT_EMERALD && (stdhyperbolic || a38)) ||
|
|
|
|
(whichPattern == PAT_PALACE && stdhyperbolic) ||
|
|
|
|
(whichPattern == PAT_ZEBRA && stdhyperbolic) ||
|
|
|
|
(whichPattern == PAT_COLORING && a46) ||
|
|
|
|
(whichPattern == PAT_ZEBRA && a457)
|
|
|
|
) {
|
|
|
|
dialog::addBoolItem(XLAT("symmetry 0-1"), subpattern_flags & SPF_SYM01, '1');
|
|
|
|
dialog::addBoolItem(XLAT("symmetry 0-2"), subpattern_flags & SPF_SYM02, '2');
|
|
|
|
dialog::addBoolItem(XLAT("symmetry 0-3"), subpattern_flags & SPF_SYM03, '3');
|
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid && among(whichPattern, PAT_COLORING, PAT_TYPES) && !arcm::in())
|
2018-08-19 13:15:47 +00:00
|
|
|
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
|
|
|
|
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_ARCM
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in() && arcm::current.have_symmetry && whichPattern == PAT_TYPES)
|
2017-12-09 19:02:56 +00:00
|
|
|
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2018-08-02 20:25:08 +00:00
|
|
|
if(whichPattern == PAT_SINGLETYPE) {
|
|
|
|
dialog::addBoolItem(XLAT("odd/even"), subpattern_flags & SPF_TWOCOL, '5');
|
|
|
|
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
|
|
|
|
}
|
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
if(meuclid && among(whichPattern, PAT_COLORING, 0))
|
2017-12-21 10:36:07 +00:00
|
|
|
dialog::addBoolItem(XLAT("full symmetry"), subpattern_flags & SPF_FULLSYM, '!');
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a38 && PURE && whichPattern == PAT_TYPES) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
|
|
|
|
}
|
|
|
|
|
2018-08-28 15:17:34 +00:00
|
|
|
if(a46 && PURE && whichPattern == PAT_COLORING) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("extra symmetries"), subpattern_flags & SPF_EXTRASYM, '=');
|
|
|
|
}
|
|
|
|
|
2019-12-14 10:42:16 +00:00
|
|
|
if((whichPattern == PAT_COLORING) || (whichPattern == PAT_TYPES && arcm::in())) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("alternate coloring"), subpattern_flags & SPF_ALTERNATE, '\'');
|
2018-08-30 17:17:40 +00:00
|
|
|
dialog::addBoolItem(XLAT("football"), subpattern_flags & SPF_FOOTBALL, '*');
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2018-01-04 19:05:34 +00:00
|
|
|
if(a38 && whichPattern == PAT_COLORING)
|
|
|
|
dialog::addBoolItem(XLAT("Docks pattern"), subpattern_flags & SPF_DOCKS, '@');
|
2018-08-30 17:14:04 +00:00
|
|
|
|
2019-12-14 10:42:16 +00:00
|
|
|
if(whichPattern && (IRREGULAR || GOLDBERG || arcm::in()))
|
2018-08-30 17:14:04 +00:00
|
|
|
dialog::addBoolItem(XLAT("remove complete classification"), subpattern_flags & SPF_NO_SUBCODES, '#');
|
|
|
|
|
|
|
|
dialog::addBreak(50);
|
2018-01-04 19:05:34 +00:00
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("display pattern codes (full)"), displaycodes, 'd');
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
if(!needConfirmation()) dialog::addItem(XLAT("predesigned patterns"), 'r');
|
|
|
|
else dialog::addInfo("start a new game to use predesigned patterns");
|
|
|
|
|
|
|
|
dialog::display();
|
|
|
|
|
|
|
|
keyhandler = [] (int sym, int uni) {
|
|
|
|
dialog::handleNavigation(sym, uni);
|
2017-12-14 01:53:29 +00:00
|
|
|
|
2018-08-28 02:05:32 +00:00
|
|
|
if(among(uni, PAT_EMERALD, PAT_PALACE, PAT_ZEBRA, PAT_DOWN, PAT_FIELD, PAT_COLORING, PAT_SIBLING, PAT_CHESS, PAT_SINGLETYPE, PAT_TYPES)) {
|
|
|
|
if(whichPattern == uni) whichPattern = PAT_NONE;
|
|
|
|
else whichPattern = ePattern(uni);
|
2018-02-03 13:31:17 +00:00
|
|
|
#if CAP_EDIT
|
2017-12-09 02:48:30 +00:00
|
|
|
mapeditor::modelcell.clear();
|
2018-02-03 13:31:17 +00:00
|
|
|
#endif
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
|
2018-08-20 00:04:49 +00:00
|
|
|
else if(uni >= '0' && uni <= '5') {
|
2017-12-09 07:06:41 +00:00
|
|
|
subpattern_flags ^= (1 << (uni - '0'));
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2018-08-20 00:04:49 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
2018-08-20 00:04:49 +00:00
|
|
|
else if(uni == '=') {
|
2017-12-09 19:02:56 +00:00
|
|
|
subpattern_flags ^= SPF_EXTRASYM;
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2018-08-20 00:04:49 +00:00
|
|
|
}
|
2017-12-09 19:02:56 +00:00
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
else if(uni == '\'') {
|
|
|
|
subpattern_flags ^= SPF_ALTERNATE;
|
2018-08-20 13:24:44 +00:00
|
|
|
// subpattern_flags &= ~SPF_FOOTBALL;
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
else if(uni == '*') {
|
|
|
|
subpattern_flags ^= SPF_FOOTBALL;
|
2018-08-20 13:24:44 +00:00
|
|
|
// subpattern_flags &= ~SPF_ALTERNATE;
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
|
|
|
|
2017-12-21 10:36:07 +00:00
|
|
|
else if(uni == '!') {
|
|
|
|
subpattern_flags ^= SPF_FULLSYM;
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2017-12-21 10:36:07 +00:00
|
|
|
}
|
|
|
|
|
2018-02-26 12:17:56 +00:00
|
|
|
else if(uni == '@') {
|
|
|
|
subpattern_flags ^= SPF_DOCKS;
|
2018-08-21 22:14:31 +00:00
|
|
|
REMAP_TEXTURE;
|
2018-02-26 12:17:56 +00:00
|
|
|
}
|
|
|
|
|
2018-08-30 17:14:04 +00:00
|
|
|
else if(uni == '#') {
|
|
|
|
subpattern_flags ^= SPF_NO_SUBCODES;
|
|
|
|
REMAP_TEXTURE;
|
|
|
|
}
|
|
|
|
|
2017-12-19 13:35:34 +00:00
|
|
|
else if(uni == 'd') displaycodes = !displaycodes;
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
else if(uni == 'r' && !needConfirmation()) pushScreen(showPrePattern);
|
|
|
|
|
|
|
|
else if(doexiton(sym, uni)) popScreen();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX bool compatible(cpatterntype oldp, cpatterntype newp) {
|
2017-12-19 13:35:34 +00:00
|
|
|
// larges are not incompatible between themselves
|
2017-12-22 00:46:34 +00:00
|
|
|
if(newp == cpLarge || newp == cpZebra)
|
2017-12-19 13:35:34 +00:00
|
|
|
return false;
|
|
|
|
// other cps are compatible with themselves
|
|
|
|
if(newp == oldp) return true;
|
|
|
|
// Single can be upgraded to everything
|
|
|
|
if(oldp == cpSingle) return true;
|
|
|
|
// Football can be upgraded to Three colors
|
|
|
|
if(oldp == cpFootball) return newp == cpThree;
|
|
|
|
// incompatible otherwise
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct changeable_pattern_geometry {
|
|
|
|
eGeometry geo;
|
2018-08-28 15:17:34 +00:00
|
|
|
eVariation var;
|
2018-08-28 02:05:32 +00:00
|
|
|
ePattern whichPattern;
|
2017-12-19 13:35:34 +00:00
|
|
|
int subpattern_flags;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct changeable_pattern {
|
|
|
|
string name;
|
|
|
|
vector<changeable_pattern_geometry> geometries;
|
|
|
|
};
|
|
|
|
|
|
|
|
vector<changeable_pattern> cpatterns = {
|
|
|
|
{"football", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{gSphere, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{gEuclid, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM},
|
|
|
|
{gOctagon, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{gOctagon, eVariation::pure, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM},
|
|
|
|
{g45, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{g46, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM},
|
|
|
|
{g47, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{gSmallSphere, eVariation::bitruncated, PAT_TYPES, 0},
|
|
|
|
{gSmallSphere, eVariation::pure, PAT_COLORING, SPF_FOOTBALL | SPF_EXTRASYM},
|
|
|
|
{gTinySphere, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM},
|
|
|
|
{gEuclidSquare, eVariation::bitruncated, PAT_TYPES, SPF_EXTRASYM},
|
2017-12-19 13:35:34 +00:00
|
|
|
}},
|
|
|
|
{"three colors", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gEuclid, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM},
|
|
|
|
{gSmallSphere, eVariation::bitruncated, PAT_COLORING, 0},
|
|
|
|
{gSmallSphere, eVariation::bitruncated, PAT_COLORING, SPF_ALTERNATE},
|
|
|
|
{gSmallSphere, eVariation::pure, PAT_COLORING, 0},
|
|
|
|
{gOctagon, eVariation::bitruncated, PAT_COLORING, SPF_ROT | SPF_EXTRASYM},
|
|
|
|
{gOctagon, eVariation::bitruncated, PAT_COLORING, SPF_ROT | SPF_EXTRASYM | SPF_ALTERNATE},
|
|
|
|
{gOctagon, eVariation::pure, PAT_COLORING, 0},
|
|
|
|
{gEuclidSquare, eVariation::bitruncated, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM},
|
|
|
|
{gEuclidSquare, eVariation::bitruncated, PAT_COLORING, SPF_SYM03 | SPF_EXTRASYM | SPF_ALTERNATE},
|
|
|
|
{g46, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123},
|
|
|
|
{g46, eVariation::bitruncated, PAT_COLORING, SPF_SYM0123 | SPF_EXTRASYM | SPF_ALTERNATE}
|
2017-12-19 13:35:34 +00:00
|
|
|
}},
|
|
|
|
{"chessboard", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gEuclidSquare, eVariation::pure, PAT_CHESS, SPF_EXTRASYM},
|
|
|
|
{g45, eVariation::pure, PAT_CHESS, 0},
|
|
|
|
{g46, eVariation::pure, PAT_CHESS, 0},
|
|
|
|
{g47, eVariation::pure, PAT_CHESS, 0}
|
2017-12-19 13:35:34 +00:00
|
|
|
}},
|
|
|
|
{"single type", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{gSphere, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{gEuclid, eVariation::bitruncated, PAT_SINGLETYPE, 0},
|
|
|
|
{gOctagon, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{g45, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{g46, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{g47, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{gSmallSphere, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{gTinySphere, eVariation::pure, PAT_SINGLETYPE, 0},
|
|
|
|
{gEuclidSquare, eVariation::pure, PAT_SINGLETYPE, 0},
|
2018-08-02 20:25:08 +00:00
|
|
|
}},
|
|
|
|
{"single type+symmetry", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gSphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gEuclid, eVariation::bitruncated, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gOctagon, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{g45, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{g46, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{g47, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gSmallSphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gTinySphere, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
|
|
|
{gEuclidSquare, eVariation::pure, PAT_SINGLETYPE, SPF_EXTRASYM},
|
2018-08-02 20:25:08 +00:00
|
|
|
}},
|
|
|
|
{"odd/even", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::bitruncated, PAT_SINGLETYPE, SPF_TWOCOL},
|
|
|
|
{gSphere, eVariation::bitruncated, PAT_SINGLETYPE, SPF_TWOCOL},
|
|
|
|
{g45, eVariation::pure, PAT_SINGLETYPE, SPF_TWOCOL},
|
|
|
|
{g47, eVariation::pure, PAT_SINGLETYPE, SPF_TWOCOL}
|
2017-12-19 13:35:34 +00:00
|
|
|
}},
|
|
|
|
{"large picture", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::bitruncated, PAT_PALACE, SPF_SYM0123},
|
|
|
|
{gNormal, eVariation::pure, PAT_PALACE, SPF_SYM0123},
|
|
|
|
{gSphere, eVariation::bitruncated, PAT_FIELD, 0},
|
|
|
|
{gSphere, eVariation::pure, PAT_FIELD, 0},
|
|
|
|
{gElliptic, eVariation::bitruncated, PAT_FIELD, 0},
|
|
|
|
{gElliptic, eVariation::pure, PAT_FIELD, 0},
|
|
|
|
{gEuclid, eVariation::bitruncated, PAT_PALACE, 0}
|
2017-12-22 00:46:34 +00:00
|
|
|
}},
|
|
|
|
{"periodic patterns", {
|
2018-08-28 15:17:34 +00:00
|
|
|
{gNormal, eVariation::bitruncated, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT},
|
|
|
|
{gNormal, eVariation::bitruncated, PAT_PALACE, SPF_SYM0123 | SPF_ROT},
|
|
|
|
{gNormal, eVariation::bitruncated, PAT_EMERALD, SPF_SYM0123 | SPF_ROT},
|
|
|
|
{g46, eVariation::pure, PAT_COLORING, SPF_SYM0123 | SPF_CHANGEROT},
|
|
|
|
{g45, eVariation::pure, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT},
|
|
|
|
{g47, eVariation::pure, PAT_ZEBRA, SPF_SYM0123 | SPF_ROT},
|
|
|
|
{gOctagon, eVariation::pure, PAT_COLORING, SPF_DOCKS},
|
2017-12-19 13:35:34 +00:00
|
|
|
}}
|
|
|
|
};
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX cpatterntype cgroup, old_cgroup;
|
2017-12-19 13:35:34 +00:00
|
|
|
|
|
|
|
void showChangeablePatterns() {
|
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
|
|
|
{
|
|
|
|
dynamicval<bool> dc(displaycodes, true);
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
|
|
|
dialog::init();
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(cpatterns); i++) {
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBoolItem(XLAT(cpatterns[i].name), cgroup == i, '0'+i);
|
2017-12-21 10:36:07 +00:00
|
|
|
#if CAP_TEXTURE
|
2018-03-17 20:12:46 +00:00
|
|
|
if(texture::config.tstate == texture::tsActive && !compatible(texture::cgroup, (cpatterntype) i))
|
2017-12-19 15:40:24 +00:00
|
|
|
dialog::lastItem().value = XLAT("BAD");
|
2017-12-21 10:36:07 +00:00
|
|
|
#endif
|
2017-12-19 15:40:24 +00:00
|
|
|
}
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::addBreak(100);
|
2018-06-22 12:47:24 +00:00
|
|
|
if(cgroup != cpUnknown && cgroup < isize(cpatterns))
|
|
|
|
for(int j=0; j<isize(cpatterns[cgroup].geometries); j++) {
|
2017-12-19 13:35:34 +00:00
|
|
|
auto &g = cpatterns[cgroup].geometries[j];
|
2019-02-06 15:34:22 +00:00
|
|
|
string s = XLAT(ginf[g.geo].tiling_name);
|
2018-08-28 15:17:34 +00:00
|
|
|
s += bitruncnames[int(g.var)];
|
2017-12-19 13:35:34 +00:00
|
|
|
if(g.subpattern_flags & SPF_ALTERNATE) s += " (alt)";
|
2018-01-04 19:05:34 +00:00
|
|
|
if(g.subpattern_flags & SPF_DOCKS) s += " (Docks)";
|
2017-12-22 00:46:34 +00:00
|
|
|
if(cgroup == cpZebra) {
|
|
|
|
if(g.whichPattern == PAT_PALACE) s += " (Palace)";
|
|
|
|
else if(g.whichPattern == PAT_EMERALD) s += " (Emerald)";
|
|
|
|
else s += " (Zebra)";
|
|
|
|
}
|
2018-08-28 15:17:34 +00:00
|
|
|
dialog::addBoolItem(s, geometry == g.geo && variation == g.var && whichPattern == g.whichPattern && subpattern_flags == g.subpattern_flags, 'a'+j);
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2022-12-08 18:38:06 +00:00
|
|
|
bool have_goldberg = (S3 == 3 && among(cgroup, cpFootball, cpThree) && !meuclid);
|
|
|
|
bool have_variations = (among(cgroup, cpSingle, cpSingleSym) && !meuclid);
|
2018-08-28 15:17:34 +00:00
|
|
|
if(!(S7&1) && BITRUNCATED) have_goldberg = false; // always start from pure
|
2018-04-10 03:12:40 +00:00
|
|
|
if(have_goldberg) {
|
2018-08-28 15:17:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("Goldberg"), GOLDBERG, 'G');
|
2018-04-10 03:12:40 +00:00
|
|
|
dialog::lastItem().value = gp::operation_name();
|
|
|
|
}
|
2018-08-02 20:26:07 +00:00
|
|
|
if(have_variations) {
|
2018-08-28 15:17:34 +00:00
|
|
|
dialog::addBoolItem(XLAT("variations"), GOLDBERG, 'G');
|
2018-08-02 20:26:07 +00:00
|
|
|
dialog::lastItem().value = gp::operation_name();
|
|
|
|
}
|
2018-04-10 03:12:40 +00:00
|
|
|
else dialog::addBreak(100);
|
2018-04-22 09:13:13 +00:00
|
|
|
dialog::addItem(XLAT("more tuning"), 'r');
|
2018-06-12 22:11:26 +00:00
|
|
|
dialog::addBack();
|
2017-12-19 13:35:34 +00:00
|
|
|
dialog::display();
|
|
|
|
|
2018-08-02 20:26:07 +00:00
|
|
|
keyhandler = [have_goldberg, have_variations] (int sym, int uni) {
|
2017-12-19 13:35:34 +00:00
|
|
|
if(uni == 'r')
|
|
|
|
pushScreen(showPattern);
|
2018-06-22 12:47:24 +00:00
|
|
|
else if(uni >= '0' && uni < '0' + isize(cpatterns))
|
2017-12-19 13:35:34 +00:00
|
|
|
cgroup = cpatterntype(uni - '0');
|
2018-06-22 12:47:24 +00:00
|
|
|
else if(cgroup != cpUnknown && uni >= 'a' && uni < 'a' + isize(cpatterns[cgroup].geometries)) {
|
2017-12-19 13:35:34 +00:00
|
|
|
auto &g = cpatterns[cgroup].geometries[uni - 'a'];
|
2018-08-28 15:17:34 +00:00
|
|
|
if(g.geo != geometry) set_geometry(g.geo);
|
|
|
|
if(g.var != variation) set_variation(g.var);
|
2017-12-19 13:35:34 +00:00
|
|
|
whichPattern = g.whichPattern;
|
|
|
|
subpattern_flags = g.subpattern_flags;
|
2018-08-20 00:04:49 +00:00
|
|
|
bool not_restarted = game_active;
|
|
|
|
start_game();
|
2018-08-21 22:14:31 +00:00
|
|
|
if(not_restarted) REMAP_TEXTURE;
|
2017-12-19 13:35:34 +00:00
|
|
|
}
|
2019-02-17 17:28:20 +00:00
|
|
|
#if CAP_GP
|
2018-08-02 20:26:07 +00:00
|
|
|
else if(uni == 'G' && (have_goldberg || have_variations))
|
2018-08-20 00:04:49 +00:00
|
|
|
gp::configure();
|
2019-02-17 17:28:20 +00:00
|
|
|
#endif
|
2017-12-19 13:35:34 +00:00
|
|
|
else if(doexiton(sym, uni))
|
|
|
|
popScreen();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void computeCgroup() {
|
2020-06-03 09:46:50 +00:00
|
|
|
if(fake::in()) { FPIU(computeCgroup()); return; }
|
2017-12-19 13:35:34 +00:00
|
|
|
cgroup = cpUnknown;
|
2018-08-20 13:24:44 +00:00
|
|
|
if(whichPattern == PAT_SINGLETYPE) {
|
|
|
|
cgroup = cpSingle;
|
|
|
|
return;
|
|
|
|
}
|
2019-12-14 10:42:16 +00:00
|
|
|
if(arcm::in()) {
|
2018-08-30 00:11:43 +00:00
|
|
|
if(whichPattern == PAT_COLORING && geosupport_threecolor()) {
|
2018-08-20 13:24:44 +00:00
|
|
|
if(subpattern_flags & SPF_FOOTBALL) cgroup = cpFootball;
|
|
|
|
else cgroup = cpThree;
|
|
|
|
}
|
2018-08-30 00:11:43 +00:00
|
|
|
else if(whichPattern == PAT_CHESS && geosupport_chessboard()) cgroup = cpChess;
|
|
|
|
else if(whichPattern == PAT_TYPES && (subpattern_flags & SPF_FOOTBALL) && geosupport_football()) cgroup = cpFootball;
|
2018-08-20 13:24:44 +00:00
|
|
|
return;
|
|
|
|
}
|
2018-06-22 12:47:24 +00:00
|
|
|
for(int i=0; i<isize(cpatterns); i++)
|
|
|
|
for(int j=0; j<isize(cpatterns[i].geometries); j++) {
|
2017-12-19 13:35:34 +00:00
|
|
|
auto &g = cpatterns[i].geometries[j];
|
2018-08-28 15:17:34 +00:00
|
|
|
eVariation xvar = variation;
|
|
|
|
if(GOLDBERG && gp_threecolor()) xvar = eVariation::pure;
|
|
|
|
if(geometry == g.geo && xvar == g.var && whichPattern == g.whichPattern && subpattern_flags == g.subpattern_flags)
|
2017-12-19 13:35:34 +00:00
|
|
|
cgroup = cpatterntype(i);
|
|
|
|
}
|
|
|
|
old_cgroup = cgroup;
|
|
|
|
}
|
|
|
|
|
2019-08-09 21:08:42 +00:00
|
|
|
EX void pushChangeablePatterns() {
|
2017-12-19 13:35:34 +00:00
|
|
|
pushScreen(showChangeablePatterns);
|
|
|
|
computeCgroup();
|
2018-08-30 17:14:04 +00:00
|
|
|
}
|
2019-08-09 21:08:42 +00:00
|
|
|
EX }
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-09-06 06:17:02 +00:00
|
|
|
EX bool is_master(cell *c) {
|
2022-08-23 19:42:53 +00:00
|
|
|
if(euc::in(2)) return pseudohept(c);
|
2018-04-10 15:06:04 +00:00
|
|
|
else return c->master->c7 == c;
|
|
|
|
}
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX namespace linepatterns {
|
|
|
|
|
|
|
|
#if HDR
|
|
|
|
struct linepattern {
|
2019-12-14 12:33:25 +00:00
|
|
|
string lpname;
|
2019-08-10 08:57:14 +00:00
|
|
|
color_t color;
|
|
|
|
ld multiplier;
|
2019-12-14 12:33:25 +00:00
|
|
|
function<bool()> is_available;
|
|
|
|
function<void(linepattern*)> renderer;
|
|
|
|
|
|
|
|
linepattern(string _lpname, color_t _color, function<bool()> _av, function<void(linepattern*)> _rend) :
|
|
|
|
lpname(_lpname), color(_color), multiplier(1), is_available(_av), renderer(_rend) {}
|
2019-08-10 08:57:14 +00:00
|
|
|
};
|
|
|
|
#endif
|
2019-12-14 12:33:25 +00:00
|
|
|
|
|
|
|
bool always_available() { return true; }
|
|
|
|
bool stdhyp_only() { return stdhyperbolic; }
|
2022-09-14 16:10:49 +00:00
|
|
|
bool needs_valence_3() { return valence() == 3 && geosupport_football(); }
|
2022-09-14 15:59:21 +00:00
|
|
|
bool horo_only() { return horo_ok() && mod_allowed(); }
|
2022-09-14 16:10:49 +00:00
|
|
|
bool if_pseudohept() { return geosupport_football(); }
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t lessalpha(color_t col, int m) {
|
2017-12-09 02:48:30 +00:00
|
|
|
part(col, 0) /= m;
|
|
|
|
return col;
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t lessalphaif(color_t col, bool b) {
|
2017-12-09 02:48:30 +00:00
|
|
|
return b?lessalpha(col, 4):col;
|
|
|
|
}
|
|
|
|
|
2018-09-04 17:53:42 +00:00
|
|
|
color_t lessalphaif(color_t col, bool b1, bool b2) {
|
2017-12-09 02:48:30 +00:00
|
|
|
if(b1) col = lessalpha(col, 2);
|
|
|
|
if(b2) col = lessalpha(col, 2);
|
|
|
|
return col;
|
|
|
|
}
|
2018-04-10 15:57:33 +00:00
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
void gridlinef(const shiftmatrix& V1, const hyperpoint& h1, const shiftmatrix& V2, const hyperpoint& h2, color_t col, int par) {
|
2018-05-01 17:36:09 +00:00
|
|
|
if(!elliptic)
|
2019-05-21 23:13:02 +00:00
|
|
|
gridline(V1, h1, V2, h2, col, par);
|
2018-05-01 17:36:09 +00:00
|
|
|
else {
|
2020-07-27 16:49:04 +00:00
|
|
|
hyperpoint vh1 = V1.T * h1;
|
|
|
|
hyperpoint vh2 = unshift(V2, V1.shift) * h2;
|
2019-05-21 23:13:02 +00:00
|
|
|
ld cros = vh1[0]*vh2[0] + vh1[1]*vh2[1] + vh1[2]*vh2[2];
|
2018-05-01 17:36:09 +00:00
|
|
|
if(cros > 0)
|
2019-05-21 23:13:02 +00:00
|
|
|
gridline(V1, h1, V2, h2, col, par),
|
|
|
|
gridline(V1, -1*h1, V2, -1*h2, col, par);
|
2018-05-01 17:36:09 +00:00
|
|
|
else
|
2019-05-21 23:13:02 +00:00
|
|
|
gridline(V1, h1, V2, -1*h2, col, par),
|
|
|
|
gridline(V1, -1*h1, V2, h2, col, par);
|
2018-05-01 17:36:09 +00:00
|
|
|
}
|
|
|
|
}
|
2019-05-21 23:13:02 +00:00
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
void gridlinef(const shiftmatrix& V, const hyperpoint& h1, const hyperpoint& h2, color_t col, int par) { gridlinef(V, h1, V, h2, col, par); }
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
#define ALLCELLS(R) \
|
|
|
|
[] (linepattern *lp) { auto& col = lp->color; for(auto& p: current_display->all_drawn_copies) for(auto& V: p.second) { cell *c = p.first; R } }
|
|
|
|
|
|
|
|
#define ATCENTER(T) \
|
2020-07-27 16:49:04 +00:00
|
|
|
[] (linepattern *lp) { auto& col = lp->color; shiftmatrix V = gmatrix[cwt.at]; T}
|
2021-04-23 18:29:41 +00:00
|
|
|
|
|
|
|
/** for functions drawing edges, ensure that the edge is drawn only in one direction */
|
|
|
|
template<class T> bool way(T*c, int i) {
|
|
|
|
T* c2 = c->move(i);
|
|
|
|
if(c == c2)
|
|
|
|
return i <= c->c.spin(i);
|
|
|
|
return c2 > c;
|
|
|
|
}
|
|
|
|
|
2023-03-24 23:36:20 +00:00
|
|
|
EX ld dual_length = 0;
|
|
|
|
EX ld dual_angle = 0;
|
|
|
|
|
2023-03-28 09:11:46 +00:00
|
|
|
hyperpoint dualpoint(cell *c) {
|
2023-03-25 08:25:16 +00:00
|
|
|
if(!aperiodic) return tile_center();
|
2023-03-28 09:11:46 +00:00
|
|
|
if(dual_length && c->master->c7 == c)
|
|
|
|
return MirrorX * xspinpush0(dual_angle * degree, dual_length);
|
2023-03-24 23:36:20 +00:00
|
|
|
if(dual_length)
|
|
|
|
return xspinpush0(dual_angle * degree, dual_length);
|
|
|
|
return tile_center();
|
|
|
|
}
|
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
linepattern patDual("dual grid", 0xFFFFFF00, always_available,
|
|
|
|
ALLCELLS(
|
2021-04-23 18:29:41 +00:00
|
|
|
forCellIdEx(c2, i, c) if(way(c,i)) {
|
2022-09-14 16:01:59 +00:00
|
|
|
if((patTriTree.color & 0xFF) || (PURE && (patTree.color & 0xFF))) {
|
|
|
|
cell *parent = ts::right_parent(c, curr_dist);
|
|
|
|
if(c2 == parent) continue;
|
|
|
|
cell *parent2 = ts::right_parent(c2, curr_dist);
|
|
|
|
if(c == parent2) continue;
|
|
|
|
}
|
|
|
|
if((patTriRings.color & 0xFF)) {
|
|
|
|
if(curr_dist(c2) == curr_dist(c)) continue;
|
|
|
|
}
|
2023-03-28 09:11:46 +00:00
|
|
|
gridlinef(V, dualpoint(c), V * currentmap->adj(c, i), dualpoint(c->cmove(i)), col, 2 + vid.linequality);
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-09-14 16:10:49 +00:00
|
|
|
linepattern patHepta("Gray Raider moves", 0xC0C0C000, if_pseudohept,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2021-04-23 18:29:41 +00:00
|
|
|
forCellIdEx(c2, i, c) if(way(c,i)) if(pseudohept(c) == pseudohept(c2))
|
2019-12-14 12:33:25 +00:00
|
|
|
gridlinef(V, C0, V * currentmap->adj(c, i), C0, col, 2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-09-14 16:10:49 +00:00
|
|
|
linepattern patRhomb("Green Raider moves", 0x00FF0000, if_pseudohept,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2021-04-23 18:29:41 +00:00
|
|
|
forCellIdEx(c2, i, c) if(way(c,i)) if(pseudohept(c) != pseudohept(c2))
|
2019-12-14 12:33:25 +00:00
|
|
|
gridlinef(V, C0, V * currentmap->adj(c, i), C0, col, 2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-09-14 15:59:21 +00:00
|
|
|
linepattern patTrihepta("triheptagonal tessellation", 0x0000C000, needs_valence_3,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(pseudohept(c)) for(int t=0; t<c->type; t++)
|
|
|
|
gridline(V, get_warp_corner(c, t%c->type),
|
|
|
|
get_warp_corner(c, (t+1)%c->type),
|
|
|
|
col, 1 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-09-14 15:59:21 +00:00
|
|
|
linepattern patNormal("normal tessellation", 0x0000C000, always_available,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
for(int t=0; t<c->type; t++)
|
2021-04-23 18:29:41 +00:00
|
|
|
if(c->move(t) && way(c,t))
|
2019-12-14 12:33:25 +00:00
|
|
|
gridline(V, get_corner_position(c, t),
|
|
|
|
get_corner_position(c, (t+1)%c->type),
|
|
|
|
col, 1 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
linepattern patBigTriangles("big triangular grid", 0x00606000, always_available,
|
|
|
|
ALLCELLS(
|
2022-12-08 18:38:06 +00:00
|
|
|
if(is_master(c) && !meuclid) for(int i=0; i<S7; i++)
|
2018-08-17 22:46:45 +00:00
|
|
|
if(c->master->move(i) && c->master->move(i) < c->master) {
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, C0, xspinpush0(-TAU*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-09-14 15:59:21 +00:00
|
|
|
linepattern patBigRings("big triangles: rings", 0x00606000, [] { return standard_tiling() && S3 == 3 && mod_allowed(); },
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2022-12-08 18:38:06 +00:00
|
|
|
if(is_master(c) && !meuclid) for(int i=0; i<S7; i++)
|
2021-04-23 18:29:41 +00:00
|
|
|
if(c->master->move(i) && way(c->master, i) && c->master->move(i)->dm4 == c->master->dm4)
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, C0, xspinpush0(-TAU*i/S7 - master_to_c7_angle(), cgi.tessf), col, 2 + vid.linequality);
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2022-08-26 10:42:07 +00:00
|
|
|
EX ld tree_starter = 0.25;
|
|
|
|
|
2022-09-14 15:59:21 +00:00
|
|
|
EX linepattern patTree = linepattern("underlying tree", 0x00d0d000, [] { return trees_known() && mod_allowed(); },
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(is_master(c)) {
|
2020-01-28 10:18:17 +00:00
|
|
|
int dir = updir(c->master);
|
|
|
|
if(dir == -1) continue;
|
2021-07-29 12:39:33 +00:00
|
|
|
hyperpoint end = currentmap->master_relative(c, true) * currentmap->adj(c->master, dir) * C0;
|
2022-08-26 10:42:07 +00:00
|
|
|
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
|
2021-07-29 12:39:33 +00:00
|
|
|
gridlinef(V, start, V, end, col, 2 + vid.linequality);
|
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
2022-09-14 15:59:21 +00:00
|
|
|
linepattern patAltTree("circle/horocycle tree", 0xd000d000, horo_only,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2020-01-28 10:18:17 +00:00
|
|
|
if(is_master(c)) {
|
|
|
|
int dir = updir_alt(c->master);
|
|
|
|
if(dir == -1) continue;
|
2021-07-29 12:39:33 +00:00
|
|
|
hyperpoint end = currentmap->master_relative(c, true) * currentmap->adj(c->master, dir) * C0;
|
2022-08-26 10:42:07 +00:00
|
|
|
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
|
2021-07-29 12:39:33 +00:00
|
|
|
gridlinef(V, start, V, end, col, 2 + vid.linequality);
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
linepattern patHeawood("seven-colorable torus", 0x40FF4000, [] { return euc::in(2, 6); },
|
|
|
|
ALLCELLS(
|
|
|
|
if(c != c->master->c7 || patterns::sevenval(c)) break;
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(-1, +3))), col, 3 + vid.linequality);
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(-3, +2))), col, 3 + vid.linequality);
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(-2, -1))), col, 3 + vid.linequality);
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(+1, -3))), col, 3 + vid.linequality);
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(+3, -2))), col, 3 + vid.linequality);
|
|
|
|
gridline(V, C0, tC0(euc::eumove(gp::loc(+2, +1))), col, 3 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2020-03-29 13:23:18 +00:00
|
|
|
EX linepattern patZebraTriangles = linepattern("zebra triangles", 0x40FF4000, stdhyp_only,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(zebra40(c) / 4 == 10) {
|
|
|
|
bool all = true;
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix tri[3];
|
2019-12-14 12:33:25 +00:00
|
|
|
for(int i=0; i<3; i++)
|
|
|
|
tri[i] = V * currentmap->adj(c, i*2);
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
if(all) for(int i=0; i<3; i++)
|
|
|
|
gridline(tri[i], C0, tri[(i+1)%3], C0, col, 3 + vid.linequality);
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2020-03-29 13:23:18 +00:00
|
|
|
EX linepattern patZebraLines = linepattern("zebra lines", 0xFF000000, stdhyp_only,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(!pseudohept(c)) for(int i=0; i<c->type; i+=2) {
|
|
|
|
cell *c2 = createMov(c, i);
|
|
|
|
int fv1 = zebra40(c);
|
|
|
|
if(fv1/4 == 4 || fv1/4 == 6 || fv1/4 == 5 || fv1/4 == 10) fv1 ^= 2;
|
|
|
|
int fv2 = zebra40(c2);
|
|
|
|
if(fv2/4 == 4 || fv2/4 == 6 || fv2/4 == 5 || fv2/4 == 10) fv2 ^= 2;
|
|
|
|
if((fv1&1) == (fv2&1)) continue;
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2022-12-08 18:38:06 +00:00
|
|
|
double x = cgi.hexhexdist / 2; // msphere?.3651:meuclid?.2611:.2849;
|
2019-12-14 12:33:25 +00:00
|
|
|
|
|
|
|
gridlinef(V, ddspin(c,i,-M_PI/S3) * xpush0(x),
|
|
|
|
ddspin(c,i,M_PI/S3) * xpush0(x),
|
|
|
|
col, 1 + vid.linequality);
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2020-09-16 16:48:45 +00:00
|
|
|
linepattern patGoldbergTree("Goldberg tree", 0x8438A400, [] { return GOLDBERG || INVERSE; },
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(c->master->c7 != c)
|
|
|
|
gridlinef(V, C0, V*currentmap->adj(c,0), C0,
|
|
|
|
darkena(backcolor ^ 0xFFFFFF, 0, col),
|
|
|
|
2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
linepattern patIrregularMaster("irregular master", 0x8438A400, [] { return IRREGULAR; },
|
|
|
|
ALLCELLS(
|
|
|
|
if(c->master->c7 != c) if(gmatrix.count(c->master->c7))
|
2021-07-09 08:09:31 +00:00
|
|
|
gridlinef(V, C0, V*currentmap->master_relative(c, true), C0,
|
2019-12-14 12:33:25 +00:00
|
|
|
darkena(backcolor ^ 0xFFFFFF, 0, col),
|
|
|
|
2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
linepattern patVine("vineyard pattern", 0x8438A400, stdhyp_only,
|
|
|
|
ALLCELLS(
|
|
|
|
int p = emeraldval(c);
|
|
|
|
double hdist = hdist0(cgi.heptmove[0] * cgi.heptmove[2] * C0);
|
|
|
|
if(pseudohept(c) && (p/4 == 10 || p/4 == 8))
|
|
|
|
for(int i=0; i<S7; i++) if(c->move(i) && emeraldval(c->move(i)) == p-4) {
|
|
|
|
gridlinef(V, C0, tC0(cgi.heptmove[i]), col, 2 + vid.linequality);
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, C0, xspinpush0(-i * TAU / S7, -hdist/2), col, 2 + vid.linequality);
|
2019-12-14 12:33:25 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
linepattern patPalacelike("firewall lines", 0xFF400000, stdhyp_only,
|
|
|
|
ALLCELLS(
|
|
|
|
if(pseudohept(c)) for(int i=0; i<7; i++)
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
|
|
|
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
2019-12-14 12:33:25 +00:00
|
|
|
col, 1 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
2020-03-29 13:23:18 +00:00
|
|
|
EX linepattern patPalace = linepattern("firewall lines: Palace", 0xFFD50000, stdhyp_only,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
bool a = polarb50(c);
|
|
|
|
if(pseudohept(c)) for(int i=0; i<7; i++) {
|
|
|
|
cell *c1 = createMov(c, (i+3) % 7);
|
|
|
|
cell *c2 = createMov(c, (i+4) % 7);
|
|
|
|
if(polarb50(c1) != a && polarb50(c2) != a)
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
|
|
|
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
2019-12-14 12:33:25 +00:00
|
|
|
col, 1 + vid.linequality);
|
2018-04-10 15:57:33 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
2020-09-16 16:48:45 +00:00
|
|
|
linepattern patGoldbergSep("Goldberg", 0xFFFF0000, [] { return GOLDBERG || INVERSE; },
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2021-04-23 18:29:41 +00:00
|
|
|
forCellIdEx(c2, i, c) if(c2->master != c->master && way(c, i))
|
2019-12-14 12:33:25 +00:00
|
|
|
gridlinef(V, C0, V*currentmap->adj(c, i), C0,
|
|
|
|
col,
|
|
|
|
1 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
linepattern patArcm("Archimedean", 0xFFFF0000, [] { return arcm::in(); },
|
|
|
|
ALLCELLS(
|
2021-04-23 18:29:41 +00:00
|
|
|
if(!pseudohept(c)) forCellIdEx(c2, i, c) if(way(c, i) && !pseudohept(c2))
|
2019-12-14 12:33:25 +00:00
|
|
|
gridlinef(V, C0, V*currentmap->adj(c, i), C0,
|
|
|
|
col,
|
|
|
|
1 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
linepattern patPower("firewall lines: Power", 0xFFFF0000, stdhyp_only,
|
|
|
|
ALLCELLS(
|
|
|
|
int a = emeraldval(c);
|
|
|
|
if(pseudohept(c) && a/4 == 8) for(int i=0; i<7; i++) {
|
|
|
|
heptagon *h1 = c->master->modmove(i+1);
|
|
|
|
heptagon *h2 = c->master->modmove(i-1);
|
|
|
|
if(!h1 || !h2) continue;
|
|
|
|
if(emeraldval(h1->c7)/4 == 8 && emeraldval(h2->c7)/4 == 8)
|
2022-11-12 21:38:45 +00:00
|
|
|
gridlinef(V, ddspin(c,i,A_PI*5/7) * xpush0(cgi.tessf/2),
|
|
|
|
ddspin(c,i,A_PI*9/7) * xpush0(cgi.tessf/2),
|
2019-12-14 12:33:25 +00:00
|
|
|
col, 1 + vid.linequality);
|
2018-07-20 00:59:51 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
2022-09-14 15:59:21 +00:00
|
|
|
linepattern patHorocycles("horocycles", 0xd060d000, horo_only,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
if(c->master->alt) {
|
|
|
|
int d = celldistAlt(c);
|
|
|
|
forCellIdEx(c2, i, c) if(c2 > c && c2->master->alt && celldistAlt(c2) == d)
|
|
|
|
gridlinef(V, C0, V * currentmap->adj(c, i), C0,
|
|
|
|
darkena(backcolor ^ 0xFFFFFF, 0, col),
|
|
|
|
2 + vid.linequality);
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2023-03-16 13:41:00 +00:00
|
|
|
|
|
|
|
bool trees_legal() {
|
|
|
|
return (bt::in() || trees_known()) && distances_legal(nullptr);
|
|
|
|
}
|
|
|
|
|
|
|
|
EX linepattern patTriRings = linepattern("lines of equal distance", 0xFFFFFF00, trees_legal,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
2022-09-14 16:01:26 +00:00
|
|
|
if(valence() == 3) {
|
|
|
|
forCellIdEx(c2, i, c) {
|
|
|
|
if(c2 > c) if(curr_dist(c) == curr_dist(c2))
|
|
|
|
gridlinef(V, C0, V * currentmap->adj(c, i), C0, col, 2 + vid.linequality);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dynamicval<int> dmar(mine_adjacency_rule, 1);
|
|
|
|
int d = curr_dist(c);
|
|
|
|
for(auto p: adj_minefield_cells_full(c))
|
|
|
|
if(p.c < c && d == curr_dist(p.c))
|
|
|
|
gridlinef(V, C0, V, tC0(p.T), col, 2 + vid.linequality);
|
2019-12-14 12:33:25 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2023-03-16 13:41:00 +00:00
|
|
|
EX linepattern patTriTree = linepattern("tessellation tree", 0xFFFFFF00, trees_legal,
|
2019-12-14 12:33:25 +00:00
|
|
|
ALLCELLS(
|
|
|
|
cell *parent = ts::right_parent(c, curr_dist);
|
2022-08-26 10:42:07 +00:00
|
|
|
if(gmatrix.count(parent)) {
|
|
|
|
hyperpoint end = tC0(currentmap->adj(c, neighborId(c, parent)));
|
|
|
|
hyperpoint start = normalize(C0 + tree_starter * (end - C0));
|
|
|
|
gridlinef(V, start, V, end, col, 2 + vid.linequality);
|
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2023-03-16 13:41:00 +00:00
|
|
|
EX linepattern patTriWalls = linepattern("tessellation walls", 0xFF000000, trees_legal,
|
|
|
|
ALLCELLS(
|
|
|
|
if(gmatrix.count(c)) {
|
|
|
|
celldrawer cd;
|
|
|
|
cd.c = c;
|
|
|
|
cd.V = V;
|
|
|
|
for(int t=0; t<c->type; t++) {
|
|
|
|
cell *c1 = c->move(t);
|
|
|
|
if(!c1) continue;
|
|
|
|
if(c1 == ts::right_parent(c, curr_dist)) continue;
|
|
|
|
if(c == ts::right_parent(c1, curr_dist)) continue;
|
|
|
|
cd.draw_grid_edge(t, col, 2 + vid.linequality);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
linepattern patCircles("circles", 0xFFFFFF00, always_available,
|
|
|
|
ATCENTER(
|
|
|
|
for(int i=15; i<=180; i+=15) {
|
|
|
|
for(int j=0; j<360; j+=15) {
|
|
|
|
for(int k=0; k<=15; k++)
|
|
|
|
curvepoint(xspinpush0((j+k) * degree, i * degree));
|
2020-07-27 16:49:04 +00:00
|
|
|
queuecurve(shiftless(Id), col, 0, PPR::LINE).V=V;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
linepattern patRadii("radii", 0xFFFFFF00, always_available,
|
|
|
|
ATCENTER(
|
|
|
|
for(int i=0; i<360; i+=15) {
|
|
|
|
for(int j=0; j<180; j+=15) {
|
|
|
|
for(int k=0; k<=15; k++)
|
|
|
|
curvepoint(xspinpush0(i * degree, (j+k) * degree));
|
2020-07-27 16:49:04 +00:00
|
|
|
queuecurve(shiftless(Id), col, 0, PPR::LINE).V=V;
|
2018-04-10 18:27:01 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2023-03-16 13:45:11 +00:00
|
|
|
EX ld mp_ori = 0;
|
|
|
|
EX ld meridian_max = 180._deg;
|
|
|
|
EX ld meridian_count = 12;
|
|
|
|
EX ld meridian_length = 90._deg;
|
|
|
|
EX ld meridian_prec = 12;
|
|
|
|
EX ld meridian_prec2 = 15;
|
2022-05-17 07:41:10 +00:00
|
|
|
EX linepattern patMeridians = linepattern("meridians", 0xFFFFFF00, always_available,
|
2019-12-14 12:33:25 +00:00
|
|
|
ATCENTER(
|
2023-03-16 13:45:11 +00:00
|
|
|
for(int j=0; j<meridian_count; j++) {
|
|
|
|
ld mj = meridian_max * (j * 2. / meridian_count - 1);
|
|
|
|
for(int i=0; i<meridian_prec; i++) {
|
|
|
|
for(int k=0; k<=meridian_prec2; k++) {
|
|
|
|
ld mi = i + k * 1. / meridian_prec2;
|
|
|
|
mi = mi * 2. / meridian_prec - 1;
|
|
|
|
mi *= meridian_length;
|
|
|
|
curvepoint(spin(mp_ori * degree) * xpush(mj) * ypush0(mi));
|
|
|
|
}
|
2020-07-27 16:49:04 +00:00
|
|
|
queuecurve(V, col, 0, PPR::LINE).V=V;
|
2018-08-17 11:29:00 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
);
|
2021-09-30 11:23:35 +00:00
|
|
|
EX ld parallel_count = 6;
|
2022-11-12 21:38:45 +00:00
|
|
|
EX ld parallel_max = 90._deg;
|
|
|
|
EX ld parallel_length = M_PI;
|
|
|
|
linepattern patParallels("parallels", 0xFFFFFF00, always_available,
|
2019-12-14 12:33:25 +00:00
|
|
|
ATCENTER(
|
2021-09-30 11:23:35 +00:00
|
|
|
for(int i=-int(parallel_count); i<=parallel_count; i ++) {
|
|
|
|
ld phi = i * parallel_max / parallel_count;
|
|
|
|
ld xbase = 0;
|
|
|
|
if(!sphere) xbase = asin_auto((inverse(unshift(V)) * C0)[0]);
|
|
|
|
println(hlog, "xbase = ", xbase);
|
2019-12-14 12:33:25 +00:00
|
|
|
for(int j=-180; j<180; j+=15) {
|
|
|
|
for(int k=0; k<=15; k++)
|
2023-03-16 13:45:11 +00:00
|
|
|
curvepoint(spin(mp_ori * degree) * xpush(xbase + (j+k) * degree) * ypush0(phi));
|
2020-07-27 16:49:04 +00:00
|
|
|
queuecurve(V, col, 0, PPR::LINE).V=V;
|
2018-04-10 18:27:01 +00:00
|
|
|
}
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
)
|
|
|
|
);
|
2019-12-27 22:34:41 +00:00
|
|
|
linepattern patSublines("sub-lines", 0xFFFFFF00, arb::in,
|
|
|
|
ALLCELLS(
|
|
|
|
int i = arb::id_of(c->master);
|
|
|
|
auto& sh = arb::current.shapes[i];
|
|
|
|
for(auto p: sh.sublines)
|
|
|
|
gridlinef(V, sh.vertices[p.first], sh.vertices[p.second], col, 2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
2020-05-27 23:50:31 +00:00
|
|
|
|
|
|
|
linepattern patUltra("ultra-connection", 0xFFFF8000, [] { return cgflags & qULTRA; },
|
|
|
|
ALLCELLS(
|
|
|
|
ignore(c);
|
|
|
|
color_t col2 = col;
|
|
|
|
if(col2 == 0xFF)
|
|
|
|
col2 = darkena(c->landparam, 0, 0xFF);
|
|
|
|
for(auto U: cgi.ultra_mirrors)
|
|
|
|
gridlinef(V, C0, V, mid(C0, U*C0), col2, 2 + vid.linequality);
|
|
|
|
)
|
|
|
|
);
|
2019-12-14 12:33:25 +00:00
|
|
|
|
|
|
|
#if HDR
|
2023-03-16 13:41:00 +00:00
|
|
|
extern linepattern patTriTree, patTriRings, patTriWalls, patDual;
|
2019-12-14 12:33:25 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
EX vector<linepattern*> patterns = {
|
|
|
|
&patDual, &patHepta, &patRhomb, &patTrihepta, &patNormal, &patBigTriangles,
|
|
|
|
|
|
|
|
&patTree, &patAltTree, &patZebraTriangles, &patZebraLines,
|
|
|
|
&patVine, &patPalacelike, &patPalace, &patPower, &patHorocycles,
|
2023-03-16 13:41:00 +00:00
|
|
|
&patTriRings, &patTriTree, &patTriWalls,
|
2019-12-14 12:33:25 +00:00
|
|
|
&patGoldbergTree, &patIrregularMaster, &patGoldbergSep, &patHeawood, &patArcm,
|
2020-05-27 23:50:31 +00:00
|
|
|
&patCircles, &patRadii, &patMeridians, &patParallels, &patSublines, &patUltra
|
2019-12-14 12:33:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
EX void clearAll() {
|
|
|
|
for(auto& lp: patterns) lp->color &= ~255;
|
|
|
|
}
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX ld width = 1;
|
2018-11-08 21:34:23 +00:00
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX void drawAll() {
|
2018-11-08 21:34:23 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
if(!width) return;
|
2017-12-09 02:48:30 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
vid.linewidth *= width;
|
2018-11-08 21:21:46 +00:00
|
|
|
|
2019-12-14 12:33:25 +00:00
|
|
|
for(auto lp: patterns) if((lp->color & 255) && lp->multiplier && lp->is_available()) {
|
|
|
|
vid.linewidth *= lp->multiplier;
|
|
|
|
lp->renderer(lp);
|
|
|
|
vid.linewidth /= lp->multiplier;
|
2018-11-08 21:21:46 +00:00
|
|
|
}
|
2019-12-14 12:33:25 +00:00
|
|
|
|
2018-11-08 21:34:23 +00:00
|
|
|
vid.linewidth /= width;
|
2017-12-09 02:48:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int numpat = 0;
|
|
|
|
|
2019-07-03 02:57:35 +00:00
|
|
|
bool indiv;
|
|
|
|
|
2019-08-10 08:57:14 +00:00
|
|
|
EX void showMenu() {
|
2017-12-09 02:48:30 +00:00
|
|
|
cmode = sm::SIDE | sm::MAYDARK;
|
2022-07-05 09:51:06 +00:00
|
|
|
gamescreen();
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
dialog::init(XLAT("line patterns"));
|
2018-09-21 19:31:11 +00:00
|
|
|
|
|
|
|
int id = 0;
|
2019-12-14 12:33:25 +00:00
|
|
|
for(auto lp: patterns) {
|
|
|
|
string name = XLAT(lp->lpname);
|
|
|
|
if(lp->is_available()) {
|
|
|
|
if(!indiv) {
|
|
|
|
dialog::addColorItem(name, lp->color, 'a'+(id++));
|
|
|
|
dialog::add_action([lp] () {
|
|
|
|
dialog::openColorDialog(lp->color, NULL);
|
|
|
|
dialog::dialogflags |= sm::MAYDARK | sm::SIDE;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dialog::addSelItem(name, fts(lp->multiplier), 'a'+(id++));
|
|
|
|
dialog::add_action([lp] () { dialog::editNumber(lp->multiplier, 0.001, 10, 0.1, 1, XLAT("line width"), ""), dialog::scaleLog(); });
|
|
|
|
}
|
2019-07-03 02:57:35 +00:00
|
|
|
}
|
|
|
|
else {
|
2019-12-14 12:33:25 +00:00
|
|
|
cheater++;
|
|
|
|
if(lp->is_available()) {
|
|
|
|
dialog::addSelItem(name, XLAT("cheat"), 'a'+(id++));
|
|
|
|
dialog::add_action(enable_cheat);
|
|
|
|
}
|
|
|
|
cheater--;
|
2019-07-03 02:57:35 +00:00
|
|
|
}
|
2018-09-21 19:31:11 +00:00
|
|
|
}
|
2017-12-09 02:48:30 +00:00
|
|
|
|
|
|
|
dialog::addBreak(50);
|
2018-06-12 22:00:01 +00:00
|
|
|
dialog::addBack();
|
2018-11-08 21:34:23 +00:00
|
|
|
|
|
|
|
dialog::addSelItem("line width", fts(width), 'W');
|
|
|
|
dialog::add_action([] () {
|
2020-04-29 13:18:43 +00:00
|
|
|
dialog::editNumber(width, 0, 10, 0.1, 1, XLAT("line width"), "");
|
2018-11-08 21:34:23 +00:00
|
|
|
});
|
2019-07-03 02:57:35 +00:00
|
|
|
|
2022-08-26 10:42:07 +00:00
|
|
|
add_edit(tree_starter);
|
|
|
|
|
2019-07-03 02:57:35 +00:00
|
|
|
dialog::addBoolItem_action("edit widths individually", indiv, 'I');
|
2020-01-25 23:48:56 +00:00
|
|
|
|
|
|
|
if(GDIM == 3)
|
|
|
|
dialog::addBoolItem_action("fat edges", fat_edges, 'F');
|
|
|
|
|
2017-12-09 02:48:30 +00:00
|
|
|
dialog::addBreak(50);
|
|
|
|
dialog::addInfo("change the alpha parameter to show the lines");
|
|
|
|
|
|
|
|
dialog::display();
|
|
|
|
}
|
2017-12-19 13:35:34 +00:00
|
|
|
|
2020-02-23 01:51:27 +00:00
|
|
|
}
|
2017-12-09 07:06:41 +00:00
|
|
|
|
|
|
|
int val46(cell *c) {
|
|
|
|
patterns::patterninfo si;
|
2017-12-09 19:02:56 +00:00
|
|
|
patterns::val46(c, si, 0, 0);
|
2017-12-09 07:06:41 +00:00
|
|
|
return si.id;
|
|
|
|
}
|
|
|
|
|
2018-07-19 22:04:23 +00:00
|
|
|
#if CAP_COMMANDLINE
|
|
|
|
|
|
|
|
int read_pattern_args() {
|
|
|
|
using namespace arg;
|
|
|
|
if(argis("-pattern")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift();
|
|
|
|
const char *c = argcs();
|
|
|
|
using namespace patterns;
|
|
|
|
subpattern_flags = 0;
|
2018-08-28 02:05:32 +00:00
|
|
|
whichPattern = PAT_NONE;
|
2018-07-19 22:04:23 +00:00
|
|
|
while(*c) {
|
|
|
|
if(*c >= '0' && *c <= '9') subpattern_flags ^= 1 << (*c - '0');
|
|
|
|
else if(*c == '@') subpattern_flags ^= 1 << 10;
|
|
|
|
else if(*c == '-') subpattern_flags ^= 1 << 11;
|
|
|
|
else if(*c == '~') subpattern_flags ^= 1 << 12;
|
2018-08-28 02:05:32 +00:00
|
|
|
else whichPattern = ePattern(*c);
|
2018-07-19 22:04:23 +00:00
|
|
|
c++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-28 20:47:27 +00:00
|
|
|
else if(argis("-wsh")) { start_game(); shift(); patterns::whichShape = args()[0]; }
|
2018-07-19 22:10:10 +00:00
|
|
|
|
2018-07-19 22:04:23 +00:00
|
|
|
else if(argis("-pal")) {
|
|
|
|
PHASEFROM(2); cheat();
|
2018-09-21 19:31:11 +00:00
|
|
|
shift(); string ss = args();
|
|
|
|
shift();
|
|
|
|
for(auto& lp: linepatterns::patterns)
|
2019-12-14 12:33:25 +00:00
|
|
|
if(appears(lp->lpname, ss))
|
|
|
|
lp->color |= argi();
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
else if(argis("-palrgba")) {
|
|
|
|
PHASEFROM(2); cheat();
|
2018-09-21 19:31:11 +00:00
|
|
|
shift(); string ss = args();
|
|
|
|
shift();
|
|
|
|
for(auto& lp: linepatterns::patterns)
|
2019-12-14 12:33:25 +00:00
|
|
|
if(appears(lp->lpname, ss))
|
2021-10-17 07:18:31 +00:00
|
|
|
lp->color = argcolor(32);
|
2018-07-19 22:04:23 +00:00
|
|
|
}
|
|
|
|
|
2020-04-15 14:21:49 +00:00
|
|
|
else if(argis("-fat-edges")) {
|
|
|
|
PHASEFROM(2); shift(); fat_edges = argi();
|
|
|
|
}
|
|
|
|
|
2019-07-03 02:57:35 +00:00
|
|
|
else if(argis("-palw")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
shift(); string ss = args();
|
|
|
|
for(auto& lp: linepatterns::patterns)
|
2019-12-14 12:33:25 +00:00
|
|
|
if(appears(lp->lpname, ss)) {
|
|
|
|
shift_arg_formula(lp->multiplier);
|
2019-07-03 02:57:35 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
println(hlog, "linepattern not found in -palw: ", ss);
|
|
|
|
shift();
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(argis("-palgw")) shift_arg_formula(linepatterns::width);
|
|
|
|
|
2023-03-16 13:45:29 +00:00
|
|
|
else if(argis("-noplayer")) mapeditor::drawplayer = false;
|
|
|
|
else if(argis("-drawplayer")) { shift(); mapeditor::drawplayer = argi(); }
|
2018-11-08 15:21:33 +00:00
|
|
|
else if(argis("-pcol")) {
|
|
|
|
shift();
|
|
|
|
colortable *ct = &(colortables[patterns::whichCanvas]);
|
|
|
|
if(args()[0] > '9') {
|
|
|
|
char c = args()[0];
|
|
|
|
if(c == 't') ct = &nestcolors;
|
|
|
|
else if(c == 'd') ct = &distcolors;
|
|
|
|
else if(c == 'm') ct = &minecolors;
|
2021-10-17 07:18:31 +00:00
|
|
|
else if(c == 'E') { shift(); int d = argi(); shift(); expcolors[d] = argcolor(24); return 0; }
|
2019-08-17 11:51:33 +00:00
|
|
|
else if(c == 'P') {
|
|
|
|
shift(); int d = argi(); shift();
|
2021-10-17 07:18:31 +00:00
|
|
|
color_t h = argcolor(32);
|
2019-08-17 11:51:33 +00:00
|
|
|
if(d >= 0 && d < 7)
|
|
|
|
((color_t*)(&vid.cs.skincolor)) [d] = h;
|
|
|
|
return 0;
|
|
|
|
}
|
2021-10-17 07:05:51 +00:00
|
|
|
else ct = &(colortables[args()[0]]);
|
2018-11-08 15:21:33 +00:00
|
|
|
shift();
|
|
|
|
}
|
|
|
|
int d = argi();
|
2021-10-17 07:05:51 +00:00
|
|
|
ct->allocate(d+1);
|
2021-10-17 07:18:31 +00:00
|
|
|
shift(); (*ct)[d] = argcolor(24);
|
2018-11-08 15:21:33 +00:00
|
|
|
}
|
2018-09-02 13:10:50 +00:00
|
|
|
else if(argis("-canvas")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
stop_game();
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2018-09-02 13:10:50 +00:00
|
|
|
shift();
|
2020-01-28 15:42:07 +00:00
|
|
|
if(args() == "i") canvas_default_wall = waInvisibleFloor;
|
2018-09-02 13:10:50 +00:00
|
|
|
else if(args().size() == 1) patterns::whichCanvas = args()[0];
|
2021-10-17 07:18:31 +00:00
|
|
|
else patterns::canvasback = argcolor(24);
|
2018-09-02 13:10:50 +00:00
|
|
|
stop_game_and_switch_mode(rg::nothing);
|
|
|
|
}
|
2020-04-29 13:16:12 +00:00
|
|
|
else if(argis("-canvas-random")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
stop_game();
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2020-04-29 13:16:12 +00:00
|
|
|
patterns::whichCanvas = 'r';
|
|
|
|
shift(); patterns::rwalls = argi();
|
|
|
|
}
|
2019-11-15 12:38:37 +00:00
|
|
|
else if(argis("-cformula")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
stop_game();
|
2021-04-23 18:09:23 +00:00
|
|
|
enable_canvas();
|
2019-11-15 12:38:37 +00:00
|
|
|
patterns::whichCanvas = 'f';
|
|
|
|
shift(); patterns::color_formula = args();
|
|
|
|
}
|
2019-11-16 00:38:55 +00:00
|
|
|
else if(argis("-innerwall")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
patterns::innerwalls = true;
|
|
|
|
}
|
|
|
|
else if(argis("-noinnerwall")) {
|
|
|
|
PHASEFROM(2);
|
|
|
|
patterns::innerwalls = false;
|
|
|
|
}
|
2018-11-11 10:06:32 +00:00
|
|
|
else if(argis("-d:line"))
|
|
|
|
launch_dialog(linepatterns::showMenu);
|
|
|
|
|
|
|
|
else if(argis("-d:reg"))
|
|
|
|
launch_dialog(patterns::showPrePattern);
|
|
|
|
|
|
|
|
else if(argis("-d:pattern"))
|
|
|
|
launch_dialog(patterns::showPattern);
|
|
|
|
|
2018-07-19 22:04:23 +00:00
|
|
|
else return 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-04-11 18:40:12 +00:00
|
|
|
auto ah_pattern = addHook(hooks_args, 0, read_pattern_args) + addHook(hooks_clearmemory, 100, [] { patterns::computed_nearer_map.clear(); patterns::computed_furthest_map.clear(); });
|
2018-07-19 22:04:23 +00:00
|
|
|
#endif
|
|
|
|
|
2018-06-10 23:58:31 +00:00
|
|
|
}
|