There are custom symmetries by Mateon1 that randomly enumerate glider collisions.
Not all gliders collide so there will definitely be some redundant gliders.
There's a 9 bit snake in the second one.
To retrieve the soup run this script after replacing seed and symmetry with the correct one,
Code: Select all
from __future__ import print_function
import hashlib
import sys
SIZES = {
"Glider8_4_5": (8, 4, 5), # 32x12bit
"Glider6_5_6": (6, 5, 6), # 24x14bit
}
(glis, width, length) = (6, 5, 6)
seed = b"k_Nbke7qxLPRzS8441"
def digest(bs):
print("Digesting: " + bs.decode("ascii"))
return hashlib.sha256(bs).digest()
hashval = bytes("\0" * 32, "ascii")
randcnt = 0
randbyte = 0
randbit = 0
def main(seed):
global randbit, randbyte, randcnt, hashval
cells = set()
hashval = digest(seed)
randcnt = 0
randbyte = 0
randbit = 0
def bit():
global randbit, randbyte, randcnt, hashval
if randbyte >= 32:
assert randbit == 0
randbyte = 0
randcnt += 1
hashval = digest(seed + bytes(":%d" % randcnt, "ascii"))
val = (hashval[randbyte] >> randbit) & 1
randbit += 1
if randbit >= 8:
randbit = 0
randbyte += 1
return val
def rand(bits):
assert bits <= 64
val = 0
for b in range(bits):
val |= (1 << b) if bit() else 0
print("rand: " + str(val))
return val
PHASES = [
[[1, 1, 1],
[1, 0, 0],
[0, 1, 0]],
[[0, 1, 1],
[1, 1, 0],
[0, 0, 1]]]
for quadrant in [(-1, -1), (1, -1), (-1, 1), (1, 1)]:
counter = 0
while counter < glis:
ori = bit()
flip = bit()
phase = bit()
offs = rand(width)
shift = rand(length) + 4
(x, y) = (quadrant[0] * shift, quadrant[1] * shift)
if ori:
x += quadrant[0] * (offs + 1)
else:
y += quadrant[1] * offs
# print(ori, flip, phase, offs, shift)
# print((x, y))
r = 2
bad = False
for dx in range(-r, 3 + r):
for dy in range(-r, 3 + r):
if (x + dx, y + dy) in cells:
bad = True
if bad: continue
print("placing glider %r; ori/flip/phase: %d/%d/%d" % ((x, y), int(ori), int(flip), int(phase)))
for dy in range(3):
for dx in range(3):
(gx, gy) = (2 - dx if quadrant[0] == -1 else dx, 2 - dy if quadrant[1] == -1 else dy)
(gx, gy) = (gy, gx) if flip else (gx, gy)
if PHASES[phase][gy][gx]:
cells.add((x + dx, y + dy))
counter += 1
def getcell(x, y):
# u = x >> 3
# v = y >> 3
# return (tiles[v][u] >> ((x&7) | ((y&7) << 3))) & 1
return (x, y) in cells
xmin = min(x for (x, y) in cells)
xmax = max(x for (x, y) in cells)
ymin = min(y for (x, y) in cells)
ymax = max(y for (x, y) in cells)
"""
print("x = 0, y = 0, rule = B3/S23")
for y in range(ymin, ymax+1):
for x in range(xmin, xmax+1):
print("o" if getcell(x, y) else "b", end="")
print('$' if y < ymax else '!')
"""
print("x = %d, y = %d, rule = B3/S23" % (xmax - xmin + 1, ymax - ymin + 1))
linerepeat = 0
repeat = 0
char = "b"
for y in range(ymin, ymax + 1):
for x in range(xmin, xmax + 1):
c = "o" if getcell(x, y) else "b"
if c == char:
repeat += 1
else:
if repeat and linerepeat:
print("%d$" % linerepeat if linerepeat > 1 else '$', end="")
linerepeat = 0
if repeat: print("%d%c" % (repeat, char) if repeat > 1 else char, end="")
char = c
repeat = 1
if repeat and char != "b": print("%d%c" % (repeat, char) if repeat > 1 else char, end="")
repeat = 0
linerepeat += 1
print('!')
# for i in range(10000):
# main(seed + bytes("%d" % i, "ascii"))
main(seed)
Note that this is not a golly script and that it is written in Python 3.