Commit 6d19cc36 authored by Adam P. Goucher's avatar Adam P. Goucher
Browse files

0-degree recipes now work

parent f797624f
Pipeline #36599249 passed with stages
in 5 minutes and 53 seconds
......@@ -91,8 +91,10 @@ namespace apg {
for (uint64_t i = 0; i < gouts.size(); i++) {
if ((gouts[i].second.first == 'x') || (gouts[i].second.first == 'i')) {
gouts[i].first += offset;
if (offset & 1) { gouts[i].second.first ^= ('x' ^ 'i'); }
} else if (offset & 1) {
gouts[i].first = 0 - gouts[i].first;
}
if (offset & 1) { gouts[i].second.first ^= ('x' ^ 'i'); }
}
initpos += offset;
}
......
......@@ -101,6 +101,28 @@ namespace apg {
return chunk;
}
bool is_narrow(pattern inf, pattern m) {
pattern findme(lab, "4$2bo$bobob2o$o2bob2o$obo$bo!", "b3s23");
pattern tri(lab, "5o$4o$3o$2o$o!", "b3s23");
tri = tri(-2, -2);
int64_t bbox[4] = {0};
(inf + m).getrect(bbox);
int64_t x = bbox[2] + bbox[3];
while (x > 0) {
tri = tri.convolve(tri);
x = x >> 1;
}
tri = m.convolve(tri);
pattern infx = inf - m.convolve(findme);
return ((infx & tri(45, 45)) - tri(-45, -45) == infx);
}
std::pair<pattern, pattern> diagsplit(pattern inf, pattern m, bool duplicate) {
pattern findme(lab, "4$2bo$bobob2o$o2bob2o$obo$bo!", "b3s23");
......@@ -201,6 +223,58 @@ namespace apg {
return cs;
}
bool ne_constell(pattern infx, int64_t* bbox2, scstream &scs) {
std::cerr << "Trying ne_constell()" << std::endl;
pattern origin_block(lab, "oo$oo!", "b3s23");
origin_block = origin_block(bbox2[0], bbox2[1]);
// Now we reflect:
pattern to_build = infx.transform("flip_x", 0, 0);
origin_block = origin_block.transform("flip_x", 0, 0);
scstream elbow_dup("[0, 109, 91, 93, 90, 171, 90, 90, 91, 154, 110, 169, 107, 91, 90, 99, 91, 122, 90, 90, 159, 90, 90,109,90,93,91,91,90,90,100,90, 90,146,96,90,90,90,92,156,144,90,109, 91,93,91,132,115,102,90,91,91,91,90,90,154,98] 0move-52");
int64_t bbox[4] = {0ull};
to_build.getrect(bbox);
int64_t bbox3[4] = {0ull};
origin_block.getrect(bbox3);
int64_t forwx = bbox3[0] - bbox[0] - bbox[2];
int64_t forwy = bbox3[1] - bbox[1] - bbox[3];
// Number of full-diagonals to move origin block forwards.
int64_t fd_forward = (forwx < forwy) ? forwx : forwy;
origin_block = origin_block(-fd_forward, -fd_forward);
origin_block.getrect(bbox3);
std::vector<lanespec> paralanes;
cgsalvo<int64_t> cs = sparsebuild(to_build, bbox, bbox3, true);
for (auto ng = cs.gliders.begin(); ng != cs.gliders.end(); ++ng) {
int64_t il = ng->first - 3;
paralanes.emplace_back(il, std::pair<char, char>('p', ng->second));
if ((il < -107) || (il > 107)) { return false; }
}
int64_t middle = 2 * fd_forward - 160;
// Now actually operate the elbow to emit the gliders:
el.desirate(scs, 2 * fd_forward);
scs.concat(elbow_dup, 0);
for (auto it = paralanes.begin(); it != paralanes.end(); ++it) {
el.fire_parallel(scs, *it, middle);
}
return true;
}
void nw_constell(pattern infx, int64_t* bbox2, scstream &scs, bool new_elbow) {
int64_t bbox3[4] = {bbox2[0] - 47, bbox2[1] - 42, bbox2[2], bbox2[3]};
......@@ -320,6 +394,9 @@ namespace apg {
if ((things.first.nonempty()) && (things.second.nonempty())) {
std::cerr << "Metacluster spans both sides of the channel." << std::endl;
while (scs.endblocks.size() > 1) { scs.close_paren(); }
if (is_narrow(infx, m) && ne_constell(infx, ideal, scs)) { return; }
int64_t forwdiag = (bbox[0] - ideal[0]) - (bbox[1] + bbox[3] - ideal[1]) - 128;
forwdiag = 2 * (forwdiag / 2) + 1; // Ensure correct parity
el.desirate(scs, forwdiag);
......
[M2] (golly 3.2)
#R B3/S23
$$$$$$$......**$
4 0 0 0 1
5 0 0 0 2
6 0 0 3 0
7 0 0 0 4
8 0 0 0 5
9 0 0 0 6
10 0 0 0 7
11 0 0 0 8
12 0 0 0 9
$.....*$.....***$$.......*$.......*$
4 0 11 0 0
...**$..*.*$..*$.**$
4 0 13 0 0
5 0 12 0 14
6 0 0 0 15
$$$*$.*$.*$*$
$$$.......*$.......*$
4 17 0 0 18
$$$*$*$
4 0 0 20 0
$$$..**$..**$
$$$$$$..**.*$..**.***$
$..**.***$...*.*$...*.*$....*$$.....*$...***$
4 22 23 0 24
*$
4 0 0 26 0
5 19 21 25 27
6 0 0 28 0
7 0 0 16 29
8 0 0 0 30
9 0 0 0 31
10 0 0 0 32
11 0 0 0 33
12 0 0 0 34
$$....**$.....*$.....*.*$......**$
4 0 36 0 0
$$$$$$$.......*$
......*$$....****$...*$....***$.......*$....****$*...*$
.......*$$$$$$......**$......*$
*....***$.......*$.......*$......**$
4 38 39 40 41
.......*$
**$.*$
4 43 44 0 0
5 37 42 0 45
$*$*$$$$$**$
..*$.**$
4 47 0 48 0
5 49 0 0 0
6 46 50 0 0
7 0 51 0 0
8 0 52 0 0
9 0 53 0 0
10 0 54 0 0
11 0 55 0 0
12 0 56 0 0
13 0 10 35 57
14 0 0 58 0
.......*$......*$.......*$
4 0 0 0 60
5 0 0 0 61
6 0 62 0 0
7 0 0 0 63
8 0 64 0 0
9 0 65 0 0
10 0 66 0 0
11 0 67 0 0
12 0 68 0 0
13 0 0 0 69
14 0 70 0 0
$.......*$$$$$$....**$
$*$*$*.*$.**$
4 0 0 72 73
.....*$.....*.*$......**$
4 75 0 0 0
5 0 74 0 76
6 0 77 0 0
$$..**$..**$
..*$..**$
4 79 80 0 0
$$$$$$$...**$
...*$....***$......*$
4 0 82 0 83
5 81 0 84 0
6 85 0 0 0
.......*$.......*$
.....**$....*.*$....*$...**$
$....**$....**$$$$.....**$....*.*$
4 0 87 88 89
5 0 0 0 90
.*..*.*$.****.**$.....*$...*.*$...**$
4 0 92 0 0
5 0 93 0 0
6 0 91 0 94
7 78 86 0 95
8 0 96 0 0
9 0 97 0 0
10 0 98 0 0
11 0 99 0 0
12 0 100 0 0
$$$$$$..*$***$
4 0 0 102 0
$*$
$$$$$.*$*.*$*.*$
4 104 0 105 0
5 103 0 106 0
*.*.**$..*..*$..**$
4 108 0 0 0
5 109 0 0 0
6 107 0 110 0
7 0 0 111 0
8 112 0 0 0
9 113 0 0 0
10 114 0 0 0
11 115 0 0 0
12 116 0 0 0
$$$$**$**$$**$
..*$.*$*$
4 118 0 119 0
5 0 0 120 0
6 121 0 0 0
7 0 0 122 0
8 123 0 0 0
9 124 0 0 0
10 125 0 0 0
11 126 0 0 0
12 127 0 0 0
13 101 117 128 0
14 129 0 0 0
15 0 59 71 130
x = 8165, y = 8284, rule = B3/S23
8160b2o$8160bo$8162bo$8142b2o14b5o$8143bo13bo$8143bobo12b3o$8144b2o15b
o$8158b4o$8153b2o3bo3b2o$8153b2o4b3o2bo$8161bob2o$8161bo$8160b2o3$
8152b2o$8152bo$8153b3o$8155bo4157$4100bo$4098b3o$4097bo$4097b2o7$4087b
2o$4086bobo5b2o$4086bo7b2o$4085b2o2$4099bo$4095b2obobo$4094bobobobo$
4091bo2bobobobob2o$4091b4ob2o2bo2bo$4095bo4b2o$4093bobo$4093b2o4080$2b
2o$2b2o2$2b2o$bo2bo$o2bo$b2o!
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment