mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-04 21:26:17 +00:00
408 lines
9.0 KiB
C++
408 lines
9.0 KiB
C++
// rules for the fjordvalues of heptagons.
|
|
int fjord_heptagon(int parent, int dir) {
|
|
|
|
// no fjordgen here
|
|
if(parent == 0) return 0;
|
|
|
|
#define RULE(t1,s1,d,t2,s2) \
|
|
if(parent == t1*8+s1 && dir == d) return t2*8+s2;
|
|
|
|
RULE(8,0,3,12,4)
|
|
RULE(8,0,4,12,0)
|
|
RULE(8,0,5,42,0)
|
|
RULE(8,1,3,40,0)
|
|
RULE(8,1,4,12,4)
|
|
RULE(8,1,5,12,0)
|
|
RULE(8,2,3,34,0)
|
|
RULE(8,2,4,40,0)
|
|
RULE(8,2,5,12,4)
|
|
RULE(8,3,3,10,0)
|
|
RULE(8,3,4,34,0)
|
|
RULE(8,3,5,40,0)
|
|
RULE(8,4,3,32,0)
|
|
RULE(8,4,4,10,0)
|
|
RULE(8,4,5,34,0)
|
|
RULE(8,5,3,42,0)
|
|
RULE(8,5,4,32,0)
|
|
RULE(8,5,5,10,0)
|
|
RULE(8,6,3,12,0)
|
|
RULE(8,6,4,42,0)
|
|
RULE(8,6,5,32,0)
|
|
RULE(9,0,3,13,4)
|
|
RULE(9,0,4,13,0)
|
|
RULE(9,0,5,43,0)
|
|
RULE(9,1,3,41,0)
|
|
RULE(9,1,4,13,4)
|
|
RULE(9,1,5,13,0)
|
|
RULE(9,2,3,35,0)
|
|
RULE(9,2,4,41,0)
|
|
RULE(9,2,5,13,4)
|
|
RULE(9,3,3,11,0)
|
|
RULE(9,3,4,35,0)
|
|
RULE(9,3,5,41,0)
|
|
RULE(9,4,3,33,0)
|
|
RULE(9,4,4,11,0)
|
|
RULE(9,4,5,35,0)
|
|
RULE(9,5,3,43,0)
|
|
RULE(9,5,4,33,0)
|
|
RULE(9,5,5,11,0)
|
|
RULE(9,6,3,13,0)
|
|
RULE(9,6,4,43,0)
|
|
RULE(9,6,5,33,0)
|
|
RULE(10,0,3,14,4)
|
|
RULE(10,0,4,14,0)
|
|
RULE(10,0,5,40,3)
|
|
RULE(10,1,3,42,4)
|
|
RULE(10,1,4,14,4)
|
|
RULE(10,1,5,14,0)
|
|
RULE(10,2,3,32,1)
|
|
RULE(10,2,4,42,4)
|
|
RULE(10,2,5,14,4)
|
|
RULE(10,3,3,8,0)
|
|
RULE(10,3,4,32,1)
|
|
RULE(10,3,5,42,4)
|
|
RULE(10,4,3,34,6)
|
|
RULE(10,4,4,8,0)
|
|
RULE(10,4,5,32,1)
|
|
RULE(10,5,3,40,3)
|
|
RULE(10,5,4,34,6)
|
|
RULE(10,5,5,8,0)
|
|
RULE(10,6,3,14,0)
|
|
RULE(10,6,4,40,3)
|
|
RULE(10,6,5,34,6)
|
|
RULE(11,0,3,15,4)
|
|
RULE(11,0,4,15,0)
|
|
RULE(11,0,5,41,3)
|
|
RULE(11,1,3,43,4)
|
|
RULE(11,1,4,15,4)
|
|
RULE(11,1,5,15,0)
|
|
RULE(11,2,3,33,1)
|
|
RULE(11,2,4,43,4)
|
|
RULE(11,2,5,15,4)
|
|
RULE(11,3,3,9,0)
|
|
RULE(11,3,4,33,1)
|
|
RULE(11,3,5,43,4)
|
|
RULE(11,4,3,35,6)
|
|
RULE(11,4,4,9,0)
|
|
RULE(11,4,5,33,1)
|
|
RULE(11,5,3,41,3)
|
|
RULE(11,5,4,35,6)
|
|
RULE(11,5,5,9,0)
|
|
RULE(11,6,3,15,0)
|
|
RULE(11,6,4,41,3)
|
|
RULE(11,6,5,35,6)
|
|
RULE(12,0,3,8,4)
|
|
RULE(12,0,4,40,1)
|
|
RULE(12,0,5,14,2)
|
|
RULE(12,1,3,12,6)
|
|
RULE(12,1,4,8,4)
|
|
RULE(12,1,5,40,1)
|
|
RULE(12,2,0,14,2)
|
|
RULE(12,2,1,42,6)
|
|
RULE(12,2,2,8,3)
|
|
RULE(12,2,3,12,5)
|
|
RULE(12,2,4,12,6)
|
|
RULE(12,2,5,8,4)
|
|
RULE(12,2,6,40,1)
|
|
RULE(12,3,3,8,3)
|
|
RULE(12,3,4,12,5)
|
|
RULE(12,3,5,12,6)
|
|
RULE(12,4,3,42,6)
|
|
RULE(12,4,4,8,3)
|
|
RULE(12,4,5,12,5)
|
|
RULE(12,5,3,14,2)
|
|
RULE(12,5,4,42,6)
|
|
RULE(12,5,5,8,3)
|
|
RULE(12,6,3,40,1)
|
|
RULE(12,6,4,14,2)
|
|
RULE(12,6,5,42,6)
|
|
RULE(13,0,3,9,4)
|
|
RULE(13,0,4,41,1)
|
|
RULE(13,0,5,15,2)
|
|
RULE(13,1,3,13,6)
|
|
RULE(13,1,4,9,4)
|
|
RULE(13,1,5,41,1)
|
|
RULE(13,2,3,13,5)
|
|
RULE(13,2,4,13,6)
|
|
RULE(13,2,5,9,4)
|
|
RULE(13,3,3,9,3)
|
|
RULE(13,3,4,13,5)
|
|
RULE(13,3,5,13,6)
|
|
RULE(13,4,3,43,6)
|
|
RULE(13,4,4,9,3)
|
|
RULE(13,4,5,13,5)
|
|
RULE(13,5,3,15,2)
|
|
RULE(13,5,4,43,6)
|
|
RULE(13,5,5,9,3)
|
|
RULE(13,6,3,41,1)
|
|
RULE(13,6,4,15,2)
|
|
RULE(13,6,5,43,6)
|
|
RULE(14,0,3,10,4)
|
|
RULE(14,0,4,42,5)
|
|
RULE(14,0,5,12,2)
|
|
RULE(14,1,3,14,6)
|
|
RULE(14,1,4,10,4)
|
|
RULE(14,1,5,42,5)
|
|
RULE(14,2,0,12,2)
|
|
RULE(14,2,3,14,5)
|
|
RULE(14,2,4,14,6)
|
|
RULE(14,2,5,10,4)
|
|
RULE(14,3,3,10,3)
|
|
RULE(14,3,4,14,5)
|
|
RULE(14,3,5,14,6)
|
|
RULE(14,4,3,40,2)
|
|
RULE(14,4,4,10,3)
|
|
RULE(14,4,5,14,5)
|
|
RULE(14,5,3,12,2)
|
|
RULE(14,5,4,40,2)
|
|
RULE(14,5,5,10,3)
|
|
RULE(14,6,3,42,5)
|
|
RULE(14,6,4,12,2)
|
|
RULE(14,6,5,40,2)
|
|
RULE(15,0,3,11,4)
|
|
RULE(15,0,4,43,5)
|
|
RULE(15,0,5,13,2)
|
|
RULE(15,1,3,15,6)
|
|
RULE(15,1,4,11,4)
|
|
RULE(15,1,5,43,5)
|
|
RULE(15,2,3,15,5)
|
|
RULE(15,2,4,15,6)
|
|
RULE(15,2,5,11,4)
|
|
RULE(15,3,3,11,3)
|
|
RULE(15,3,4,15,5)
|
|
RULE(15,3,5,15,6)
|
|
RULE(15,4,3,41,2)
|
|
RULE(15,4,4,11,3)
|
|
RULE(15,4,5,15,5)
|
|
RULE(15,5,3,13,2)
|
|
RULE(15,5,4,41,2)
|
|
RULE(15,5,5,11,3)
|
|
RULE(15,6,3,43,5)
|
|
RULE(15,6,4,13,2)
|
|
RULE(15,6,5,41,2)
|
|
RULE(32,0,3,43,2)
|
|
RULE(32,0,4,33,3)
|
|
RULE(32,0,5,42,3)
|
|
RULE(32,1,3,33,5)
|
|
RULE(32,1,4,43,2)
|
|
RULE(32,1,5,33,3)
|
|
RULE(32,2,3,42,1)
|
|
RULE(32,2,4,33,5)
|
|
RULE(32,2,5,43,2)
|
|
RULE(32,3,3,8,1)
|
|
RULE(32,3,4,42,1)
|
|
RULE(32,3,5,33,5)
|
|
RULE(32,4,3,10,6)
|
|
RULE(32,4,4,8,1)
|
|
RULE(32,4,5,42,1)
|
|
RULE(32,5,3,42,3)
|
|
RULE(32,5,4,10,6)
|
|
RULE(32,5,5,8,1)
|
|
RULE(32,6,3,33,3)
|
|
RULE(32,6,4,42,3)
|
|
RULE(32,6,5,10,6)
|
|
RULE(33,0,3,42,2)
|
|
RULE(33,0,4,32,3)
|
|
RULE(33,0,5,43,3)
|
|
RULE(33,1,3,32,5)
|
|
RULE(33,1,4,42,2)
|
|
RULE(33,1,5,32,3)
|
|
RULE(33,2,3,43,1)
|
|
RULE(33,2,4,32,5)
|
|
RULE(33,2,5,42,2)
|
|
RULE(33,3,3,9,1)
|
|
RULE(33,3,4,43,1)
|
|
RULE(33,3,5,32,5)
|
|
RULE(33,4,3,11,6)
|
|
RULE(33,4,4,9,1)
|
|
RULE(33,4,5,43,1)
|
|
RULE(33,5,3,43,3)
|
|
RULE(33,5,4,11,6)
|
|
RULE(33,5,5,9,1)
|
|
RULE(33,6,3,32,3)
|
|
RULE(33,6,4,43,3)
|
|
RULE(33,6,5,11,6)
|
|
RULE(34,0,3,35,4)
|
|
RULE(34,0,4,41,5)
|
|
RULE(34,0,5,35,2)
|
|
RULE(34,1,3,40,4)
|
|
RULE(34,1,4,35,4)
|
|
RULE(34,1,5,41,5)
|
|
RULE(34,2,3,10,1)
|
|
RULE(34,2,4,40,4)
|
|
RULE(34,2,5,35,4)
|
|
RULE(34,3,3,8,6)
|
|
RULE(34,3,4,10,1)
|
|
RULE(34,3,5,40,4)
|
|
RULE(34,4,3,40,6)
|
|
RULE(34,4,4,8,6)
|
|
RULE(34,4,5,10,1)
|
|
RULE(34,5,3,35,2)
|
|
RULE(34,5,4,40,6)
|
|
RULE(34,5,5,8,6)
|
|
RULE(34,6,3,41,5)
|
|
RULE(34,6,4,35,2)
|
|
RULE(34,6,5,40,6)
|
|
RULE(35,0,3,34,4)
|
|
RULE(35,0,4,40,5)
|
|
RULE(35,0,5,34,2)
|
|
RULE(35,1,3,41,4)
|
|
RULE(35,1,4,34,4)
|
|
RULE(35,1,5,40,5)
|
|
RULE(35,2,3,11,1)
|
|
RULE(35,2,4,41,4)
|
|
RULE(35,2,5,34,4)
|
|
RULE(35,3,3,9,6)
|
|
RULE(35,3,4,11,1)
|
|
RULE(35,3,5,41,4)
|
|
RULE(35,4,3,41,6)
|
|
RULE(35,4,4,9,6)
|
|
RULE(35,4,5,11,1)
|
|
RULE(35,5,3,34,2)
|
|
RULE(35,5,4,41,6)
|
|
RULE(35,5,5,9,6)
|
|
RULE(35,6,3,40,5)
|
|
RULE(35,6,4,34,2)
|
|
RULE(35,6,5,41,6)
|
|
RULE(40,0,3,34,5)
|
|
RULE(40,0,4,10,2)
|
|
RULE(40,0,5,14,1)
|
|
RULE(40,1,3,35,3)
|
|
RULE(40,1,4,34,5)
|
|
RULE(40,1,5,10,2)
|
|
RULE(40,2,3,34,1)
|
|
RULE(40,2,4,35,3)
|
|
RULE(40,2,5,34,5)
|
|
RULE(40,3,3,8,5)
|
|
RULE(40,3,4,34,1)
|
|
RULE(40,3,5,35,3)
|
|
RULE(40,4,3,12,3)
|
|
RULE(40,4,4,8,5)
|
|
RULE(40,4,5,34,1)
|
|
RULE(40,5,3,14,1)
|
|
RULE(40,5,4,12,3)
|
|
RULE(40,5,5,8,5)
|
|
RULE(40,6,3,10,2)
|
|
RULE(40,6,4,14,1)
|
|
RULE(40,6,5,12,3)
|
|
RULE(41,0,3,35,5)
|
|
RULE(41,0,4,11,2)
|
|
RULE(41,0,5,15,1)
|
|
RULE(41,1,3,34,3)
|
|
RULE(41,1,4,35,5)
|
|
RULE(41,1,5,11,2)
|
|
RULE(41,2,3,35,1)
|
|
RULE(41,2,4,34,3)
|
|
RULE(41,2,5,35,5)
|
|
RULE(41,3,3,9,5)
|
|
RULE(41,3,4,35,1)
|
|
RULE(41,3,5,34,3)
|
|
RULE(41,4,3,13,3)
|
|
RULE(41,4,4,9,5)
|
|
RULE(41,4,5,35,1)
|
|
RULE(41,5,3,15,1)
|
|
RULE(41,5,4,13,3)
|
|
RULE(41,5,5,9,5)
|
|
RULE(41,6,3,11,2)
|
|
RULE(41,6,4,15,1)
|
|
RULE(41,6,5,13,3)
|
|
RULE(42,0,3,10,5)
|
|
RULE(42,0,4,32,2)
|
|
RULE(42,0,5,33,4)
|
|
RULE(42,1,3,14,3)
|
|
RULE(42,1,4,10,5)
|
|
RULE(42,1,5,32,2)
|
|
RULE(42,2,3,12,1)
|
|
RULE(42,2,4,14,3)
|
|
RULE(42,2,5,10,5)
|
|
RULE(42,3,3,8,2)
|
|
RULE(42,3,4,12,1)
|
|
RULE(42,3,5,14,3)
|
|
RULE(42,4,3,32,6)
|
|
RULE(42,4,4,8,2)
|
|
RULE(42,4,5,12,1)
|
|
RULE(42,5,3,33,4)
|
|
RULE(42,5,4,32,6)
|
|
RULE(42,5,5,8,2)
|
|
RULE(42,6,3,32,2)
|
|
RULE(42,6,4,33,4)
|
|
RULE(42,6,5,32,6)
|
|
RULE(43,0,3,11,5)
|
|
RULE(43,0,4,33,2)
|
|
RULE(43,0,5,32,4)
|
|
RULE(43,1,3,15,3)
|
|
RULE(43,1,4,11,5)
|
|
RULE(43,1,5,33,2)
|
|
RULE(43,2,3,13,1)
|
|
RULE(43,2,4,15,3)
|
|
RULE(43,2,5,11,5)
|
|
RULE(43,3,3,9,2)
|
|
RULE(43,3,4,13,1)
|
|
RULE(43,3,5,15,3)
|
|
RULE(43,4,3,33,6)
|
|
RULE(43,4,4,9,2)
|
|
RULE(43,4,5,13,1)
|
|
RULE(43,5,3,32,4)
|
|
RULE(43,5,4,33,6)
|
|
RULE(43,5,5,9,2)
|
|
RULE(43,6,3,33,2)
|
|
RULE(43,6,4,32,4)
|
|
RULE(43,6,5,33,6)
|
|
|
|
printf("HEPTAGONAL RULE MISSING for (%d,%d)\n", parent,dir);
|
|
exit(1);
|
|
}
|
|
|
|
// calculate the fjordvalue of a hexagonal cell,
|
|
// based on the fjordvalues of the neighbor heptacells.
|
|
int fjord_hexagon(int a, int b, int c) {
|
|
// pick the lexicographically smallest representation of the cycle
|
|
if(b <= a || c<a) { int t=a; a=b; b=c; c=t; }
|
|
if(b <= a || c<a) { int t=a; a=b; b=c; c=t; }
|
|
|
|
if(a==8 && b == 10 && c== 34) return 30;
|
|
if(a==8 && b == 12 && c== 12) return 4;
|
|
if(a==8 && b == 12 && c== 42) return 48;
|
|
if(a==8 && b == 32 && c== 10) return 28;
|
|
if(a==8 && b == 34 && c== 40) return 20;
|
|
if(a==8 && b == 40 && c== 12) return 16;
|
|
if(a==8 && b == 42 && c== 32) return 52;
|
|
if(a==9 && b == 11 && c== 35) return 31;
|
|
if(a==9 && b == 13 && c== 13) return 5;
|
|
if(a==9 && b == 13 && c== 43) return 49;
|
|
if(a==9 && b == 33 && c== 11) return 29;
|
|
if(a==9 && b == 35 && c== 41) return 21;
|
|
if(a==9 && b == 41 && c== 13) return 17;
|
|
if(a==9 && b == 43 && c== 33) return 53;
|
|
if(a==10 && b == 14 && c== 14) return 6;
|
|
if(a==10 && b == 14 && c== 40) return 50;
|
|
if(a==10 && b == 32 && c== 42) return 22;
|
|
if(a==10 && b == 40 && c== 34) return 54;
|
|
if(a==10 && b == 42 && c== 14) return 18;
|
|
if(a==11 && b == 15 && c== 15) return 7;
|
|
if(a==11 && b == 15 && c== 41) return 51;
|
|
if(a==11 && b == 33 && c== 43) return 23;
|
|
if(a==11 && b == 41 && c== 35) return 55;
|
|
if(a==11 && b == 43 && c== 15) return 19;
|
|
if(a==12 && b == 12 && c== 12) return 44;
|
|
if(a==12 && b == 14 && c== 42) return 38;
|
|
if(a==12 && b == 40 && c== 14) return 36;
|
|
if(a==13 && b == 13 && c== 13) return 45;
|
|
if(a==13 && b == 15 && c== 43) return 39;
|
|
if(a==13 && b == 41 && c== 15) return 37;
|
|
if(a==14 && b == 14 && c== 14) return 46;
|
|
if(a==15 && b == 15 && c== 15) return 47;
|
|
if(a==32 && b == 33 && c== 42) return 26;
|
|
if(a==32 && b == 33 && c== 43) return 57;
|
|
if(a==32 && b == 42 && c== 33) return 56;
|
|
if(a==32 && b == 43 && c== 33) return 27;
|
|
if(a==34 && b == 35 && c== 40) return 24;
|
|
if(a==34 && b == 35 && c== 41) return 59;
|
|
if(a==34 && b == 40 && c== 35) return 58;
|
|
if(a==34 && b == 41 && c== 35) return 25;
|
|
printf("HEXAGONAL RULE MISSING for (%d,%d,%d)\n", a,b,c);
|
|
return 0;
|
|
// exit(1);
|
|
}
|
|
|