Gustavo Ramos Rehermann's patterns

A forum where anything goes. Introduce yourselves to other members of the forums, discuss how your name evolves when written out in the Game of Life, or just tell us how you found it. This is the forum for "non-academic" content.
User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 16th, 2016, 3:11 pm

Actually the reaction shows a glider colliding with a boat to make a C, but I didn't saw that block.
I REALLY WASTED TIME!
Ok, let's instead check some reaction of a random still-life near a conduitable signal that outputs a Herschel. I could make a Python script to enumerate these reactions but -- any help?

EDIT: This is the current script, has some errors and isn't finished (yet):

Code: Select all

import golly as g
import glife as g2
from sys import exit

herschels = []
herschels.append("3o$2bo$b3o!")
herschels.append("b3o$bo$3o!")
herschels.append("o$3o$obo$2bo!")
herschels.append("2bo$3o$obo$o!")
herschels.append("b3o$2bo$3o!")
herschels.append("b3o$2bo$3o!")
herschels.append("3o$bo$b3o!")
herschels.append("o$obo$3o$2bo!")
herschels.append("2bo$obo$3o$o!")

testrect = g.getselrect();
if testrect == []:
	golly.show("Select the area where the still life is placeable!")
	exit(0)

stillLifes = []

def addStillLife():
	while true:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(stillLife)
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother == "x" or addAnother == "X"
			break
		elif addAnother != "y" and addAnother != "Y"
			golly.warn("Invalid letter!")
			exit(0)
			
addStillLife()

def testReaction(xpos, ypos, sli):
	g.putcells(stillLifes[sli], xpos, ypos)
	this = getcells(getrect())
	int i = 1;
	while i < 301:
		g.step()
		for y in herschels:
			if g.getcells(g.getrect()) == y:
				return this
		i++
	if i == 301:
		g.show("No result found at x:" + xpos + ", y:" + ypos + ", still life " + sli)
		

n = 0
while n < testrect[2]:
	m = 0
	while m < testrect[3]:
		o = 0
		while o < len(stillLifes):
			testReaction(n + testrect[0], m + testrect[1], o)
			o++
		m++
	n++
	
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 16th, 2016, 7:36 pm

@dvgrn As Gustavo said, I think you misinterpreted the pattern... Gustavo showed us a completely-working C-to-H (Which is known), and I think he asked whether it's possible to rub a boat out of the reaction to make a G+Boat→C→H+same Boat. (Which is a G→H)

And to answer the question, no, that's unlikely. The boat ia too deep inside, and you would have to modify the reaction a LOT to make changes there. (e.g. by using another catalyst rather than the eater.) Also, restoring still life baits does not occur that often.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 16th, 2016, 7:56 pm

Finished the decade's ultimate Search Program!!! *drum roll*
HERSCHEL REACTION FINDERRRRRRRRRRRRRRRRRRRRRRR
rrrrrrr...erm,

Code: Select all

import golly as g
from sys import exit

herschels = []

testrect = g.getselrect();
if testrect == []:
	g.exit("Select the area where the still life is placeable!")

if g.empty():
	g.exit("There is no pattern to add bait!")
	
stillLifes = []

def addStillLife():
	while True:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(g.parse(stillLife))
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")
			
def removeFirstLine(str):
	result = str.rsplit('\n')
	result.pop(0)
	return ''.join(result)
			
def addResultDesired():
	while True:
		herschelDesired = g.getstring("What result to find? (RLE)", "3o$obo$obo!", "HRF v0.1")
		herschels.append(g.parse(herschelDesired))
		addAnother = g.getstring("Add another result desired? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")

addStillLife()
addResultDesired()
debug = g.getstring("Debug mode? (y|n)", "n", "HRF v0.1")
if debug.lower() == "y":
	g.autoupdate(True)
elif debug.lower() != "n":
	g.exit("Invalid letter!")

def testReaction(xpos, ypos, sli):
	orig = g.getcells(g.getrect())
	g.putcells(stillLifes[sli], xpos, ypos)
	this = g.getcells(g.getrect())
	i = 0
	oldgeneration = g.getgen()
	while i < 301:
		g.step()
		for y in herschels:
			if g.getcells(g.getrect()) == y:
				break
		i += 1
	if i == 301:
		g.show("No result found at x:" + str(xpos) + ", y:" + str(ypos) + ", still life " + str(sli))
	g.clear(0)
	g.clear(1)
	if i == 301:
		this = g.putcells(orig)
	else:
		g.show("Found reaction!")
		g.putcells(this)
	g.setgen(oldgeneration)
		

n = 0
while n < testrect[2]:
	m = 0
	while m < testrect[3]:
		o = 0
		while o < len(stillLifes):
			testReaction(n + testrect[0], m + testrect[1], o)
			o += 1
		m += 1
	n += 1
EDIT: Fixed some bug.
EDIT2: Now you can choose the result desired. :)

But why, once the result is displayed, the script doesn't stop ?!?
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Saka
Posts: 3627
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: Gustavo Ramos Rehermann's patterns

Post by Saka » January 17th, 2016, 2:02 am

Gustavo6046 wrote:Finished the decade's ultimate Search Program!!! *drum roll*
HERSCHEL REACTION FINDERRRRRRRRRRRRRRRRRRRRRRR
rrrrrrr...erm,

Code: Select all

-schnip-
EDIT: Fixed some bug.
EDIT2: Now you can choose the result desired. :)

But why, once the result is displayed, the script doesn't stop ?!?
Working example please?

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 17th, 2016, 2:55 am

If I got it right, you didn't specify the subroutine to stop and wait for user input after it shows the pattern to Golly.
Try adding something like this after shoing the pattern to Golly.

Code: Select all

g.show('Enter any key to continue!')
while not g.getevent():
    pass
I just wrote it up. It may not work. I hope you get my point.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 17th, 2016, 4:54 pm

It has the script to stop when it finds the result. The problem is that it doesn't works for some reason.
Btw I updated it:

Code: Select all

import golly as g
from sys import exit

herschels = []

testrect = g.getselrect();
if testrect == []:
	g.exit("Select the area where the still life is placeable!")

if g.empty():
	g.exit("There is no pattern to add bait!")
	
stillLifes = []

maxgen = int(g.getstring("Which is the max generation to test for?", "300", "HRF v0.1")) + 1
if maxgen < 2:
	g.exit("Null number")

def addStillLife():
	while True:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(g.parse(stillLife))
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")
			
def removeFirstLine(str):
	result = str.rsplit('\n')
	result.pop(0)
	return ''.join(result)
			
def addResultDesired():
	while True:
		herschelDesired = g.getstring("What result to find? (RLE)", "3o$obo$obo!", "HRF v0.1")
		herschels.append(g.parse(herschelDesired))
		addAnother = g.getstring("Add another result desired? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")

addStillLife()
addResultDesired()
debug = g.getstring("Debug mode? (y|n)", "n", "HRF v0.1")
if debug.lower() == "y":
	g.autoupdate(True)
elif debug.lower() != "n":
	g.exit("Invalid letter!")

def testReaction(xpos, ypos, sli):
	orig = g.getcells(g.getrect())
	g.putcells(stillLifes[sli], xpos, ypos)
	this = g.getcells(g.getrect())
	found = False
	oldgeneration = g.getgen()
	for i in range(maxgen):
		oldpat = g.getcells(g.getrect())
		g.step()
		if g.getcells(g.getrect()) == oldpat:
			break
		for y in herschels:
			if g.getcells(g.getrect()) == y:
				found = True
				break
	else:
		g.show("No result found at x:" + str(xpos) + ", y:" + str(ypos) + ", still life " + str(sli))
	g.clear(0)
	g.clear(1)
	g.setgen(oldgeneration)
	if found:
		g.putcells(this)
		g.exit("Found reaction!")
	else:
		g.putcells(orig)
		

for n in range(testrect[2]):
	for m in range(testrect[3]):
		for o in range(len(stillLifes)):
			testReaction(n + testrect[0], m + testrect[1], o)
Not that it works of course...
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 10:24 am

But why doesn't it works? Scorbie tried to help me, but he had no idea what he is doing.

I'll try to clarify:
This code is a Golly plugin that searches for objects that may come out as a whole from a reaction when a still life bait is placed in the selected area.

It is supposed to stop when it finds the reaction that outputs the object wanted. And display its reaction in Golly. The problem now is that, it doesn't actually stop! Please heelp *infart*
Also, component?

Code: Select all

x = 13, y = 13, rule = B3/S23
4bo3bo$3bo5bo$4b2ob2o2$5bobo2$5b3o$3bo5bo$2bobo3bobo$2bobo3bobo$3bo5bo
$3o7b3o$o11bo!
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 18th, 2016, 11:16 am

Gustavo6046 wrote:It has the script to stop when it finds the result. The problem is that it doesn't works for some reason.
Oh, I see now. Do you mean that your script doesn't find any solutions?
I am not sure but I think this line should be a problem.

Code: Select all

for y in herschels:
    if g.getcells(g.getrect()) == y:
        break 
You compared the whole pattern on the board and the herschel. In order for them to be equal, the whole pattern should only contain a herschel, with the same offset and orientation. If you have a herschel at (0, 0) and another at (3, 3) they are not equal. Also sometimes two identical patterns can have different cell lists and thus fail your test right there...
Please verify if there is a pattern that passes that line and fails to be reported.
Anyway if you are aware of what I said, it's possible that there isn't such a reaction that you are looking for. Did your program miss a result that it has to find?

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 4:10 pm

Scorbie wrote:
Gustavo6046 wrote:It has the script to stop when it finds the result. The problem is that it doesn't works for some reason.
Oh, I see now. Do you mean that your script doesn't find any solutions?
I am not sure but I think this line should be a problem.

Code: Select all

for y in herschels:
    if g.getcells(g.getrect()) == y:
        break 
You compared the whole pattern on the board and the herschel. In order for them to be equal, the whole pattern should only contain a herschel, with the same offset and orientation. If you have a herschel at (0, 0) and another at (3, 3) they are not equal. Also sometimes two identical patterns can have different cell lists and thus fail your test right there...
Please verify if there is a pattern that passes that line and fails to be reported.
Anyway if you are aware of what I said, it's possible that there isn't such a reaction that you are looking for. Did your program miss a result that it has to find?
The orientation isn't a trouble. Now the trouble is offset. How would I fix it?
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

mniemiec
Posts: 1590
Joined: June 1st, 2013, 12:00 am

Re: Gustavo Ramos Rehermann's patterns

Post by mniemiec » January 18th, 2016, 6:30 pm

Gustavo6046 wrote:The orientation isn't a trouble. Now the trouble is offset. How would I fix it?
How about finding the bounding boxes? If the height+width of the pattern aren't the same as those of a Herschel, it can't match. If the sizes match, move the pattern by -(its top/left coordinate), assuming the Herschel starts at (0,0), so it should line up with the template Herschel for comparison. After comparison, if desired, move it back.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 7:27 pm

I believe it's near to getting fixed, but still something is making trouble:

Code: Select all

import golly as g
from sys import exit
from time import sleep

found = False

herschels = []

testrect = g.getselrect();
if testrect == []:
	g.exit("Select the area where the still life is placeable!")

if g.empty():
	g.exit("There is no pattern to add bait!")
	
stillLifes = []

maxgen = int(g.getstring("Which is the max generation to test for?", "300", "HRF v0.1")) + 1
if maxgen < 2:
	g.exit("Null number")

def addStillLife():
	while True:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(g.parse(stillLife))
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")
			
def removeFirstLine(str):
	result = str.rsplit('\n')
	result.pop(0)
	return ''.join(result)
			
def addResultDesired():
	while True:
		herschelDesired = g.getstring("What result to find? (RLE)", "3o$obo$obo!", "HRF v0.1")
		herschels.append(g.parse(herschelDesired))
		addAnother = g.getstring("Add another result desired? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")

debug = False
addStillLife()
addResultDesired()
debug = g.getstring("Debug mode? (y|n)", "n", "HRF v0.1")
if debug.lower() == "y":
	debug = True
	g.autoupdate(True)
elif debug.lower() != "n":
	g.exit("Invalid letter!")
	
def testReaction(xpos, ypos, sli):
	global found
	global debug
	orig = g.getcells(g.getrect())
	g.putcells(stillLifes[sli], xpos, ypos)
	this = g.getcells(g.getrect())
	oldgeneration = g.getgen()
	for i in range(maxgen):
		oldpat = g.getcells(g.getrect())
		g.step()
		if g.getcells(g.getrect()) == oldpat or g.getcells(g.getrect()) == []:
			break
		for y in herschels:
			bf = g.getcells(g.getrect())
			g.putcells(y, g.getrect()[0], g.getrect()[1])
			if g.getcells(g.getrect()) == y:
				found = True
				break
			g.clear(1)
			g.clear(0)
			g.putcells(bf)
	else:
		g.show("No result found at x:" + str(xpos) + ", y:" + str(ypos) + ", still life " + str(sli))
	if debug:
		sleep(0.25)
	g.clear(1)
	g.setgen(oldgeneration)
	if found:
		g.putcells(this)
		g.exit("Found reaction!")
		return True
	else:
		g.putcells(orig)
		return False
		

def tests():
	global found
	for n in range(testrect[2]):
		for m in range(testrect[3]):
			for o in range(len(stillLifes)):
				testReaction(n + testrect[0], m + testrect[1], o)
				if found:
					return
tests()
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 18th, 2016, 7:49 pm

Something related to cell list comparison and worth noting: viewtopic.php?f=4&t=1993&p=26790#p26332
Gustavo6046 wrote:It's almost fixed, but I don't know why, once it matches, it don't stop:
I cannot get how to use your program, so I am not sure what your problem is. Please elaborate either what you expected, what your bugs are etc. (Edit: I should have been more specific myself. I didn't get what I should put inside the selection. The messages are a little ambiguous.)
Did you mean that Golly shows the 'Found pattern!' message but it continues searching, or does it not find any solutions? If you meant by the latter, chances are there isn't any Herschel-making solution.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 8:27 pm

1. The selection should be the area where the object can be placed (only the topleft part of it).
2. I put a block and a glider and they make a pi. When I select the block's topleft area and destroy the block and run HRF to put another block there and say "Found reaction!" (which would make it stop. Should it output to a file?) it simply doesn't find!

Btw I think I found a record-breaking backrake (in bounding box):

Code: Select all

x = 21, y = 20, rule = B3/S23
7bo5bo$6b3o3b3o$5b2obo3bob2o$5b3o5b3o$6b2o5b2o2$10bo$9b3o$8bo3bo$8bo3b
o2$8bo3bo$8bo3bo5bo$2b3o3b2ob2o4b3o$bo2bo4bobo5bob2o$4bo5bo7b3o$o3bo
13b3o$o3bo13b3o$4bo13b2o$bobo!
EDIT: I saw that link. I tried that g.evolve(0) method dvgrn said, inside that function you wrote, renaming it to celleq, but still it doesn't find!

Code: Select all

import golly as g
from sys import exit
from time import sleep

found = False

herschels = []

def celleq(self, other):
    return g.evolve(self, 0) == g.evolve(other, 0)  # Both hand sides are lists, not glife.patterns! No super() needed.

testrect = g.getselrect();
if testrect == []:
	g.exit("Select the area where the still life is placeable!")

if g.empty():
	g.exit("There is no pattern to add bait!")
	
stillLifes = []

maxgen = int(g.getstring("Which is the max generation to test for?", "300", "HRF v0.1")) + 1
if maxgen < 2:
	g.exit("Null number")

def addStillLife():
	while True:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(g.parse(stillLife))
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")
			
def removeFirstLine(str):
	result = str.rsplit('\n')
	result.pop(0)
	return ''.join(result)
			
def addResultDesired():
	while True:
		herschelDesired = g.getstring("What result to find? (RLE)", "3o$obo$obo!", "HRF v0.1")
		herschels.append(g.parse(herschelDesired))
		addAnother = g.getstring("Add another result desired? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")

debug = False
addStillLife()
addResultDesired()
debug = g.getstring("Debug mode? (y|n)", "n", "HRF v0.1")
if debug.lower() == "y":
	debug = True
	g.autoupdate(True)
elif debug.lower() != "n":
	g.exit("Invalid letter!")
	
def testReaction(xpos, ypos, sli):
	global found
	global debug
	orig = g.getcells(g.getrect())
	g.putcells(stillLifes[sli], xpos, ypos)
	this = g.getcells(g.getrect())
	oldgeneration = g.getgen()
	for i in range(maxgen):
		oldpat = g.getcells(g.getrect())
		g.step()
		if g.getcells(g.getrect()) == oldpat or g.getcells(g.getrect()) == []:
			break
		if celleq(g.getcells(g.getrect()), herschels[sli]):
			Found = True
			break
	else:
		g.show("No result found at x:" + str(xpos) + ", y:" + str(ypos) + ", still life " + str(sli))
	if debug:
		sleep(0.25)
	g.clear(0)
	g.clear(1)
	g.setgen(oldgeneration)
	if found:
		g.putcells(this)
		g.exit("Found reaction!")
		return True
	else:
		g.putcells(orig)
		return False
		

def tests():
	global found
	for n in range(testrect[2]):
		for m in range(testrect[3]):
			for o in range(len(stillLifes)):
				testReaction(n + testrect[0], m + testrect[1], o)
				if found:
					return
tests()
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 18th, 2016, 8:43 pm

Gustavo6046 wrote: The selection should be the area where the object can be placed (only the topleft part of it).
Yes, and I didn't know what object should be placed there. The still life or the glider or the methuselah? And why does the program ask to specify the still life again? What does it do? Things like that.
EDIT: I'm not sure what 'selecting topleft area' means.
Gustavo6046 wrote:I put a block and a glider and they make a pi. When I select the block's topleft area and destroy the block and run HRF to put another block there and say "Found reaction!" (which would make it stop. Should it output to a file?) it simply doesn't find!
Please elaborate. Do you mean it said "Found reaction" but didn't stop, or it didn't find anything?
Gustavo6046 wrote:Btw I think I found a record-breaking backrake (in bounding box):
Nice find, but it's known.
Part of Jason Summers' c2-extended/c2-0024.lif gives:

Code: Select all

x = 52, y = 99, rule = B3/S23
14b2o$13b4o$12b2ob2o6b2o$13b2o8bobo$23bo2$bo2bo$o16b2o$o3bo10b4o$4o4bo
4b2o$6b2o5bobo$6b3o5bo2bo4bo$6b2o5b2ob2obo3bo$4o4bo4b2ob2ob4o$o3bo10bo
5bo$o$bo2bo$10b4o$9b6o$8b2ob4o$9b2o2$19b2o$18b2ob2o$19b4o$20b2o11$16b
2o$14bo4bo$13bo$13bo5bo$13b6o2$2bo2bo$bo$bo3bo$b4o4bo7bo$7b2o9b2o$7b3o
7b2o$7b2o4bo$b4o4bo3bo$bo3bo$bo33bo$2bo2bo9b4o17b2o$14b6o15b2o$13b2ob
4o$14b2o15$16b2o$14bo4bo$13bo$13bo5bo$13b6o2$2bo2bo$bo$bo3bo$b4o4bo7bo
$7b2o9b2o$7b3o7b2o25b3o$7b2o4bo29b5o$b4o4bo3bo28b2ob3o$bo3bo37b2o$bo
33bo$2bo2bo9b4o17b2o$14b6o15b2o$13b2ob4o4bo2bo$14b2o7bo$23bo3bo11b2o$
23b4o11bo$29b3o2b2o7bo5b2o$29b3o2b2o8bo4b3o$29b3o2b2o7bo5b3o$23b4o11bo
9bob2o$23bo3bo11b2o7b3o$23bo25bo$24bo2bo!
Which contains your discovery.
Also I personally have a smaller rake:

Code: Select all

x = 15, y = 17, rule = B3/S23
4b2o$4ob2o$6o$b4o$11b4o$10bo3bo$5b2o7bo$4b4o2bo2bo$3bo3b2o$4b4o2bo2bo$
5b2o7bo$10bo3bo$11b4o$4b2o$b3ob2o$b5o$2b3o!

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Gustavo Ramos Rehermann's patterns

Post by dvgrn » January 18th, 2016, 8:47 pm

Gustavo6046 wrote:Btw I think I found a record-breaking backrake (in bounding box):

Code: Select all

x = 21, y = 20, rule = B3/S23...
If you want to break bounding-box records, why give the 21x20 phase when there's an 18x20 phase and a 19x19 phase, and several others smaller than 21x20?

As Scorbie says, before you make claims about breaking records, it would be nice if you'd take the time to look through Jason Summers' collections. You can also find that backrake in the broken-lines.mc pattern that's part of Golly's pattern collection.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 8:51 pm

Scorbie wrote:
Gustavo6046 wrote: The selection should be the area where the object can be placed (only the topleft part of it).
Yes, and I didn't know what object should be placed there. The still life or the glider or the methuselah?
The program puts the pattern you specified in the "What still life to test?" area, even if it isn't a still life. Useful e.g. when you put a small constellation and want to find possibly interesting glider collisions with it? Select a large area above it and put a SW/SE glider in that "What still life to test?" area!
Scorbie wrote:
Gustavo6046 wrote:I put a block and a glider and they make a pi. When I select the block's topleft area and destroy the block and run HRF to put another block there and say "Found reaction!" (which would make it stop. Should it output to a file?) it simply doesn't find!
Please elaborate. Do you mean it said "Found reaction" but didn't stop, or it didn't find anything?
It didn't find anything. Even when I put in a reaction that was already found manually, and then I remove the still life and run the program selecting the area of that still life.
Scorbie wrote:
Gustavo6046 wrote:Btw I think I found a record-breaking backrake (in bounding box):
Nice find, but it's known.
Part of Jason Summers' c2-extended/c2-0024.lif gives:

Code: Select all

x = 52, y = 99, rule = B3/S23
14b2o$13b4o$12b2ob2o6b2o$13b2o8bobo$23bo2$bo2bo$o16b2o$o3bo10b4o$4o4bo
4b2o$6b2o5bobo$6b3o5bo2bo4bo$6b2o5b2ob2obo3bo$4o4bo4b2ob2ob4o$o3bo10bo
5bo$o$bo2bo$10b4o$9b6o$8b2ob4o$9b2o2$19b2o$18b2ob2o$19b4o$20b2o11$16b
2o$14bo4bo$13bo$13bo5bo$13b6o2$2bo2bo$bo$bo3bo$b4o4bo7bo$7b2o9b2o$7b3o
7b2o$7b2o4bo$b4o4bo3bo$bo3bo$bo33bo$2bo2bo9b4o17b2o$14b6o15b2o$13b2ob
4o$14b2o15$16b2o$14bo4bo$13bo$13bo5bo$13b6o2$2bo2bo$bo$bo3bo$b4o4bo7bo
$7b2o9b2o$7b3o7b2o25b3o$7b2o4bo29b5o$b4o4bo3bo28b2ob3o$bo3bo37b2o$bo
33bo$2bo2bo9b4o17b2o$14b6o15b2o$13b2ob4o4bo2bo$14b2o7bo$23bo3bo11b2o$
23b4o11bo$29b3o2b2o7bo5b2o$29b3o2b2o8bo4b3o$29b3o2b2o7bo5b3o$23b4o11bo
9bob2o$23bo3bo11b2o7b3o$23bo25bo$24bo2bo!
Which contains your discovery.
Also I personally have a smaller rake:

Code: Select all

x = 15, y = 17, rule = B3/S23
4b2o$4ob2o$6o$b4o$11b4o$10bo3bo$5b2o7bo$4b4o2bo2bo$3bo3b2o$4b4o2bo2bo$
5b2o7bo$10bo3bo$11b4o$4b2o$b3ob2o$b5o$2b3o!
Well, life is going so why bother with a near-discovery that failed? :)
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 18th, 2016, 8:58 pm

Gustavo6046 wrote:Select a large area above it and put a SW/SE glider in that "What still life to test?" area!
Ahh, thank you. So for instance, I select (0,0)~(20,20) and put a SE glider in for instance, (0,0)?
Gustavo6046 wrote:It didn't find anything. Even when I put in a reaction that was already found manually
Okay, I see. Try to check if the cell lists are really equal etc. Print out various information to see if they come as you expected. I'm not sure how to debug the 'right' way, but I think with this you can pinpoint your problem in your code.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 18th, 2016, 9:03 pm

Scorbie wrote:
Gustavo6046 wrote:Select a large area above it and put a SW/SE glider in that "What still life to test?" area!
Ahh, thank you. So for instance, I select (0,0)~(20,20) and put a SE glider in for instance, (0,0)?
Actually, when you are prompted with the "Which still life to test?", you paste the glider's RLE (without header or linebreak) into the text area. :)

Also why don't you try the script for yourself just to get clear? This is the most updated HRF.py file:

Code: Select all

import golly as g
from sys import exit
from time import sleep

found = False

herschels = []

def celleq(self, other):
    return g.evolve(self, 0) == g.evolve(other, 0)  # Both hand sides are lists, not glife.patterns! No super() needed.

testrect = g.getselrect();
if testrect == []:
	g.exit("Select the area where the still life is placeable!")

if g.empty():
	g.exit("There is no pattern to add bait!")
	
stillLifes = []

maxgen = int(g.getstring("Which is the max generation to test for?", "300", "HRF v0.1")) + 1
if maxgen < 2:
	g.exit("Null number")

def addStillLife():
	while True:
		stillLife = g.getstring("What still life to test for? (RLE)", "2o$2o!", "HRF v0.1")
		stillLifes.append(g.parse(stillLife))
		addAnother = g.getstring("Add another still life? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")
			
def removeFirstLine(str):
	result = str.rsplit('\n')
	result.pop(0)
	return ''.join(result)
			
def addResultDesired():
	while True:
		herschelDesired = g.getstring("What result to find? (RLE)", "3o$obo$obo!", "HRF v0.1")
		herschels.append(g.parse(herschelDesired))
		addAnother = g.getstring("Add another result desired? (y|n)", "n", "HRF v0.1")
		if addAnother.lower() == "n":
			break
		elif addAnother.lower() != "y":
			g.exit("Invalid letter!")

debug = False
addStillLife()
addResultDesired()
debug = g.getstring("Debug mode? (y|n)", "n", "HRF v0.1")
if debug.lower() == "y":
	debug = True
	g.autoupdate(True)
elif debug.lower() != "n":
	g.exit("Invalid letter!")
	
def testReaction(xpos, ypos, sli):
	global found
	global debug
	orig = g.getcells(g.getrect())
	g.putcells(stillLifes[sli], xpos, ypos)
	this = g.getcells(g.getrect())
	oldgeneration = g.getgen()
	for i in range(maxgen):
		oldpat = g.getcells(g.getrect())
		g.step()
		if g.getcells(g.getrect()) == oldpat or g.getcells(g.getrect()) == []:
			break
		if celleq(g.getcells(g.getrect()), herschels[sli]):
			Found = True
			break
	else:
		g.show("No result found at x:" + str(xpos) + ", y:" + str(ypos) + ", still life " + str(sli))
	if debug == True:
		sleep(0.25)
	g.clear(0)
	g.clear(1)
	g.setgen(oldgeneration)
	if found:
		g.putcells(this)
		g.exit("Found reaction!")
		return True
	else:
		g.putcells(orig)
		return False
		

def tests():
	global found
	for n in range(testrect[2]):
		for m in range(testrect[3]):
			for o in range(len(stillLifes)):
				testReaction(n + testrect[0], m + testrect[1], o)
				if found:
					return
tests()
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 18th, 2016, 9:50 pm

Gustavo6046 wrote:Actually, when you are prompted with the "Which still life to test?", you paste the glider's RLE (without header or linebreak) into the text area. :)
That makes it more confusing.
Gustavo6046 wrote:Also why don't you try the script for yourself just to get clear? This is the most updated HRF.py file:
I did try your script but that didn't get any clearer.
Scorbie tried to help me, but he had no idea what he is doing.
I think you wanted to say:
he had no idea what I am doing.
Well your original sentence seems to be wrong, as I did know what I was doing, I just didn't understand what you were trying to do. Also, saying "one has no idea what oneself is doing" can be seen offensive.

Anyway, wish you good luck on debugging the program.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 19th, 2016, 8:06 am

This text field:
xOJdg1V.png
xOJdg1V.png (11.12 KiB) Viewed 182 times
Then when you are prompted what result you want, put everything you want the program to stop when it finds. :)

You are easily confused huh! In a UT match I would easily win, but no worries, this is no UT. :3

Edit: Also I found something, not that it's very useful:

Code: Select all

x = 14, y = 13, rule = LifeHistory
2.CBC$2.B2CB$3.C3B$4.4B$5.5B.2C$5.5BCDBC$4.7B2CB$4.6B2D2B$4.3B2C4B$2.
ECB.B2C$.E.EB$.E$2E!
I hope something can be extracted from it.
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 19th, 2016, 5:53 pm

How do I convert a cell list to a RLE without header? I am doing a glider collision search script right now...
Also is there some way of using oscar.py in my script?
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

mniemiec
Posts: 1590
Joined: June 1st, 2013, 12:00 am

Re: Gustavo Ramos Rehermann's patterns

Post by mniemiec » January 19th, 2016, 7:44 pm

Gustavo6046 wrote:How do I convert a cell list to a RLE without header? I am doing a glider collision search script right now...
Also is there some way of using oscar.py in my script?
This should be an elementary exercise in a Programming 101 course, in any language, much easier than a simple Life program.

User avatar
Gustavo6046
Posts: 647
Joined: December 7th, 2013, 6:26 pm
Location: Brazil.

Re: Gustavo Ramos Rehermann's patterns

Post by Gustavo6046 » January 19th, 2016, 8:07 pm

But converting a list into RLE is difficult.

Also this is the code (so far):

Code: Select all

#========== Initialization Script ==============#
import	golly	as		g
import	glife	as		g2
import	os
from	time	import	strftime

input = g2.pattern(g.getcells(g.getrect())) #Gets the input pattern to test for collisions
inputrect = g.getrect() #uses the initial pattern bounding box to our favor

for x in range(g.numlayers() - 1):
	g.dellayer()
g.new("GCS Field") #Empties the universe to do the search.

title = "GCS v0.1" #since const can't be declared on Python,
                   #simply declare a global var

glidertype = 0; #placeholder for when we have more kinds of spaceships

if not os.path.exists("GCS"):
    os.makedirs("GCOS")

gliders = [] #a list of collidable spaceships

gliders.append(g2.pattern("3o$o$bo!"))		#NW Glider
gliders.append(g2.pattern("3o$2bo$bo!"))	#NE Glider
gliders.append(g2.pattern("o$obo$2o!"))		#SW Glider
gliders.append(g2.pattern("2bo$obo$b2o!"))	#SE Glider

def get_user_int(prompt, initial):
	"Gets an int from the user (Golly-only command)."
	global title
	try:
		result = int(g.getstring(prompt, initial, title))
	except ValueError:
		g.warn("Invalid number!")
		return get_user_int(prompt, initial)
	else:
		return result

def get_user_string(prompt, initial):
	"Gets an string from the Golly user.\n\nThe main advantage is the lack of need of a title argument;\nit's usually hardcoded."
	global title
	return g.getstring(prompt, initial, title)

g.addlayer()
g.setlayer(0)
	
#============== Getting Input =================#

numgliders = get_user_int("What number of gliders to check?", "4")

#=========== Post-Initialization ==============#

#            |placeholder yay|

#============= Search Script ==================#

def put_gliders(xpos, ypos):
	global glidertype
	if xpos > inputrect[0] + (inputrect[2] / 2):
		if ypos > inputrect[1] - (inputrect[3] / 2):
			testglider = gliders[glidertype + 2]
		else:
			testglider = gliders[glidertype + 3]
	else:
		if ypos > inputrect[1] - (inputrect[3] / 2):
			testglider = gliders[glidertype + 0]
		else:
			testglider = gliders[glidertype + 1]
	testglider.put(xpos, ypos);

numruns = 1	

def test_gliders():
	global numruns
	output.write("\n")
	for x in range(inputrect[2]):
		for y in range(inputrect[3]):
			for z in range(numgliders):
				if not os.path.exists("GCS\\" + str(numruns)):
					os.makedirs("GCS\\" + str(numruns))
				put_gliders(x, y)
				starter = g2.pattern(g.getcells(g.getrect()))
				starter.save("GCS\\" + str(numruns) + "\\input.rle")
				g.run(25000)
				result = g2.pattern(g.getcells(g.getrect()))
				result.save("GCS\\" + str(numruns) + "\\output.rle")
				g.setlayer(1)
				result.put(g.getrect()[2] + 1, 0)
Not very good :(
*yawn* What a nothing-to-do day! Let's be the only person in the world to do CGOL during boring times. :)

User avatar
Scorbie
Posts: 1692
Joined: December 7th, 2013, 1:05 am

Re: Gustavo Ramos Rehermann's patterns

Post by Scorbie » January 19th, 2016, 8:15 pm

Maybe Golly already has the fn for converting cell lists to RLEs. I'm outside right now so can't tell. Go to Golly Help>Python Scripting to see the API and see if there is such a function.

User avatar
dvgrn
Moderator
Posts: 10612
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Gustavo Ramos Rehermann's patterns

Post by dvgrn » January 19th, 2016, 9:37 pm

Scorbie wrote:Maybe Golly already has the fn for converting cell lists to RLEs. I'm outside right now so can't tell. Go to Golly Help>Python Scripting to see the API and see if there is such a function.
No, Gustavo's right -- this is nontrivial. It's one of those functions that I keep looking for in Golly's Python scripting commands, because it must be there, but it never is.

Luckily Nathaniel wrote a function to accomplish this task, way back in the time of the Online Soup Search. Be warned -- cell lists with chunk size 3 were a strange new thing when this script was written. The chunk size is hard-coded to 2, so this will make an impressive mess out of patterns in multistate rules like LifeHistory.

Also, it looks to me as if the script assumes that the cell list is in left-to-right/top-to-bottom order, with no duplicate cells. So if that's not necessarily true for your cell list, you might want to run it through clist=g.evolve(clist,0) before passing it to this function.

-- I haven't tried running this script for a long time, but I remember it working just fine. Seems worth a try, anyway.

Other workable workarounds include creating a new layer, pasting in the pattern, and then

1) selecting and copying the pattern out to the clipboard and using g.getclipstr(). But it's not really a good idea to use the clipboard for a low-level task like this, at least without giving users clear warning. People might like what they have in their clipboard, and not want it to be suddenly clobbered by random junk.

Or

2) saving the new layer as a temporary file, opening the file, extracting the RLE, then deleting the file and removing the layer. That just seems like a silly amount of fiddling around, for something that Golly knows how to do perfectly well.

Thanks, Nathaniel!

Post Reply