towerator wrote:I have a question: once you get your script running, how can you find what are the resulting interesting patterns? Yes, I have tried "s", but it only shows what it found, not how...

Also, how to create mirrored patterns?

To find how apgsearch found a particular object, you must click one of the soup numbers to the right of its canonical representation to obtain the soup it came from. As for retrieving objects from soups before the latest census, here's an updated hashsoup script that not only accepts a symmetry as an input, but it creates an .ini file because I found that can be really useful if you want to keep the root the same.

Code: Select all

```
# hashsoup.py Convert soup string to soup
# Extracted from apgsearch.py v0.4, By Adam P. Goucher
#
# Modified by Arie Paap
# Sept. 2014
#
# More modifications by Richard Schank
# Feb. 2015
import golly as g
import hashlib
# Takes approximately 350 microseconds to construct a 16-by-16 soup based
# on a SHA-256 cryptographic hash in the obvious way.
def hashsoup(instring, sym):
s = hashlib.sha256(instring).digest()
thesoup = []
d = int(sym[0])
ox = int(sym[1])
oy = int(sym[2])
rx = int(sym[3])
ry = int(sym[4])
r4 = int(sym[5])
for j in xrange(32):
t = ord(s[j])
for k in xrange(8):
x = k + 8*(j % 2)
y = int(j / 2)
if t & (1 << (7 - k)):
if not d or x >= y:
thesoup.append(x)
thesoup.append(y)
if (d > 1) and x <= y:
thesoup.append(y)
thesoup.append(-x-(d==3))
# Standard soup:
if sym == "000000":
return thesoup
# Checks for diagonal symmetries:
if d:
for x in xrange(0, len(thesoup), 2):
thesoup.append(thesoup[x+1])
thesoup.append(thesoup[x])
if d > 1:
d = 2 - d
for x in xrange(0, len(thesoup), 2):
thesoup.append(d-thesoup[x+1])
thesoup.append(d-thesoup[x])
return thesoup
# Checks for orthogonal x symmetry:
if ox:
for x in xrange(0, len(thesoup), 2):
thesoup.append(thesoup[x])
thesoup.append(1-thesoup[x+1]-ox)
# Checks for orthogonal y symmetry:
if oy:
for x in xrange(0, len(thesoup), 2):
thesoup.append(1-thesoup[x]-oy)
thesoup.append(thesoup[x+1])
# Checks for rotate2 symmetry:
if rx:
rx = 1 - rx
for x in xrange(0, len(thesoup), 2):
thesoup.append(thesoup[x]+rx-15)
thesoup.append(thesoup[x+1])
for x in xrange(0, len(thesoup), 2):
thesoup.append(rx-thesoup[x])
thesoup.append(1-thesoup[x+1]-ry)
# Checks for rotate4 symmetry:
if r4:
r4 = 1 - r4
for x in xrange(0, len(thesoup), 2):
thesoup.append(r4-thesoup[x])
thesoup.append(r4-thesoup[x+1])
for x in xrange(0, len(thesoup), 2):
thesoup.append(thesoup[x+1])
thesoup.append(r4-thesoup[x])
return thesoup
# Checks if symmetry is a valid one.
def check(string):
symmetries = {"C1": [],
"C2": ["1", "2", "4"],
"C4": ["1", "4"],
"D2": ["+1", "+2", "x"],
"D4": ["+1", "+2", "+4", "x1", "x4"],
"D8": ["1", "4"]}
if len(string.split("_")) != 2:
if string == "C1":
return "C1"
g.exit("Please enter a valid symmetry.")
pr, z = string.split("_")
if symmetries.has_key(pr):
for part in symmetries[pr]:
if part == z:
return string
g.exit("Please enter a valid symmetry.")
# Converts human-readable symmetry to
# machine-readable symmetry
def convert(sym):
if sym == "C1":
return "000000"
pr, z = sym.split("_")
if pr == "C2":
if z == "1":
return "000110"
if z == "4":
return "000220"
else:
return "000210"
if pr == "C4":
if z == "1":
return "000001"
else:
return "000002"
if pr == "D2":
if z[0] == "+":
return "00%s000" % (z[1:])
else:
return "100000"
if pr == "D4":
if z[0] == "+":
ox = int(int(z[1:])/4)+1
oy = 2-(int(z[1:])%2)
return "0%d%d000" % (ox, oy)
if z[0] == "x":
if z[1:] == "1":
return "200000"
else:
return "300000"
if pr == "D8":
if z == "1":
return "111000"
else:
return "122000"
# Input the soup string:
HashsoupINIFileName = g.getdir("data") + "hashsoup.ini"
try:
f = open(HashsoupINIFileName, "r")
line = f.readline().split()
previousroot = line[0]
previousnum = line[1]
previoussymm = line[2]
f.close()
except:
previousroot = ""
previousnum = ""
previoussymm = ""
seed = g.getstring("Enter the desired soup seed:", previousroot, "Soup root string")
if not seed:
g.exit("Please enter a seed.")
soupnum = g.getstring("Enter soup number:", previousnum, "Soup number string")
if not soupnum:
g.exit("Please enter a soup number.")
symm = check(g.getstring("Enter symmetry:", previoussymm, "Symmetry"))
g.new("")
r = open(HashsoupINIFileName, "w")
r.write(seed + " " + soupnum + " " + symm)
r.close()
g.setname(seed + soupnum)
g.putcells(hashsoup(seed + soupnum, convert(symm)), 0, 0)
```

When you mention "mirrored patterns", you obviously mean soups with a certain symmetry, there's a

hacked version of apgsearch where I modified some of the code to account for symmetry options with proper notation. Just download the .zip file, and don't change the hashsoup function, I uploaded a version with the fix already in place, just find this line:

Code: Select all

`rootstring = g.getstring("What seed to use for this search (make this unique)?", datetime.datetime.now().isoformat()+"_Flipper77")`

And replace Flipper77 with whatever you want.

Note: If you didn't already know, the census results pop up when the search is over, using 's' is when you want to generate the census without waiting for it to end.