calcyman wrote:muzik wrote:Seems like a valid next step. The other two main ones I can think of would be B0 non-totalistic and LTL Generations.
In terms of further rule families, the next one I intend to implement is outer-totalistic rules up to range 5.
muzik wrote:Any progress updates on how this is getting on? I remain intrigued by this rulespace.
calcyman wrote:In terms of further rule families, the next one I intend to implement is outer-totalistic rules up to range 5.
mniemiec wrote:calcyman wrote:In terms of further rule families, the next one I intend to implement is outer-totalistic rules up to range 5.
How about non-totalistic hexagonal rules? I would think those would be a fairly trivial variant of non-totalistic Moore neighborhood rules. The original HexLife from the Lifelines (B2om/S2H) is one of these, as is Callahan's hexagonal rule (B2o/S2m34H). These can, of course, be done using rule tables, but it seems like QuickLife and HashLife should be able to do these virtually free.
x = 11, y = 9, rule = B3/S1345H
8o$9o$2o2bobob2o$b8o$2b2ob3ob2o$4b2ob4o$4bob2ob2o$4b5obo$5b3o!
#C [[ GRID GPS 2 AUTOSTART ]]
dvgrn wrote:I haven't worked out how to do the translation to MAP format yet, exactly -- partly because I can't seem to find a definition of the hex neighborhoods you mention. What are "o" and "m", and what other letters are available?
#!/usr/bin/python
"""
This script converts hexagonal isotropic (possibly non-totalistic) CA rules[1]
into the equivalent MAP rules[2]. It runs under both Python 2 and Python 3, and
can be used either as a stand-alone script (with the rules given as command line
arguments) or run directly in Golly. Posted[3] to github 27 Jan 2018 by vyznev[4].
Copy posted to forums (with these additional notes) 17 Mar 2018 [5].
[1]: http://www.conwaylife.com/wiki/Isotropic_non-totalistic_Life-like_cellular_automaton#Hexagonal_neighbourhood
[2]: http://golly.sourceforge.net/Help/Algorithms/QuickLife.html
[3]: http://conwaylife.com/forums/viewtopic.php?p=55715#p55715
[4]: https://gist.github.com/vyznev/0ef7eb2ac98645b284dc8e647f10d685
[5]: http://conwaylife.com/forums/viewtopic.php?f=7&t=3049&p=58058#p58058
"""
import re
from base64 import b64encode
def hex2map (rulestr, mapbits=7):
"""
Convert a hexagonal isotropic (possibly non-totalistic) CA rule string
into the equivalent MAP rule. By default, the result will be a 3+22
character hex MAP rule string; to generate a 3+86 character rectangular
MAP rule, use mapbits=9 instead of the default mapbits=7.
"""
# validate rule string format and extract the birth/survive strings
match = re.match(
"^\s*b((?:[0156]|[234]-?[omp]*)*)/s((?:[0156]|[234]-?[omp]*)*)h\s*$",
rulestr.lower()
)
if not match:
return None
# initialize rule structure (list of lists of dicts)
hexrule = [ [], [] ]
for array in hexrule:
for count in range(7):
array.append({"o": 0, "m": 0, "p": 0})
# set birth/survive bits in rule based on input string
for oldstate in range(2):
nhoods = match.group(oldstate + 1)
for m in re.finditer("([0-6])(-?)([omp]*)", nhoods):
count = int(m.group(1))
negate = bool(m.group(2))
letters = m.group(3)
for letter in "omp":
newstate = 0
if letter in letters or not letters:
newstate = 1
if negate and letters:
newstate = 1 - newstate
hexrule[oldstate][count][letter] = newstate
# convert hex rule to map rule
maprule = bytearray(2**mapbits // 8)
for mapindex in range(2**mapbits):
bits = [ (mapindex >> i) & 1 for i in reversed(range(mapbits)) ]
# reorder bits in clockwise order around the center cell
if mapbits == 7:
neighbors = [bits[i] for i in (0,1,4,6,5,2)]
oldstate = bits[3]
elif mapbits == 9:
# ignore bits 2=NE and 6=SW
neighbors = [bits[i] for i in (0,1,5,8,7,3)]
oldstate = bits[4]
else:
raise NotImplementedError("only 7 and 9 bit MAPs are supported")
count = sum(neighbors)
# canonicalize neighbors so that the longest run of dead cells
# comes first and the longest run of live cells comes last
rotations = [neighbors, list(reversed(neighbors))]
while len(rotations) < 12:
neighbors.append(neighbors.pop(0))
rotations += [neighbors, list(reversed(neighbors))]
neighbors = min(rotations)
# determine symmetry letter from longest run
# (this always yields "o" for 0/1/5/6 neighbors)
if count <= 3:
maxgap = 0
while maxgap < 6 and not neighbors[maxgap]:
maxgap += 1
letter = "omp"[6 - count - maxgap]
else:
maxrun = 0
while maxrun < 6 and neighbors[5 - maxrun]:
maxrun += 1
letter = "omp"[count - maxrun]
# set bit in map rule
if hexrule[oldstate][count][letter]:
maprule[mapindex // 8] |= (0x80 >> (mapindex % 8))
# return base64 encoded map
return "MAP" + b64encode(maprule).decode('ascii').strip("=")
if __name__ == '__main__':
# looks like we're being run as a stand-alone script
import argparse
parser = argparse.ArgumentParser(description='Convert hex CA rule strings to MAP rules.')
parser.add_argument('rule', nargs='+', help='input hex rule (e.g. B245/S3H or B2o/S2m34H)')
parser.add_argument('-l', '--long-map', dest='mapbits', action='store_const', const=9, default=7,
help='generate 3+86 character instead of 3+22 character MAP rules')
args = parser.parse_args()
for hexrule in args.rule:
maprule = hex2map(hexrule, args.mapbits)
if maprule:
print(maprule)
else:
print(hexrule + " does not look like a valid hex rule. :(")
else:
# assume we're being run as a Golly plug-in
import golly as g
prompt = "Enter hex rule (e.g. B245/S3H or B2o/S2m34H):"
hexrule = "B2o/S2m34H"
while True:
hexrule = g.getstring(prompt, hexrule, "Set Hex Rule")
maprule = hex2map(hexrule)
if maprule:
g.setrule(maprule)
break
else:
prompt = "The string you entered does not appear to be a valid hex rule. Try again:"
x = 270, y = 51, rule = MAPFAMgVwhXAP4AP4B+gH4A6A
17bo$17bobobo$17bo3b2o$20b2o$20bo$3bobo14b2o$3b4o13bob2o$4bo2bo12bo2bo
$5bobo15bo$5b4o$5bo2$o$obobo13bo$o3b2o12b3o$3b2o13bo2bo$3bo13b3ob2o$3b
2o15b2o$3bob2o14b2o$3bo2bo$6bo74bo$81bo$81bo2bo$81bo$82bo5$31b3o7b3o$
30b2o2bo5b3o2b2o219bo$31bo11bo222bobo$31b3o10bob2o220bo$31bobo10bo220b
2o$34bo232bobo$268b2o$268b2o$268bo5$12bo3$16b4o$15b2o$15b5o2$20bo$20bo
bo!
AforAmpere wrote:muzik wrote:Any progress updates on how this is getting on? I remain intrigued by this rulespace.
I kind of hope that update will come to Golly as well, so we can actually run those rules.
muzik wrote:AforAmpere wrote:muzik wrote:Any progress updates on how this is getting on? I remain intrigued by this rulespace.
I kind of hope that update will come to Golly as well, so we can actually run those rules.
Would such rules then be allowable into the 5s project, provided they're two-state?
77topaz wrote:I think using rules with ranges >1 would be too large a change for the current project, but maybe a separate database could be created for those rules.
muzik wrote:...you are aware that catagolue and apgluxe have been handling LtL rules up to range 7 fine for the past seven months or so?
danny wrote:muzik wrote:...you are aware that catagolue and apgluxe have been handling LtL rules up to range 7 fine for the past seven months or so?
That's not the problem. The problem is that we would have so many new speeds caused by adding these rules that it would make things more difficult.
x = 16, y = 16, rule = B3/S23
2o6bob3ob2o$3b2o3b2o2b2o$b5ob2o3bo$4b7o2b3o$bobob2ob5o2bo$o2bob2ob6obo
$o3bo3b3o4bo$o2bob3ob3obo$2o2b2o3bo4bo$6obob6o$b2o2b4o2b2o2bo$obobo2b
3obobobo$b4ob2o4b2o$bobobobob6o$ob2ob3o4bo2bo$o3bo5b2obobo!
x = 31, y = 16, rule = B3/S23
obo13bo3bobobo3bobo$6bobo7bobo5bobo$2bobobobobo3bobo7bo$8bobobobobobob
o5bobobo$2bo3bo3bobo3bobobobobo5bo$o5bo3bobo3bobobobobobo3bo$o7bo7bobo
bo9bo$o5bo3bobobo3bobobo3bo$obo5bobo7bo9bo$obobobobobo3bo3bobobobobobo
$2bobo5bobobobo5bobo5bo$o3bo3bo5bobobo3bo3bo3bo$2bobobobo3bobo9bobo$2b
o3bo3bo3bo3bobobobobobo$o3bobo3bobobo9bo5bo$o7bo11bobo3bo3bo!
x = 16, y = 31, rule = B3/S23
2o6bob3ob2o2$3b2o3b2o2b2o2$b5ob2o3bo2$4b7o2b3o2$bobob2ob5o2bo2$o2bob2o
b6obo2$o3bo3b3o4bo2$o2bob3ob3obo2$2o2b2o3bo4bo2$6obob6o2$b2o2b4o2b2o2b
o2$obobo2b3obobobo2$b4ob2o4b2o2$bobobobob6o2$ob2ob3o4bo2bo2$o3bo5b2obo
bo!
x = 16, y = 15, rule = B2ci3ai4c8/S02ae3eijkq4iz5ar6i7e
6b2o6b2o$3b3obobobobobo$bo3bo4bo3bo$bo4b5o4bo$b2o3bo5bob2o$o2b2o2bobob
ob2o$2obobo2b2o2bo2bo$3bo2bo2bobobo$bobob3o2b2ob3o$2b2o4bo2b3obo$bo3bo
b3o2b2obo$4bobo2b2o4bo$bo3bob4o4bo$obob2o2bo$2ob2obob5o!
x = 17, y = 10, rule = B3/S23
b2ob2obo5b2o$11b4obo$2bob3o2bo2b3o$bo3b2o4b2o$o2bo2bob2o3b4o$bob2obo5b
o2b2o$2b2o4bobo2b3o$bo3b5ob2obobo$2bo5bob2o$4bob2o2bobobo!
Saka wrote:Perhaps apgluxe and catagolue should start supporting Circular LTL neighborhoods since it's also in golly now?
F_rank wrote:Just my 2 cents ... feedback welcome.
Frank
Users browsing this forum: No registered users and 3 guests