Page 11 of 22

Re: apgsearch v4.0

Posted: March 15th, 2018, 8:04 am
by googleplex
can you make it work on non-x86-64 machines?

Re: apgsearch v4.0

Posted: March 16th, 2018, 8:00 pm
by muzik
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.
Any progress updates on how this is getting on? I remain intrigued by this rulespace.

Re: apgsearch v4.0

Posted: March 16th, 2018, 8:12 pm
by AforAmpere
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.

Re: apgsearch v4.0

Posted: March 16th, 2018, 9:43 pm
by mniemiec
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.

Re: apgsearch v4.0

Posted: March 16th, 2018, 10:18 pm
by dvgrn
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.
We have them for free already, don't we? Isotropic hexagonal rules must be a subset of anisotropic non-totalistic MAP rules, which are available both in LifeViewer and in recent versions of Golly.

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?

There's some mention of HexLife in LifeLine #2, but no Hensel-notation-ish letters... I can see from the LifeLine definition that 2o and 2m must be two-cells-adjacent and 2-cells-at-120-degrees, but I don't know which is which.

Anyway, yes, it would certainly be nice to support rule strings like "B2om/S2H" instead of (whatever the equivalent 86-character MAP rule is) -- with nice hexagonal rendering in the case of lifeviewer.lua, and at least a semi-reasonable rendering for LifeViewer:

Code: Select all

x = 11, y = 9, rule = B3/S1345H
8o$9o$2o2bobob2o$b8o$2b2ob3ob2o$4b2ob4o$4bob2ob2o$4b5obo$5b3o!
#C [[ GRID GPS 2 AUTOSTART ]]

Re: apgsearch v4.0

Posted: March 17th, 2018, 12:38 am
by wildmyron
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?
Here are some relevant forum posts:

Notation: http://conwaylife.com/forums/viewtopic.php?p=6822#p6822
Extended notation: http://conwaylife.com/forums/viewtopic. ... 073#p11073
Conversion to MAP script: http://conwaylife.com/forums/viewtopic. ... 715#p55715

Re: apgsearch v4.0

Posted: March 17th, 2018, 12:39 am
by fluffykitty
2o is adjacent and 2m is 120°

Re: apgsearch v4.0

Posted: March 17th, 2018, 4:56 am
by dvgrn
Thanks for the links. I tried various searches for "HexLife" but didn't turn up that thread.

Here's a copy of vyznev's script with a few more links and attribution in the comments.

Code: Select all

#!/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:"
Seems to be in working order -- I tried one of Paul Callahan's rule-less RLE chunks from his "hexrule" article.

Interestingly, while "x = 270, y = 51, rule = B2o/S2m34" doesn't work in either Golly or LifeViewer, the MAP string produced by vyznev's script works fine in Golly, but not in LifeViewer:

Code: Select all

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!
My apologies if most of this is old news to everyone else -- I haven't done much with hex rules up to this point, and hadn't noticed that a reasonably standard isotropic hex format was available.

Re: apgsearch v4.0

Posted: March 17th, 2018, 1:27 pm
by muzik
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?

Re: apgsearch v4.0

Posted: March 17th, 2018, 6:28 pm
by 77topaz
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?
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.

Re: apgsearch v4.0

Posted: March 17th, 2018, 7:00 pm
by muzik
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.
...you are aware that catagolue and apgluxe have been handling LtL rules up to range 7 fine for the past seven months or so?

Re: apgsearch v4.0

Posted: March 17th, 2018, 9:32 pm
by dani
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.

Re: apgsearch v4.0

Posted: March 17th, 2018, 9:48 pm
by 77topaz
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.
Yes, that was my point. I don't know what Catagolue and apgluxe have to do with it; I mean, they can also run B0 rules, but B0 ships aren't included in the main 5s project for the same reason. Still, I think separate side-projects for B0 and LtL ships could be done.

Re: apgsearch v4.0

Posted: March 17th, 2018, 10:03 pm
by AforAmpere
Yeah, as I said in the 5s thread, if someone wants to take the job for LTL rules, go ahead, make a supplementary collection. B0 is already taken, though seldom updated as of now.

Re: apgsearch v4.0

Posted: March 18th, 2018, 10:13 am
by Majestas32
Will update b0 collection Tuesday

Re: apgsearch v4.0

Posted: April 9th, 2018, 3:51 pm
by muzik
Don't know if I've suggested this before, but here's some suggestions for symmetry operators:

Code: Select all

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 - Explodes the soup on the x axis.

Code: Select all

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!
y - Explodes the soup on the y axis.

Code: Select all

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!

Re: apgsearch v4.0

Posted: April 15th, 2018, 12:48 pm
by dani
My biggest suggestion is D2_x-skewgutter, like so:

Code: Select all

x = 16, y = 15, rule = B2ci3ai4c8/S02ae3eijkq4iz5ar6i7e
6b2o6b2o$3b3obobobobobo$bo3bo4bo3bo$bo4b5o4bo$b2o3bo5bob2o$o2b2o2bobob
ob2o$2obobo2b2o2bo2bo$3bo2bo2bobobo$bobob3o2b2ob3o$2b2o4bo2b3obo$bo3bo
b3o2b2obo$4bobo2b2o4bo$bo3bob4o4bo$obob2o2bo$2ob2obob5o!

Re: apgsearch v4.0

Posted: April 30th, 2018, 7:24 pm
by 77topaz
When you enter a rulestring in the incorrect "B3/S23" format instead of "b3s23", apgsearch becomes stuck in an infinite loop during the setup process; it would be better for the script to simply post an error message like "invalid rulestring" and halt, rather than having this loop.

Re: apgsearch v4.0

Posted: May 6th, 2018, 5:06 pm
by dani
What makes B2cei3ary4aeiry5any/S2-c3-inq4ikry5eijr6i (Spaghetti2) so hard to search?

Re: apgsearch v4.0

Posted: May 17th, 2018, 12:50 am
by Saka
Perhaps apgluxe and catagolue should start supporting Circular LTL neighborhoods since it's also in golly now?

Re: apgsearch v4.0

Posted: May 17th, 2018, 1:06 am
by Apple Bottom
Saka wrote:Perhaps apgluxe and catagolue should start supporting Circular LTL neighborhoods since it's also in golly now?
Patches/pull requests welcome, I'm sure.

Small tori in apgluxe?

Posted: May 19th, 2018, 9:17 am
by F_rank
My wish for the next or one of the next versions of apgsearch / apgluxe is the support of (small) tori (via the rulestring) so that we can do a joint distributed effort to fully explore at least the 7x7 and 8x8 tori. This would then not start with a random soup (and the unique seed for the random generator) but with a designated 'slice' of the entire 7x7 or 8x8 universe of starting patterns, and apgluxe would take care of the slicing so that in the end we have an entire cake. It would be a finite [sub-]project with a foreseeable end, contrary to what apgluxe is doing today.

For exploration of small tori, I think it would be best to always consider the entire torus as an "object", and not trying to count blocks or blinkers etc within the ash. The entire torus would be the ash object, at least up to 8x8 (which seems to be a natural limit to exhaustive / brute-force exploration). Only 'canonical' patterns would be considered different, all others are derivatives. A 'block' would be a 7x7 (or 8x8) torus with one block and nothing else, no matter where on the torus it is located. Same for 'blinker' etc.

Just my 2 cents ... feedback welcome.
Frank

Re: Small tori in apgluxe?

Posted: May 19th, 2018, 12:56 pm
by Apple Bottom
F_rank wrote:Just my 2 cents ... feedback welcome.
Frank
Support for toroidal universes in apgsearch would be great --- I think there's some rudimentary support for this server-side, rulestrings anyway, but not yet in the client.

For an exhaustive search of small tori, I think a separate client would work better. There's prior art for this --- slow salvos were investigated using a different tool called hs (HoneySearch), and Calcyman's on record saying that Catagolue basically acts as a generic object datastore anyway. You can feed it data from soup searches --- but you don't have to.

So yeah, I'd suggest a different project (which could start as a fork of apgsearch of course). Lifelib is a separate project these days anyway; I don't recall off-hand if the object classification code etc. is also in there somewhere, but if not it should be easily moved over from apgsearch.

How about having a go at it yourself? This seems like a cool project, and a great opportunity to learn how to work with lifelib.

Re: apgsearch v4.0

Posted: May 19th, 2018, 1:24 pm
by calcyman
I agree that this really needs to be a separate client program (with Catagolue as the server, of course, for simplicity).

At this stage, before anyone programs anything, it's worth discussing how best to represent objects in a toroidal universe.

Re: apgsearch v4.0

Posted: May 26th, 2018, 12:43 pm
by muzik
Searching rules such as B012345678/S023456 spams pathologicals everywhere, why is this?