new-glider.py

For scripts to aid with computation or simulation in cellular automata.
Post Reply
User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

new-glider.py

Post by May13 » July 24th, 2022, 11:19 am

This is a script for reading databases like new-glider.db.
Script works like original glider.c, but it can read oscillators.db and databases for rules with hexagonal and (maybe) von Neumann neighborhood.

Code: Select all

from math import gcd
#Options
map_count_rules=True
file="new-gliders.db" #Name of database
wid=72 #Width of RLE (default: 72)
old_speed=False #if True, use format "2c/5 slope 2"; if False, use format "(2,1)c/5"
#
au="" #part of command (author)
map_char="0123456789abcdefghijklmnopqrstuvwxyz"
com_p="nuvpis/*"
disc_0=":UNKNOWN:"
files={"new-gliders.db": ("OT","glider",True), "oscillators.db": ("OT","oscillator",True), "hex-gliders.db": ("Hex","glider",True), "hex-oscillators.db": ("Hex","oscillator",True), "vn-gliders.db": ("von_Neumann","glider",True), "vn-oscillators.db": ("von_Neumann","oscillator",True)}
mode=files[file][0] #OT #Hex #von_Neumann
neighbors={"OT": 8, "Hex": 6, "von_Neumann": 4}
postfix={"OT": "", "Hex": "H", "von_Neumann": "V"}
type=files[file][1] #glider #oscillator
pat_type={"glider": ("Glider", "glider", "gliders"), "oscillator": ("Oscillator", "oscillator", "oscillators")}
auth_splitters=[[","],[";"],[" based"," by "],[" improved"," by "],[" reduced"," by "],[" and "],[" by D8_2 reduction of an existing ship"],[" by D8_2 reduction of "]]
auth_date=[[" before "],[" early ","s"],[" pre-"]]
hex_glider_impossible=[["2","012","2456","0123456","No gliders can exist: with B2/S012H, patterns can not shrink."],["23","01","23456","0123456","No gliders can exist: with B23/S01H, patterns can not shrink."],["234","0","23456","023456","No gliders can exist: with B234/S0H, patterns can not shrink."],["23","0234","2356","023456","No gliders can exist: with B23/S0234H, patterns can not permanently shrink."],["2","12345","23456","123456","No gliders can exist: with S12345H, connected patterns can not shrink"]]
hex_glider_impossible+=[["0123456","","0123456","",""],["012456","4","0123456","4",""],["012","5","0123456","45",""],["013456","4","013456","4",""],["01356","34","013456","34",""],["013","5","013456","345",""],["01","5","01456","2345",""],["016","1234","0156","1234",""],["01","15","0156","12345",""],["0","5","023456","012345",""]]
hex_glider_impossible+=[["012","","0123456","0123","No gliders can exist: with B012H and without S456H, patterns can not escape bounding orthogonal hexagon"]]
hex_glider_impossible+=[["0","","01","01","No gliders can exist: with B0H and without B23456/S23456H, patterns can not escape bounding orthogonal hexagon"]]
hex_glider_impossible+=[["01234","01234","0123456","012345","No gliders can exist: with B01234/S01234H and without S6H, patterns can not escape bounding orthogonal hexagon"]]
if mode == "Hex": glider_impossible=hex_glider_impossible
else: glider_impossible = []
g=gt=""
def load_db():
	global g, gt
	if files[file][2]==True:
		f=open(file)
		g=f.read()
		f.close()
	gt=g.split("\n")
	g=[i.split(":") for i in (gt[:-1] if gt[-1]=="" else gt)]
load_db()
def N1(): return neighbors[mode]+1
def pt(x): return pat_type[type][x]
int_to_trans=lambda x: "".join(str(i) for i in range(N1()) if x//(2**i)%2==1)
trans_to_int=lambda x: sum(2**i for i in range(N1()) if str(i) in x)
inv_trans=lambda x: "".join(str(i) for i in range(N1()) if not str(N1()-1-i) in x)
def authors(info):
	i=info
	for j in auth_splitters+auth_date:
		if len(j)==1:
			i=i.replace(j[0],":")
		elif len(j)==2:
			while j[0] in i:
				sliceA=i.find(j[0])
				sliceB=i.find(j[1],sliceA+len(j[0]))
				if sliceB<0: break
				i=i[:sliceA]+":"+i[sliceB+len(j[1]):]
	i=i.split(":")
	j=0
	while j < len(i):
		if i[j] in [""," "]:
			i.pop(j)
			continue
		if i[j][0]==" ": i[j]=i[j][1:]
		if i[j][-1]==" ": i[j]=i[j][:-1]
		if i[j].isnumeric() or (i[j][:-1].isnumeric() and i[j][-1]=="?"):
			i.pop(j)
			continue
		j+=1
	if i==[]: i=[disc_0]
	return i
def exclude(command,dx1,dy1,p1,p,info=""):
	if not au=="":
		if not au in authors(info): return True
	cond=False
	if "c" in command:
		vel=command
		for k in com_p:
			vel=vel.replace(k,"")
		vel=vel.split("c")
		if type=="oscillator":
			if vel[1]=="":
				if p==1: cond=True
			elif p==int(vel[1]): cond=True
		else:
			tdx=tdy=tp=0
			if vel[0]=="": tdx=1
			elif "," in vel[0]: tdx,tdy=[int(k) for k in vel[0].split(",")]
			else: tdx=int(vel[0])
			if "d" in vel[1]: tdy=tdx
			elif "k" in vel[1]: tdy=-1
			elif "o" in vel[1]: tdy=0
			elif not "," in vel[0]: tdy=-2
			tp=vel[1]
			for k in "odk": tp=tp.replace(k,"")
			if tp=="": tp=1
			else: tp=int(tp)
			if tdy==-1:
				if dy1>0 and dy1<dx1 and dx1*tp==tdx*p1: cond=True
			elif tdy==-2:
				if dx1*tp==tdx*p1: cond=True
			else:
				if dx1*tp==tdx*p1 and dy1*tp==tdy*p1: cond=True
	else:
		if "o" in command and dy1==0: cond=True
		elif "d" in command and dy1==dx1: cond=True
		elif "k" in command and dx1>dy1>0: cond=True
		elif not ("o" in command or "d" in command or "k" in command): cond=True
	return not cond
def tr4(width,index):
	if (index//width)%4 in [0,3]: return 0
	return 1
def detect_shift(d1,d2):
	if mode=="Hex":
		dx=int(d1)
		dy=int(d2)
		if dx<0 and dy>0:
			if dx+dy>0: dy+=dx
			else: dx+=dy
		elif dx>0 and dy<0:
			if dx+dy>0: dx+=dy
			else: dy+=dx
	else:
		dx=int(d1)
		dy=int(d2)
	return abs(dx), abs(dy)
def detect_speed(dx,dy,p):
	if "/" in p:
		mod=int(p.split("/")[1])
		p0=int(p[:-2])
	else:
		mod=1
		p0=int(p)
	dx0,dy0=max(dx,dy),min(dx,dy)
	gcd3=gcd(p0,gcd(dx0,dy0))
	p1=p0//gcd3
	dx1=dx0//gcd3
	dy1=dy0//gcd3
	return dx1,dy1,p1,p0,mod,gcd3
def get_rule_sets(min1,min2,max1,max2):
	minset1=set(min1[1:])
	maxset1=set(max1[1:])
	if mode in ["Hex","von_Neumann"]:
		minset2=set(min2[1:-1])
		maxset2=set(max2[1:-1])
	else:
		minset2=set(min2[1:])
		maxset2=set(max2[1:])
	return minset1,minset2,maxset1,maxset2
def print_rule_simple(amin1,amin2,amax1,amax2,agens):
	anumstr="".join(str(i) for i in range(N1()))
	print("#C B"+anumstr+" S"+anumstr+(" G"+str(agens) if agens>2 else "")+(" "+postfix[mode] if len(postfix[mode])>0 else ""))
	bs=""
	ss=""
	minset1,minset2,maxset1,maxset2=get_rule_sets(amin1,amin2,amax1,amax2)
	for i1 in range(N1()):
		if str(i1) not in maxset1: bs+="-"
		elif str(i1) in minset1: bs+="X"
		else: bs+=" "
		if str(i1) not in maxset2: ss+="-"
		elif str(i1) in minset2: ss+="X"
		else: ss+=" "
	print("#C  "+bs+"  "+ss+"\n#C")
def print_RLE(ax,ay,arul,RLE):
	print("x = "+ax+", y = "+ay+", rule = "+arul)
	t1=""
	t0=""
	k=0
	for j in RLE:
		if j in "bo$":
			if len(t0)+len(t1)>=wid:
				print(t1)
				t1=t0+j
				k=0
			else:
				t1+=t0+j
			t0=""
		else: t0+=j
		k+=1
		if j=="!":
			if len(t1)==wid: print(t1+"\n!")
			else: print(t1+"!")
def glider(n,rul="",com=":"):
	gi=g[n-1]
	if rul=="": rul=gi[2]
	x1,x2=rul.split("/")
	min1,min2=gi[2].split("/")
	max1,max2=gi[3].split("/")
	if (set(min1) <= set(x1) <= set(max1)) and (set(min2) <= set(x2) <= set(max2)):
		if True:
			dx, dy=detect_shift(gi[5],gi[6])
			dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,gi[4])
			if com!=":" and exclude(com,dx1,dy1,p1,p,g[i][1]): return False
			if dx1==1: dx2=""
			else: dx2=dx1
			if dx==dy and dx1==0:
				if p==1: speed=", still life"
				else: speed=f", period {p}"+(f" (mod {p//mod})" if mod>1 else "")
			elif dy1==0: speed=f", {dx2}c/{p1} orthogonal"
			elif dy==dx: speed=f", {dx2}c/{p1} diagonal"
			else:
				if old_speed:
					sg=gcd(dx1,p1)
					if dx1==sg: dx3=""
					else: dx3=dx1//sg
					if p1==sg: p3=""
					else: p3=f"/{p1//sg}"
					sg1=gcd(dx1,dy1)
					if dy1==sg1: dy4=""
					else: dy4="/{dy1//sg1}"
					dx4=dx1//sg1
					speed=f", {dx3}c{p3} slope {dx4}{dy4}"
					if sg>1: speed+=" (period "+str(p)+")"
				else: speed=f", ({dx1},{dy1})c/{p1}"
			if not (dx==dy and dx1==0):
				if mod==2: speed+=" (period "+str(p)+"/2)"
				elif gcd3>1: speed+=" (period "+str(p)+")"
			if gi[0]=="": print("#C "+pat_type[type][0]+" "+str(n)+speed)
			else: print("#C The "+gi[0]+" ("+pat_type[type][1]+" "+str(n)+")"+speed)
			if gi[1]!="": print("#C Discovered by "+gi[1]+"\n#C")
			else: print("#C")
			print_rule_simple(min1,min2,max1,max2,2)
			print_RLE(gi[7],gi[8],rul,gi[9])
			return True
	return False
def create_map(m1,d1,m2,d2,command=""):
	mapset=False
	if "v" in command or "u" in command: mapset=True
	if mapset: map=[set() for i in range(4**(neighbors[mode]+1))]
	else: map=[0]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				ak=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: ak+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				if ak%2==1:
					b0_a=trans_to_int(inv_trans(int_to_trans(ak%(2**N1()))))*(2**N1())+trans_to_int(inv_trans(int_to_trans(ak//(2**N1()))))
				for add1 in [ak]+([b0_a] if ak%2==1 else []):
					if mapset:
						if "u" in command: map[add1].add((max(dx,dy),min(dx,dy),p))
						else: map[add1].add((dx1,dy1,p1))
					elif "p" in command:
						if map[add1]==0: map[add1]=p
						else: map[add1]=max(map[add1],p)
					elif "i" in command:
						if map[add1]==0: map[add1]=p1
						else: map[add1]=max(map[add1],p1)
					elif "s" in command:
						if map[add1]==0: map[add1]=max(int(i[7]),int(i[8]))
						else: map[add1]=min(map[add1],max(int(i[7]),int(i[8])))
					else: map[add1]+=1
	colsM=sum(2**int(i) for i in m1)
	rowsM=sum(2**int(i) for i in m2)
	cols=[colsM+sum(2**int(d1[j])*tr4(2**(len(d1)-j-1),i) for j in range(len(d1))) for i in range(2**len(d1))]
	rows=[rowsM+sum(2**int(d2[j])*tr4(2**(len(d2)-j-1),i) for j in range(len(d2))) for i in range(2**len(d2))]
	text=" "*(len(m2)+len(d2)+3)+" B"*2**len(d1)+"\n"
	for i in m1:
		text+=" "*(len(m2)+len(d2)+3)+(" "+i)*2**len(d1)+"\n"
	for i in d1:
		text+=" "*(len(m2)+len(d2)+4)
		for j in cols:
			if j//(2**int(i))%2==1: text+=i+" "
			else: text+="  "
		text+="\n"
	text+=" "*(len(m2)+len(d2)+3)+"-"*2**len(d1)*2+"\n"
	q=[]
	co1=0
	co2=0
	for i in rows:
		text+="S"+m2
		for j in d2:
			if i//(2**int(j))%2==1: text+=j
			else: text+=" "
		text+=" :"
		for j in cols:
			non_im=True
			for k in glider_impossible:
				if (set(k[0]) <= set(int_to_trans(j)) <= set(k[2])) and (set(k[1]) <= set(int_to_trans(i)) <= set(k[3])):
					text+="  "
					non_im=False
			if non_im and j%2==1:
				for k0 in glider_impossible:
					if (set(k0[0]) <= set(inv_trans(int_to_trans(i))) <= set(k0[2])) and (set(k0[1]) <= set(inv_trans(int_to_trans(j))) <= set(k0[3])):
						text+="  "
						non_im=False
			if non_im:
				co1+=1
				t=map[i*2**N1()+j]
				if mapset: t=len(t)
				ti=t
				if t>35: t="X"
				elif t==0: t="."
				else: t=map_char[t]
				if not t==".": co2+=1
				text+=" "+t
			else:
				t=map[i*2**N1()+j]
				if mapset:
					if len(t)>0:
						print("Error!")
						print(t)
				else:
					if t>0:
						print("Error!")
						print(t)
		text+="\n"
	print(text)
	if map_count_rules: print(f"\n{co2}/{co1}")
def create_list(command=""):
	print(f"Totalistic rules for which {command}{'' if command=='' else ' '}{pt(2)}{' discovered by '+au if not au=='' else ''} are known:\n\n    B{''.join(str(i) for i in range(N1()))} S{''.join(str(i) for i in range(N1()))} {postfix[mode]}")
	map=[False]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				add1=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: add1+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				map[add1]=True
	num=0
	for i in range(4**N1()):
		j=bin(4**N1()-i-1)[2:]
		j=j[::-1]+"0"*(2*N1()-len(j))
		j=int(j,2)
		if map[j]:
			num+=1
			text="     "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			text+="  "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			print(text)
	print(f"\nTotal: {num} rules\n")
def all_discoverers(command=""):
	a={}
	b={}
	d={}
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		j=authors(i[1])
		for k in j:
			if k in a:
				a[k]+=1
				b[k]+=1/len(j)
				d[k]+=1 if len(j)>1 else 0
			else:
				a[k]=1
				b[k]=1/len(j)
				d[k]=1 if len(j)>1 else 0
	l=12
	for i in a.keys():
		l=max(l,len(i))
	c=sorted(a.items(), key=lambda x: x[1])[::-1]
	print(f"\nAll discoverers of {command}{'' if command=='' else ' '}{pt(2)}:\n")
	print("    Discoverer"+" "*(l-6)+"Total   Partial      Shared\n")
	for i in c:
		pA = i[0]
		pB = str(i[1])
		pC = str(round(b[i[0]], 4))
		pD = str(d[i[0]])
		print("    "+pA+" "*(l-len(pA)+4)+pB+" "*(8-len(pB))+pC+" "*(13-len(pC))+pD)
	print(f"\nTotal: {len(c)} discoverers\n")
def all_gliders(command=""):
	print()
	for i in range(len(g)):
		dx,dy=detect_shift(g[i][5],g[i][6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,g[i][4])
		if exclude(command,dx1,dy1,p1,p,g[i][1]): continue
		glider(i+1)
		print()
usage_glider=f"""usage:
  glider n        to output the nth known glider
  glider _n       to output the nth row from the database
  glider B3/S23   to list known gliders for this rule (add "=" before additional options)
  glider -string  to list rules having gliders with matching speed and direction
  glider )string  to chart matching gliders for each rule with B0 and without S8
  glider @string  to chart matching gliders for each rule with B2
  glider #string  to chart matching gliders for each rule with B3
  glider @#string to chart matching gliders for each rule with B23
  glider *        to list all gliders
  glider a        to list all discoverers

options for -, @, and # (multiple options must be in the given order):
  n               to chart counts of the number of known gliders (the default)
  u               to chart counts of the number of known unsimplified speeds
  v               to chart counts of the number of known simplified speeds
  p               to chart the maximum known glider unsimplified period
  i               to chart the maximum known glider simplified period
  s               to chart the minimum known glider size
  MMc/NN          to chart only gliders with the given speed
  XX,YYc/PP       to chart only gliders with the given speed (XX is greater than YY)
  d               to chart only gliders that move diagonally
  k               to chart only gliders that move at a knights move or other off-slope
  o               to chart only gliders that move orthogonally
  :PERSON         to chart only gliders discovered by specified person
"""
usage_oscillator=f"""usage:
  glider n        to output the nth known oscillator
  glider _n       to output the nth row from the database
  glider B3/S23   to list known oscillators for this rule (add "=" before additional options)
  glider -string  to list rules having oscillators with matching period
  glider )string  to chart matching oscillators for each rule with B0 and without S8
  glider !string  to chart matching oscillators for each rule with B1
  glider @string  to chart matching oscillators for each rule with B2
  glider #string  to chart matching oscillators for each rule with B3
  glider @#string to chart matching oscillators for each rule with B23
  glider ;string  to chart matching oscillators for each rule without B0, B1, B2 or B3
  glider *        to list all oscillators
  glider a        to list all discoverers

options for -, @, and # (multiple options must be in the given order):
  n               to chart counts of the number of known oscillators (the default)
  p               to chart the maximum known oscillator period
  s               to chart the minimum known oscillator size
  cPP             to chart only oscillator with the given period
  :PERSON         to chart only oscillators discovered by specified person
"""
while True:
	com=input(">>>")
	if ":" in com:
		com,au=com.split(":")
		if au=="": au=disc_0
	else: au=""
	if com.isnumeric():
		if int(com)>len(g): print(f"only {len(g)} {pat_type[type][2]} are known")
		elif com=="0": print("numbering starts from 1")
		else: glider(int(com))
		print()
	elif com.startswith(")"):
		if mode=="OT": create_map("0","12345678","","01234567",com[1:])
		elif mode=="Hex": create_map("0","123456","","012345",com[1:])
		elif mode=="von_Neumann": create_map("0","1234","","0123",com[1:])
	elif com.startswith("@#"):
		if mode=="OT": create_map("23","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("23","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("23","4","","01234",com[1:])
	elif com.startswith("!"):
		if mode=="OT": create_map("1","2345678","","012345678",com[1:])
		elif mode=="Hex": create_map("1","23456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("1","234","","01234",com[1:])
	elif com.startswith("@"):
		if mode=="OT": create_map("2","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("2","3456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("2","34","","01234",com[1:])
	elif com.startswith("#"):
		if mode=="OT": create_map("3","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("3","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("3","4","","01234",com[1:])
	elif com.startswith(";"):
		if mode=="OT": create_map("","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("","4","","01234",com[1:])
	elif com.startswith("-"):
		create_list(com[1:])
	elif "/" in com and ((not "c/" in com) or "B" in com):
		if "=" in com: com = com.split("=")
		else: com = [com,""]
		comB, comS=com[0].replace(postfix[mode],"").replace("B","").replace("S","").split("/")
		for k in glider_impossible:
			if (set(k[0]) <= set(comB) <= set(k[2])) and (set(k[1]) <= set(comS) <= set(k[3])):
				print(k[4])
				break
		else:
			no=True
			for i in range(len(g)):
				if glider(i+1,com[0],com[1]):
					print()
					no=False
				if "0" in comB:
					if glider(i+1,"B"+inv_trans(comS)+"/S"+inv_trans(comB)+postfix[mode]):
						print()
						no=False
			if no: print("No gliders are known.")
	elif com.startswith("_"):
		try: print(gt[int(com[1:])-1])
		except: print("Invalid command!")
	elif com.startswith("*"): all_gliders(com[1:])
	elif com.startswith("a"): all_discoverers(com[1:])
	elif com in ["","c","help","usage","?"]:
		if type=="glider": print(usage_glider)
		else: print(usage_oscillator)
	elif com in ["update","refresh","reload"]:
		try:
			load_db()
			print("Database reloaded")
		except:
			print("Failed to reload database")
	elif com in ["quit","exit"]: break
To read a specific database, rewrite line 4 like [file = "oscillators.db"].
Test commands:

Code: Select all

#####For new-gliders.db
B38/S23=2,1c/6   #the Sprayer
a2,1c/5   #all discoverers of (2,1)c/5 spaceships
a:   #number of gliders discovered by unknown people
#v   #counts of the numbers of known glider simplified speeds in B3 rules
###For example: B3/S35 has 3 simplified speeds (c/2o, c/3o, c/4o)
#v   #counts of the numbers of known glider unsimplified speeds in B3 rules
###For example: B3/S35 has 5 unsimplified speeds (c/2o, 2c/4o, 4c/8o, c/3o, c/4o)
_22222   #DB string of an oblique spaceship in Pedestrian Life
#####For oscillators.db
B3/S23=c43   #p43 Snark loop
#c41   #map of B3 rules with known p41 oscillators
B3/S23:carybe   #p36 shuttle
To do:
  • Solve potential issues with B0 maps
  • Rework "-" option and implement "+" option (to list redundant gliders/oscillators)
  • Figure out which rules cannot contain oscillators/spaceships and rework "glider_impossible" for databases other than hex-gliders.db
  • Add option to search for pattern by name
  • Make code more readable
Edit (31 December 2023): updated script (one bug fixed and B0 maps made symmetrical):

Code: Select all

from math import gcd
#Options
map_count_rules=True
file="hex-gliders.db" #Name of database
wid=72 #Width of RLE (default: 72)
old_speed=False #if True, use format "2c/5 slope 2"; if False, use format "(2,1)c/5"
#
au="" #part of command (author)
map_char="0123456789abcdefghijklmnopqrstuvwxyz"
com_p="nuvpis/*"
disc_0=":UNKNOWN:"
files={"new-gliders.db": ("OT","glider",True), "oscillators.db": ("OT","oscillator",True), "hex-gliders.db": ("Hex","glider",True), "hex-oscillators.db": ("Hex","oscillator",True), "vn-gliders.db": ("von_Neumann","glider",True), "vn-oscillators.db": ("von_Neumann","oscillator",True)}
mode=files[file][0] #OT #Hex #von_Neumann
neighbors={"OT": 8, "Hex": 6, "von_Neumann": 4}
postfix={"OT": "", "Hex": "H", "von_Neumann": "V"}
type=files[file][1] #glider #oscillator
pat_type={"glider": ("Glider", "glider", "gliders"), "oscillator": ("Oscillator", "oscillator", "oscillators")}
auth_splitters=[[","],[";"],[" based"," by "],[" improved"," by "],[" reduced"," by "],[" and "],[" by D8_2 reduction of an existing ship"],[" by D8_2 reduction of "]]
auth_date=[[" before "],[" early ","s"],[" pre-"]]
hex_glider_impossible=[["2","012","2456","0123456","No gliders can exist: with B2/S012H, patterns can not shrink."],["23","01","23456","0123456","No gliders can exist: with B23/S01H, patterns can not shrink."],["234","0","23456","023456","No gliders can exist: with B234/S0H, patterns can not shrink."],["23","0234","2356","023456","No gliders can exist: with B23/S0234H, patterns can not permanently shrink."],["2","12345","23456","123456","No gliders can exist: with S12345H, connected patterns can not shrink"]]
hex_glider_impossible+=[["0123456","","0123456","",""],["012456","4","0123456","4",""],["012","5","0123456","45",""],["013456","4","013456","4",""],["01356","34","013456","34",""],["013","5","013456","345",""],["01","5","01456","2345",""],["016","1234","0156","1234",""],["01","15","0156","12345",""],["0","5","023456","012345",""]]
hex_glider_impossible+=[["012","","0123456","0123","No gliders can exist: with B012H and without S456H, patterns can not escape bounding orthogonal hexagon"]]
hex_glider_impossible+=[["0","","01","01","No gliders can exist: with B0H and without B23456/S23456H, patterns can not escape bounding orthogonal hexagon"]]
hex_glider_impossible+=[["01234","01234","0123456","012345","No gliders can exist: with B01234/S01234H and without S6H, patterns can not escape bounding orthogonal hexagon"]]
if mode == "Hex": glider_impossible=hex_glider_impossible
else: glider_impossible = []
g=gt=""
def load_db():
	global g, gt
	if files[file][2]==True:
		f=open(file)
		g=f.read()
		f.close()
	gt=g.split("\n")
	g=[i.split(":") for i in (gt[:-1] if gt[-1]=="" else gt)]
load_db()
def N1(): return neighbors[mode]+1
def pt(x): return pat_type[type][x]
int_to_trans=lambda x: "".join(str(i) for i in range(N1()) if x//(2**i)%2==1)
trans_to_int=lambda x: sum(2**i for i in range(N1()) if str(i) in x)
inv_trans=lambda x: "".join(str(i) for i in range(N1()) if not str(N1()-1-i) in x)
def authors(info):
	i=info
	for j in auth_splitters+auth_date:
		if len(j)==1:
			i=i.replace(j[0],":")
		elif len(j)==2:
			while j[0] in i:
				sliceA=i.find(j[0])
				sliceB=i.find(j[1],sliceA+len(j[0]))
				if sliceB<0: break
				i=i[:sliceA]+":"+i[sliceB+len(j[1]):]
	i=i.split(":")
	j=0
	while j < len(i):
		if i[j] in [""," "]:
			i.pop(j)
			continue
		if i[j][0]==" ": i[j]=i[j][1:]
		if i[j][-1]==" ": i[j]=i[j][:-1]
		if i[j].isnumeric() or (i[j][:-1].isnumeric() and i[j][-1]=="?"):
			i.pop(j)
			continue
		j+=1
	if i==[]: i=[disc_0]
	return i
def exclude(command,dx1,dy1,p1,p,info=""):
	if not au=="":
		if not au in authors(info): return True
	cond=False
	if "c" in command:
		vel=command
		for k in com_p:
			vel=vel.replace(k,"")
		vel=vel.split("c")
		if type=="oscillator":
			if vel[1]=="":
				if p==1: cond=True
			elif p==int(vel[1]): cond=True
		else:
			tdx=tdy=tp=0
			if vel[0]=="": tdx=1
			elif "," in vel[0]: tdx,tdy=[int(k) for k in vel[0].split(",")]
			else: tdx=int(vel[0])
			if "d" in vel[1]: tdy=tdx
			elif "k" in vel[1]: tdy=-1
			elif "o" in vel[1]: tdy=0
			elif not "," in vel[0]: tdy=-2
			tp=vel[1]
			for k in "odk": tp=tp.replace(k,"")
			if tp=="": tp=1
			else: tp=int(tp)
			if tdy==-1:
				if dy1>0 and dy1<dx1 and dx1*tp==tdx*p1: cond=True
			elif tdy==-2:
				if dx1*tp==tdx*p1: cond=True
			else:
				if dx1*tp==tdx*p1 and dy1*tp==tdy*p1: cond=True
	else:
		if "o" in command and dy1==0: cond=True
		elif "d" in command and dy1==dx1: cond=True
		elif "k" in command and dx1>dy1>0: cond=True
		elif not ("o" in command or "d" in command or "k" in command): cond=True
	return not cond
def tr4(width,index):
	if (index//width)%4 in [0,3]: return 0
	return 1
def detect_shift(d1,d2):
	if mode=="Hex":
		dx=int(d1)
		dy=int(d2)
		if dx<0 and dy>0:
			if dx+dy>0: dy+=dx
			else: dx+=dy
		elif dx>0 and dy<0:
			if dx+dy>0: dx+=dy
			else: dy+=dx
	else:
		dx=int(d1)
		dy=int(d2)
	return abs(dx), abs(dy)
def detect_speed(dx,dy,p):
	if "/" in p:
		mod=int(p.split("/")[1])
		p0=int(p[:-2])
	else:
		mod=1
		p0=int(p)
	dx0,dy0=max(dx,dy),min(dx,dy)
	gcd3=gcd(p0,gcd(dx0,dy0))
	p1=p0//gcd3
	dx1=dx0//gcd3
	dy1=dy0//gcd3
	return dx1,dy1,p1,p0,mod,gcd3
def get_rule_sets(min1,min2,max1,max2):
	minset1=set(min1[1:])
	maxset1=set(max1[1:])
	if mode in ["Hex","von_Neumann"]:
		minset2=set(min2[1:-1])
		maxset2=set(max2[1:-1])
	else:
		minset2=set(min2[1:])
		maxset2=set(max2[1:])
	return minset1,minset2,maxset1,maxset2
def print_rule_simple(amin1,amin2,amax1,amax2,agens):
	anumstr="".join(str(i) for i in range(N1()))
	print("#C B"+anumstr+" S"+anumstr+(" G"+str(agens) if agens>2 else "")+(" "+postfix[mode] if len(postfix[mode])>0 else ""))
	bs=""
	ss=""
	minset1,minset2,maxset1,maxset2=get_rule_sets(amin1,amin2,amax1,amax2)
	for i1 in range(N1()):
		if str(i1) not in maxset1: bs+="-"
		elif str(i1) in minset1: bs+="X"
		else: bs+=" "
		if str(i1) not in maxset2: ss+="-"
		elif str(i1) in minset2: ss+="X"
		else: ss+=" "
	print("#C  "+bs+"  "+ss+"\n#C")
def print_RLE(ax,ay,arul,RLE):
	print("x = "+ax+", y = "+ay+", rule = "+arul)
	t1=""
	t0=""
	k=0
	for j in RLE:
		if j in "bo$":
			if len(t0)+len(t1)>=wid:
				print(t1)
				t1=t0+j
				k=0
			else:
				t1+=t0+j
			t0=""
		else: t0+=j
		k+=1
		if j=="!":
			if len(t1)==wid: print(t1+"\n!")
			else: print(t1+"!")
def glider(n,rul="",com=":"):
	gi=g[n-1]
	if rul=="": rul=gi[2]
	x1,x2=rul.split("/")
	min1,min2=gi[2].split("/")
	max1,max2=gi[3].split("/")
	if (set(min1) <= set(x1) <= set(max1)) and (set(min2) <= set(x2) <= set(max2)):
		if True:
			dx, dy=detect_shift(gi[5],gi[6])
			dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,gi[4])
			if com!=":" and exclude(com,dx1,dy1,p1,p,g[i][1]): return False
			if dx1==1: dx2=""
			else: dx2=dx1
			if dx==dy and dx1==0:
				if p==1: speed=", still life"
				else: speed=f", period {p}"+(f" (mod {p//mod})" if mod>1 else "")
			elif dy1==0: speed=f", {dx2}c/{p1} orthogonal"
			elif dy==dx: speed=f", {dx2}c/{p1} diagonal"
			else:
				if old_speed:
					sg=gcd(dx1,p1)
					if dx1==sg: dx3=""
					else: dx3=dx1//sg
					if p1==sg: p3=""
					else: p3=f"/{p1//sg}"
					sg1=gcd(dx1,dy1)
					if dy1==sg1: dy4=""
					else: dy4="/{dy1//sg1}"
					dx4=dx1//sg1
					speed=f", {dx3}c{p3} slope {dx4}{dy4}"
					if sg>1: speed+=" (period "+str(p)+")"
				else: speed=f", ({dx1},{dy1})c/{p1}"
			if not (dx==dy and dx1==0):
				if mod==2: speed+=" (period "+str(p)+"/2)"
				elif gcd3>1: speed+=" (period "+str(p)+")"
			if gi[0]=="": print("#C "+pat_type[type][0]+" "+str(n)+speed)
			else: print("#C The "+gi[0]+" ("+pat_type[type][1]+" "+str(n)+")"+speed)
			if gi[1]!="": print("#C Discovered by "+gi[1]+"\n#C")
			else: print("#C")
			print_rule_simple(min1,min2,max1,max2,2)
			print_RLE(gi[7],gi[8],rul,gi[9])
			return True
	return False
def create_map(m1,d1,m2,d2,command=""):
	mapset=False
	if "v" in command or "u" in command: mapset=True
	if mapset: map=[set() for i in range(4**(neighbors[mode]+1))]
	else: map=[0]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				ak=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: ak+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				if ak%2==1:
					b0_a=trans_to_int(inv_trans(int_to_trans(ak%(2**N1()))))*(2**N1())+trans_to_int(inv_trans(int_to_trans(ak//(2**N1()))))
				for add1 in [ak]+([b0_a] if ak%2==1 else []):
					if mapset:
						if "u" in command: map[add1].add((max(dx,dy),min(dx,dy),p))
						else: map[add1].add((dx1,dy1,p1))
					elif "p" in command:
						if map[add1]==0: map[add1]=p
						else: map[add1]=max(map[add1],p)
					elif "i" in command:
						if map[add1]==0: map[add1]=p1
						else: map[add1]=max(map[add1],p1)
					elif "s" in command:
						if map[add1]==0: map[add1]=max(int(i[7]),int(i[8]))
						else: map[add1]=min(map[add1],max(int(i[7]),int(i[8])))
					else: map[add1]+=1
	colsM=sum(2**int(i) for i in m1)
	rowsM=sum(2**int(i) for i in m2)
	cols=[colsM+sum(2**int(d1[j])*tr4(2**(len(d1)-j-1),i) for j in range(len(d1))) for i in range(2**len(d1))]
	#if '0' in m1: rows=[rowsM+sum(2**int(d2[j])*((i//2**(j))%2) for j in range(len(d2))) for i in range(2**len(d2))]
	if '0' in m1: rows=[rowsM+sum(2**int(d2[j])*(1-(tr4(2**(j),i))) for j in range(len(d2))) for i in range(2**len(d2))]
	else: rows=[rowsM+sum(2**int(d2[j])*tr4(2**(len(d2)-j-1),i) for j in range(len(d2))) for i in range(2**len(d2))]
	#print([sum(2**int(d2[j])*((i//2**(j))%2) for j in range(len(d2))) for i in range(2**len(d2))])
	text=" "*(len(m2)+len(d2)+3)+" B"*2**len(d1)+"\n"
	for i in m1:
		text+=" "*(len(m2)+len(d2)+3)+(" "+i)*2**len(d1)+"\n"
	for i in d1:
		text+=" "*(len(m2)+len(d2)+4)
		for j in cols:
			if j//(2**int(i))%2==1: text+=i+" "
			else: text+="  "
		text+="\n"
	text+=" "*(len(m2)+len(d2)+3)+"-"*2**len(d1)*2+"\n"
	q=[]
	co1=0
	co2=0
	for i in rows:
		text+="S"+m2
		for j in d2:
			if i//(2**int(j))%2==1: text+=j
			else: text+=" "
		text+=" :"
		for j in cols:
			non_im=True
			for k in glider_impossible:
				if (set(k[0]) <= set(int_to_trans(j)) <= set(k[2])) and (set(k[1]) <= set(int_to_trans(i)) <= set(k[3])):
					text+="  "
					non_im=False
					break
			if non_im and j%2==1:
				for k0 in glider_impossible:
					if (set(k0[0]) <= set(inv_trans(int_to_trans(i))) <= set(k0[2])) and (set(k0[1]) <= set(inv_trans(int_to_trans(j))) <= set(k0[3])):
						text+="  "
						non_im=False
						break
			if non_im:
				co1+=1
				t=map[i*2**N1()+j]
				if mapset: t=len(t)
				ti=t
				if t>35: t="X"
				elif t==0: t="."
				else: t=map_char[t]
				if not t==".": co2+=1
				text+=" "+t
			else:
				t=map[i*2**N1()+j]
				if mapset:
					if len(t)>0:
						print("Error!")
						print(t)
				else:
					if t>0:
						print("Error!")
						print(t)
		text+="\n"
	print(text)
	if map_count_rules: print(f"\n{co2}/{co1}")
def create_list(command=""):
	print(f"Totalistic rules for which {command}{'' if command=='' else ' '}{pt(2)}{' discovered by '+au if not au=='' else ''} are known:\n\n    B{''.join(str(i) for i in range(N1()))} S{''.join(str(i) for i in range(N1()))} {postfix[mode]}")
	map=[False]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				add1=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: add1+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				map[add1]=True
	num=0
	for i in range(4**N1()):
		j=bin(4**N1()-i-1)[2:]
		j=j[::-1]+"0"*(2*N1()-len(j))
		j=int(j,2)
		if map[j]:
			num+=1
			text="     "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			text+="  "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			print(text)
	print(f"\nTotal: {num} rules\n")
def all_discoverers(command=""):
	a={}
	b={}
	d={}
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[1]): continue
		j=authors(i[1])
		for k in j:
			if k in a:
				a[k]+=1
				b[k]+=1/len(j)
				d[k]+=1 if len(j)>1 else 0
			else:
				a[k]=1
				b[k]=1/len(j)
				d[k]=1 if len(j)>1 else 0
	l=12
	for i in a.keys():
		l=max(l,len(i))
	c=sorted(a.items(), key=lambda x: x[1])[::-1]
	print(f"\nAll discoverers of {command}{'' if command=='' else ' '}{pt(2)}:\n")
	print("    Discoverer"+" "*(l-6)+"Total   Partial      Shared\n")
	for i in c:
		pA = i[0]
		pB = str(i[1])
		pC = str(round(b[i[0]], 4))
		pD = str(d[i[0]])
		print("    "+pA+" "*(l-len(pA)+4)+pB+" "*(8-len(pB))+pC+" "*(13-len(pC))+pD)
	print(f"\nTotal: {len(c)} discoverers\n")
def all_gliders(command=""):
	print()
	for i in range(len(g)):
		dx,dy=detect_shift(g[i][5],g[i][6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,g[i][4])
		if exclude(command,dx1,dy1,p1,p,g[i][1]): continue
		glider(i+1)
		print()
usage_glider=f"""usage:
  n        to output the nth known glider
  _n       to output the nth row from the database
  B3/S23   to list known gliders for this rule (add "=" before additional options)
  -string  to list rules having gliders with matching speed and direction
  )string  to chart matching gliders for each rule with B0 and without S8
  @string  to chart matching gliders for each rule with B2
  #string  to chart matching gliders for each rule with B3
  @#string to chart matching gliders for each rule with B23
  *        to list all gliders
  a        to list all discoverers

options for -, @, and # (multiple options must be in the given order):
  n               to chart counts of the number of known gliders (the default)
  u               to chart counts of the number of known unsimplified speeds
  v               to chart counts of the number of known simplified speeds
  p               to chart the maximum known glider unsimplified period
  i               to chart the maximum known glider simplified period
  s               to chart the minimum known glider size
  MMc/NN          to chart only gliders with the given speed
  XX,YYc/PP       to chart only gliders with the given speed (XX is greater than YY)
  d               to chart only gliders that move diagonally
  k               to chart only gliders that move at a knights move or other off-slope
  o               to chart only gliders that move orthogonally
  :PERSON         to chart only gliders discovered by specified person
"""
usage_oscillator=f"""usage:
  n        to output the nth known oscillator
  _n       to output the nth row from the database
  B3/S23   to list known oscillators for this rule (add "=" before additional options)
  -string  to list rules having oscillators with matching period
  )string  to chart matching oscillators for each rule with B0 and without S8
  !string  to chart matching oscillators for each rule with B1
  @string  to chart matching oscillators for each rule with B2
  #string  to chart matching oscillators for each rule with B3
  @#string to chart matching oscillators for each rule with B23
  ;string  to chart matching oscillators for each rule without B0, B1, B2 or B3
  *        to list all oscillators
  a        to list all discoverers

options for -, @, and # (multiple options must be in the given order):
  n               to chart counts of the number of known oscillators (the default)
  p               to chart the maximum known oscillator period
  s               to chart the minimum known oscillator size
  cPP             to chart only oscillator with the given period
  :PERSON         to chart only oscillators discovered by specified person
"""
while True:
	com=input(">>>")
	if ":" in com:
		com,au=com.split(":")
		if au=="": au=disc_0
	else: au=""
	if com.isnumeric():
		if int(com)>len(g): print(f"only {len(g)} {pat_type[type][2]} are known")
		elif com=="0": print("numbering starts from 1")
		else: glider(int(com))
		print()
	elif com.startswith(")"):
		if mode=="OT": create_map("0","12345678","","01234567",com[1:])
		elif mode=="Hex": create_map("0","123456","","012345",com[1:])
		elif mode=="von_Neumann": create_map("0","1234","","0123",com[1:])
	elif com.startswith("@#"):
		if mode=="OT": create_map("23","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("23","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("23","4","","01234",com[1:])
	elif com.startswith("!"):
		if mode=="OT": create_map("1","2345678","","012345678",com[1:])
		elif mode=="Hex": create_map("1","23456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("1","234","","01234",com[1:])
	elif com.startswith("@"):
		if mode=="OT": create_map("2","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("2","3456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("2","34","","01234",com[1:])
	elif com.startswith("#"):
		if mode=="OT": create_map("3","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("3","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("3","4","","01234",com[1:])
	elif com.startswith(";"):
		if mode=="OT": create_map("","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("","4","","01234",com[1:])
	elif com.startswith("-"):
		create_list(com[1:])
	elif "/" in com and ((not "c/" in com) or "B" in com):
		if "=" in com: com = com.split("=")
		else: com = [com,""]
		comB, comS=com[0].replace(postfix[mode],"").replace("B","").replace("S","").split("/")
		for k in glider_impossible:
			if (set(k[0]) <= set(comB) <= set(k[2])) and (set(k[1]) <= set(comS) <= set(k[3])):
				print(k[4])
				break
		else:
			no=True
			for i in range(len(g)):
				if glider(i+1,com[0],com[1]):
					print()
					no=False
				if "0" in comB:
					if glider(i+1,"B"+inv_trans(comS)+"/S"+inv_trans(comB)+postfix[mode]):
						print()
						no=False
			if no: print("No gliders are known.")
	elif com.startswith("_"):
		try: print(gt[int(com[1:])-1])
		except: print("Invalid command!")
	elif com.startswith("*"): all_gliders(com[1:])
	elif com.startswith("a"): all_discoverers(com[1:])
	elif com in ["","c","help","usage","?"]:
		if type=="glider": print(usage_glider)
		else: print(usage_oscillator)
	elif com in ["update","refresh","reload"]:
		try:
			load_db()
			print("Database reloaded")
		except:
			print("Failed to reload database")
	elif com in ["quit","exit"]: break
Last edited by May13 on December 31st, 2023, 4:24 am, edited 1 time in total.
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
DroneBetter
Posts: 94
Joined: December 1st, 2021, 5:16 am
Location: The UK (a delightful place)
Contact:

Re: new-glider.py

Post by DroneBetter » July 24th, 2022, 5:44 pm

I noticed that every possibility of com.startswith() has the second parameter of create_map is a run of digits, the first of which is determined by the startswith, but line 480 seems to be an exception to this (beginning with 4 instead of 3 like the rest in its startswith), is this intentional? I don't know what it does but it seems like an oversight to me.
That concludes my post (I hope you liked it)

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » July 24th, 2022, 10:13 pm

Drone_Better wrote:
July 24th, 2022, 5:44 pm
I noticed that every possibility of com.startswith() has the second parameter of create_map is a run of digits, the first of which is determined by the startswith, but line 480 seems to be an exception to this (beginning with 4 instead of 3 like the rest in its startswith), is this intentional? I don't know what it does but it seems like an oversight to me.

Code: Select all

	elif com.startswith("@"):
		if mode=="OT": create_map("2","45678","","012345678",com[1:])
                                               ^
		elif mode=="Hex": create_map("2","3456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("2","34","","01234",com[1:])
This is intentional.
OT: command create_map("2","345678","","012345678",com[1:]) will display B23 rules that don't appear in glider.c. You can use "@#" command to create a B23 map.
Hex and von_Neumann: due to small number of these rules, I also included B23.
create_map works like this:

Code: Select all

create_map(main B transitions, optional B transitions, main S transitions, optional S transitions, options)
Not related to question: here's a minor fix for slice indexes:

Code: Select all

#elif com.startswith("@#"):
#		if mode=="OT": create_map("23","45678","","012345678",com[1:])
#		elif mode=="Hex": create_map("23","456","","0123456",com[1:])
#		elif mode=="von_Neumann": create_map("23","4","","01234",com[1:])
elif com.startswith("@#"):
		if mode=="OT": create_map("23","45678","","012345678",com[2:])
		elif mode=="Hex": create_map("23","456","","0123456",com[2:])
		elif mode=="von_Neumann": create_map("23","4","","01234",com[2:])
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » July 25th, 2022, 10:02 pm

What is the full syntax, and how do I compile it? Is there a built-in usage guide?

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » July 26th, 2022, 8:39 am

LaundryPizza03 wrote:
July 25th, 2022, 10:02 pm
What is the full syntax, and how do I compile it? Is there a built-in usage guide?
I use this command to run the script in Cygwin:

Code: Select all

python3 new-glider.py
new-glider.py will execute commands (separated by [Enter]) until one of "quit", "exit", [Ctrl]+[C], [Ctrl]+[D] is entered.
To see a built-in usage, run one of these commands: ["","c","help","usage","?"]
Example:

Code: Select all

$ python3 new-glider.py
>>>
usage:
  glider n        to output the nth known glider
  glider _n       to output the nth row from the database
  glider B3/S23   to list known gliders for this rule (add "=" before additional options)
  glider -string  to list rules having gliders with matching speed and direction
  glider )string  to chart matching gliders for each rule with B0 and without S8
  glider @string  to chart matching gliders for each rule with B2
  glider #string  to chart matching gliders for each rule with B3
  glider @#string to chart matching gliders for each rule with B23
  glider *        to list all gliders
  glider a        to list all discoverers

options for -, @, and # (multiple options must be in the given order):
  n               to chart counts of the number of known gliders (the default)
  u               to chart counts of the number of known unsimplified speeds
  v               to chart counts of the number of known simplified speeds
  p               to chart the maximum known glider unsimplified period
  i               to chart the maximum known glider simplified period
  s               to chart the minimum known glider size
  MMc/NN          to chart only gliders with the given speed
  XX,YYc/PP       to chart only gliders with the given speed (XX is greater than YY)
  d               to chart only gliders that move diagonally
  k               to chart only gliders that move at a knights move or other off-slope
  o               to chart only gliders that move orthogonally
  :PERSON         to chart only gliders discovered by specified person

>>>22222
#C Glider 22222, (5,2)c/190
#C Discovered by David S. Miller, 2016
#C
#C B012345678 S012345678
#C  ---X----X  --XX-----
#C
x = 35, y = 15, rule = B38/S23
20b2o3b2o$20bo3b3o5b2o$20bo2bob2o5bobo$20b6o7bo$25bo$25b2o4$2o3b2o5b2o$o
3b3o4b5o$o2bob2o4bo4bo$6o5b3o2bo$5bo6bo2b2o$5b2o6b2o!

>>>ac/12o

All discoverers of c/12o gliders:

    Discoverer        Total   Partial      Shared

    :UNKNOWN:         202     202.0        0
    Josh Ball         1       1.0          0
    muzik             1       1.0          0
    LaundryPizza03    1       1.0          0

Total: 4 discoverers

>>>*c/12o:muzik

#C Glider 22181, c/12 orthogonal (period 24)
#C Discovered by muzik, 2017
#C
#C B012345678 S012345678
#C  X-X- -X-   -X- -----
#C
x = 35, y = 1, rule = B026/S1
7o2bobo2b3o2bo2bo3b3o2bo2bo!

>>>_22181
:muzik, 2017:B026/S1:B02468/S13:24:2:0:35:1:7o2bobo2b3o2bo2bo3b3o2bo2bo!
>>>exit

I think this version of new-glider.py is not a stable release. Right now there are no implementation of list of redundant gliders.
I'll likely need help figuring out the rules where patterns with certain properties can't exist, especially oscillators and still lifes.
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » July 26th, 2022, 12:59 pm

May13 wrote:
July 26th, 2022, 8:39 am
I think this version of new-glider.py is not a stable release. Right now there are no implementation of list of redundant gliders.
I'll likely need help figuring out the rules where patterns with certain properties can't exist, especially oscillators and still lifes.
Known rules without spaceships are listed here. For rules with no still lifes, see the list of immortal rules at Eppstein 2009and then take the vanishing dual.

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » July 29th, 2022, 4:21 pm

Where can I obtain copies of hex-oscillators.db, vn-gliders.db, and vn-oscillators.db?

EDIT: After changing all the filename suffixes to ".db.txt", how do I resolve this?

Code: Select all

> python3 new-glider.py
Traceback (most recent call last):
  File "~/Documents/New Gliders DB/new-glider.py", line 13, in <module>
    mode=files[file][0] #OT #Hex #von_Neumann
KeyError: 'new-gliders.db'

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » July 29th, 2022, 8:58 pm

LaundryPizza03 wrote:
July 29th, 2022, 4:21 pm
Where can I obtain copies of hex-oscillators.db, vn-gliders.db, and vn-oscillators.db?

EDIT: After changing all the filename suffixes to ".db.txt", how do I resolve this?

Code: Select all

> python3 new-glider.py
Traceback (most recent call last):
  File "~/Documents/New Gliders DB/new-glider.py", line 13, in <module>
    mode=files[file][0] #OT #Hex #von_Neumann
KeyError: 'new-gliders.db'
I don't know about the existence of hex-oscillators.db, vn-gliders.db or vn-oscillators.db. I just prepared this script to read such files.
About KeyError: most likely the problem is in "file" from line 4. In your case line 4 should be replaced with

Code: Select all

file="new-gliders.db.txt" #Name of database
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » July 30th, 2022, 9:44 pm

May13 wrote:
July 29th, 2022, 8:58 pm
LaundryPizza03 wrote:
July 29th, 2022, 4:21 pm
Where can I obtain copies of hex-oscillators.db, vn-gliders.db, and vn-oscillators.db?

EDIT: After changing all the filename suffixes to ".db.txt", how do I resolve this?

Code: Select all

> python3 new-glider.py
Traceback (most recent call last):
  File "~/Documents/New Gliders DB/new-glider.py", line 13, in <module>
    mode=files[file][0] #OT #Hex #von_Neumann
KeyError: 'new-gliders.db'
I don't know about the existence of hex-oscillators.db, vn-gliders.db or vn-oscillators.db. I just prepared this script to read such files.
About KeyError: most likely the problem is in "file" from line 4. In your case line 4 should be replaced with

Code: Select all

file="new-gliders.db.txt" #Name of database
Thanks, but it's not returning anything from the database, e.g. "glider B3/S13" returns no results.

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » July 30th, 2022, 10:50 pm

LaundryPizza03 wrote:
July 30th, 2022, 9:44 pm
Thanks, but it's not returning anything from the database, e.g. "glider B3/S13" returns no results.
Oops. Seems like the word "glider" from usage should be removed. Try "B3/S13" instead of "glider B3/S13".

Code: Select all

>>>glider B3/S13
No gliders are known.
>>>B3/S13
#C The Creeper (glider 860), c/4 orthogonal
#C Discovered by Nathan Thompson, 1994, and Jean-Claude Heudin, 1996
#C
#C B012345678 S012345678
#C  ---X---    -X-X  -
#C
x = 5, y = 3, rule = B3/S13
3o$3b2o$3o!

#C The Sidewinder (glider 1194), c/4 diagonal (period 4/2)
#C Discovered by Nathan Thompson, 1994
#C
#C B012345678 S012345678
#C  ---X- -     X-X--
#C
x = 5, y = 4, rule = B3/S13
2o2$2b3o$3bo!

#C The Fighter (glider 3561), c/6 orthogonal
#C Discovered by Alan Hensel, 1994, and Jean-Claude Heudin, 1996
#C
#C B012345678 S012345678
#C  ---X---    -X-X- -
#C
x = 7, y = 3, rule = B3/S13
bo2b3o$2o$bo2b3o!

#C Glider 17117, c/2 orthogonal
#C
#C B012345678 S012345678
#C  ---X---    -X-X--
#C
x = 23, y = 11, rule = B3/S13
9bo3bo$3b2o4b2ob2o4b2o$bo7b2ob2o7bo$b2o4b2o5b2o4b2o$2bo5b2o3b2o5bo$2b2o
2bo9bo2b2o$3b3obo2bobo2bob3o$4bobo3bobo3bobo$2bo5b2obob2o5bo$3ob2ob2ob3o
b2ob2ob3o$bo3b2o9b2o3bo!

#C Glider 18270, c/3 orthogonal
#C
#C B012345678 S012345678
#C  ---X---    -X-X---
#C
x = 13, y = 27, rule = B3/S13
b3o5b3o$2bo7bo$2o9b2o$3b2o3b2o$3b2o3b2o$bobo5bobo$o3bo3bo3bo$3obo3bob3o$
bo2b2ob2o2bo$o3bo3bo3bo$b3o5b3o$2bo3bo3bo$2bo3bo3bo$2bo7bo$3b2obob2o$4bo
3bo$4bo3bo$6bo$5b3o$4bo3bo$5bobo$5bobo$4bo3bo2$3b2o3b2o$6bo$5bobo!

>>>
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » August 4th, 2022, 6:16 pm

new-glider.py crashed while attempting to generate a chart. This didn't happen before.

Code: Select all

>>>#1c/5o
Traceback (most recent call last):
  File "/Users/gb/Documents/New Gliders DB/new-glider.py", line 484, in <module>
    if mode=="OT": create_map("3","45678","","012345678",com[1:])
  File "/Users/gb/Documents/New Gliders DB/new-glider.py", line 227, in create_map
    dx,dy=detect_shift(i[5],i[6])
IndexError: list index out of range
nvm, just had to remove all the extraneous line breaks in the DB

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
LaundryPizza03
Posts: 2295
Joined: December 15th, 2017, 12:05 am
Location: Unidentified location "https://en.wikipedia.org/wiki/Texas"

Re: new-glider.py

Post by LaundryPizza03 » October 6th, 2022, 9:13 am

Would it be possible to display smaller portions of the OTCA rulespace? In particular, the B0 table is too unwieldy to display properly even in a text editor. Here's just one row:

Code: Select all

            B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
                                                                                                                                                                                                                                                                            1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
                                                                                                                                            2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2                                                                                                                                 
                                                                            3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3                                                                                                                                 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3                                                                 
                                            4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                                                                 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                                                                 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                                                                 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4                                 
                            5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                                 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                 
                    6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6         
                7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7     
              8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8   
           --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
S  23     : . . . . . . . . . . . . . . . . . . . . . . . . 1 1 1 1 1 1 1 1 6 4 4 4 . . . . . . . . . . . . . . . . . . . . 2 2 . . 2 2 6 6 4 2 8 8 . . 2 6 . . . . 3 2 7 d e 2 . 4 . . 2 2 4 2 . . 2 2 4 2 e 4 . . . . 3 4 2 . . . . . 1 9 4 . . . . . . . 4 6 2 2 3 3 7 3 . . . . 2 2 2 2 4 4 4 c 2 2 2 2 1 1 1 1 c c 2 4 4 4 4 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4 4 4 g c c 6 2 4 f 7 8 8 a 8 c 2 2 . 6 a k 9 4 4 c 8 4 9 2 4 6 4 8 4 6 8 2 . . 4 8 8 6 e i i 8 i 4 2 4 4 7 1 8 g . . . .

Code: Select all

x = 4, y = 3, rule = B3-q4z5y/S234k5j
2b2o$b2o$2o!
LaundryPizza03 at Wikipedia

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » January 15th, 2023, 6:34 am

It seems that current version of my script is buggy. Two bugs in hexagonal B0H rulespace:
1.

Code: Select all

>>>B01/SH
No gliders can exist: with B0H and without B23456/S23456H, patterns can not escape bounding orthogonal hexagon
Even though B01/SH is not empty in map:

Code: Select all

          B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
                                                                          1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                                          2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
                          3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3                                 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
                  4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4
              5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5
            6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6
         --------------------------------------------------------------------------------------------------------------------------------
S       :   . . . . . . . . .   . . . . . . . . . .   . . 1 1 1 1 1 1 1 1                                   2 2 6 7 .   1 1 . . . . . . .
S     5 :
S    45 :
S    4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . 1 1 . . .   . . . .   . . . . .
S   34  : . .   . .   . . . .   . .   . . . .   . .   . . 1 .   1 .   . . . . . . . . . . . . . . . . . . . .   . .   . . . . . . . . . .
S   345 :                                                                 . . . . . . . . . . . . . . . .
S   3 5 :                                                                 . . . . . . . . . 1 1 . . . . .
S   3   : . . . . . . . . . .   . . . . . 2 1 . . .   . . . . . . . . 1 1                                 . . . . .   . . . . . . . . . .
S  23   : . . . . . . . . . .   . . . . . 3 . . 1 .   . . 1 . . . . . . .                                 . . . . 1 . 1 1 . . . . . . . .
S  23 5 :                                                                 . . . . . . . . 2 2 1 2 . . . . . . . . . . . .
S  2345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   .
S  2 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . 1 1 6 4 6 3 . . . . . . . . . . . . . .   . . . . .
S  2 45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  2  5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  2    : . . . . . . . . . .   . . . 1 1 2 1 . . .   . 1 . . . . . . . .                                 . . . . . . . . . . . . . . . .
S 12    : . . . . . . . . . .   . . . . . 1 . . . .   . 1 . . . . . . . .                                 1 1 . . . . . . . . . . . . . .
S 12  5 :                                                                 . . . . 1 1 . . . . . . 1 1 . 2 . . . . . . . . . . . .
S 12 45 :                                                                 . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . .
S 12 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . . . 2 2 2 2 . . 1 1 3 1 . 1 . 1 . 1 . . . . . . 1 1
S 1234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . 1 1 . . . . . 1 . . . . .     .
S 12345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5 :                                                                 . . . . 1 1 . . 1 1 1 1 . . . . . . . . . . . . . . . .
S 123   : . . . . . . . . . .   . . . . . . . . . .   . . 1 . . . . . . .                                 . . . . . . . . . . . . . . . .
S 1 3   : . . . . . . . . . .   . . . . . 2 . . . .   . . . . . . . . . .                                 . . 1 2 . . . . . . . . . . . .
S 1 3 5 :                                                                 . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S 1 345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 34  : . .   . .   . . . .   . .   . . . .   . .   . . . .   . .   . . . . . . . . . . . . . . . . . . 1 . . . . . 1 1 . . . . . . . .
S 1  4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . 1 1 . . . . 1 . . . . . . 1 1 1 . . . . . .
S 1  45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1   5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1     :   . . . . . . . . .   . . . . . 1 . . . .   . . 2 1 1 1 2 2 1 2                                 2 2 4 4 . . . . . . . . . . .
S01     :   . . . . . . . . .   . . . . . 1 . . . .   . . 1 1 . . 2 2 1 1                                 2 2 6 6 . . . . . . . . . . .
S01   5 :                                                                 . . . . . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S01  45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01  4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . 1 1 . . . . . 1 . . . . 1 1 1 1 . . . . 1 .
S01 34  : . .   . .   . . . .   . .   . . . .   . .   . . . .   . .   . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . .
S01 345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 3 5 :                                                                 6 1 1 3 . . . . 1 2 1 . . . . . . . . . . . . . . . 1 1 . . . .
S01 3   : . . . . . . . . . .   . . . . . 1 . . . .   . . . . . . . . . .                                 . . 1 4 . . . . . . . . . . . .
S0123   : . . . . . . . . . .   . . . . . . . . . .   . . 6 . . . . . . .                                 . . . . . . . . . . . . . . . .
S0123 5 :                                                                 . . . . 1 1 . . 1 2 1 1 . . . . . . . . . . . . . . . . . . . .
S012345 :                                                                 . . . . . . . .         . . . . . . . . . . . . . . . . . . . .
S01234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . .         . . . . . 1 . . . . . . . . . . . . . .
S012 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . . . 2 2 2 2 . . 1 1 1 3 . 1 . 1 1 . . 1 . . . . 1 .
S012 45 :                                                                 . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . .
S012  5 :                                                                 . . 3 1 2 2 2 1 1 1 . . 2 2 1 1 . . . . . . . . . . . . . . . .
S012    : . . . . . . . . . .   . . . . . 1 2 . . .   . 1 . . . . . . . .                                 1 1 . . . . . . . . . . . . . .
S0 2    : . . . . . . . . . .   . . . 1 1 2 1 . . .   . 1 . . . . . . . .                                 . . . . . . . . . . . . . . . .
S0 2  5 :                                                                 . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . 2 4 6 4 7 3 . . . . 1 1 . 1 . . . . . . . . . . . .
S0 234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 23 5 :                                                                 . . . . . . . . 2 2 1 2 . . . . . . . . . . . . . . . . . . . .
S0 23   : . . . . . . . . . .   . . . . . 1 . . 1 .   . . 3 . . . . . . .                                 . . . . 1 . 1 1 . . . . . . . .
S0  3   : . . . . . . . . . .   . . . . . 2 1 . . .   . . . . . . . . 1 1                                 . . . . . . . . . . . . . . . .
S0  3 5 :                                                                 . . . . . . . . . 1 1 . . . . . . . . . . . . . . . 1 1 . . . .
S0  345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0  34  : . .   . .   . . . .   . .   . . . .   . .   . . 1 .   1 .   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0      :   . . . . . . . . .   . . . . . . . . . .   . . . 1 . . 2 2 1 1                                 2 2 3 3 . . 1 1 . . . . . . .
2. Look at this row:

Code: Select all

          B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
                                                                          1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                                          2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
                          3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3                                 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
                  4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4
              5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5
            6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6
         --------------------------------------------------------------------------------------------------------------------------------
S       :   . . . . . . . . .   . . . . . . . . . .   . . 1 1 1 1 1 1 1 1                                   2 2 6 7 .   1 1 . . . . . . .
See 7 speeds in B01345/SH? But:

Code: Select all

>>>B01345/SH
No gliders are known.
Same for B014/SH, but not for B02/SH.
Edit: B0123456/S04H and B01345/SH are dual rules.

Code: Select all

>>>B01345/SH
No gliders are known.
>>>B0123456/S04H
No gliders are known.
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » November 20th, 2023, 10:32 am

May13 wrote:
January 15th, 2023, 6:34 am
It seems that current version of my script is buggy. Two bugs in hexagonal B0H rulespace:
...
These bugs occur for the same reason: incorrect handling of intersecting sets from hex_glider_impossible. Fixed code (starting from string 291):

Code: Select all

			for k in glider_impossible:
				if (set(k[0]) <= set(int_to_trans(j)) <= set(k[2])) and (set(k[1]) <= set(int_to_trans(i)) <= set(k[3])):
					text+="  "
					non_im=False
					break
			if non_im and j%2==1:
				for k0 in glider_impossible:
					if (set(k0[0]) <= set(inv_trans(int_to_trans(i))) <= set(k0[2])) and (set(k0[1]) <= set(inv_trans(int_to_trans(j))) <= set(k0[3])):
						text+="  "
						non_im=False
						break
I added breaks to prevent double spaces from being printed more than once. Here's updated B0 map:

Code: Select all

$ python new-glider.py
>>>)v
          B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
          0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
                                                                          1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
                                          2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
                          3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3                                 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
                  4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4                 4 4 4 4 4 4 4 4
              5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5         5 5 5 5
            6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6     6 6
         --------------------------------------------------------------------------------------------------------------------------------
S       :   . . . . . . . . .   . . . . . . . . . .   . . 1 1 1 1 1 1 1 1                                 2 2 6 7 .   1 1 . . . . . . .
S     5 :
S    45 :
S    4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . 1 1 . . .   . . . .   . . . . .
S   34  : . .   . .   . . . .   . .   . . . .   . .   . . 1 .   1 .   . . . . . . . . . . . . . . . . . . . .   . .   . . . . . . . . . .
S   345 :                                                                 . . . . . . . . . . . . . . . .
S   3 5 :                                                                 . . . . . . . . . 1 1 . . . . .
S   3   : . . . . . . . . . .   . . . . . 2 1 . . .   . . . . . . . . 1 1                                 . . . . .   . . . . . . . . . .
S  23   : . . . . . . . . . .   . . . . . 3 . . 1 .   . . 1 . . . . . . .                                 . . . . 1 . 1 1 . . . . . . . .
S  23 5 :                                                                 . . . . . . . . 2 2 1 2 . . . . . . . . . . . .
S  2345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .   .
S  2 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . 1 1 6 4 6 3 . . . . . . . . . . . . . .   . . . . .
S  2 45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  2  5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . .
S  2    : . . . . . . . . . .   . . . 1 1 2 1 . . .   . 1 . . . . . . . .                                 . . . . . . . . . . . . . . . .
S 12    : . . . . . . . . . .   . . . . . 1 . . . .   . 1 . . . . . . . .                                 1 1 . . . . . . . . . . . . . .
S 12  5 :                                                                 . . . . 1 1 . . . . . . 1 1 . 2 . . . . . . . . . . . .
S 12 45 :                                                                 . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . .
S 12 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . . . 2 2 2 2 . . 1 1 3 1 . 1 . 1 . 1 . . . . . . 1 1
S 1234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . 1 1 . . . . . 1 . . . . .     .
S 12345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5 :                                                                 . . . . 1 1 . . 1 1 1 1 . . . . . . . . . . . . . . . .
S 123   : . . . . . . . . . .   . . . . . . . . . .   . . 1 . . . . . . .                                 . . . . . . . . . . . . . . . .
S 1 3   : . . . . . . . . . .   . . . . . 2 . . . .   . . . . . . . . . .                                 . . 1 2 . . . . . . . . . . . .
S 1 3 5 :                                                                 . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S 1 345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 34  : . .   . .   . . . .   . .   . . . .   . .   . . . .   . .   . . . . . . . . . . . . . . . . . . 1 . . . . . 1 1 . . . . . . . .
S 1  4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . 1 1 . . . . 1 . . . . . . 1 1 1 . . . . . .
S 1  45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1   5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1     :   . . . . . . . . .   . . . . . 1 . . . .   . . 2 1 1 1 2 2 1 2                                 2 2 4 4 . . . . . . . . . . .
S01     :   . . . . . . . . .   . . . . . 1 . . . .   . . 1 1 . . 2 2 1 1                                 2 2 6 6 . . . . . . . . . . .
S01   5 :                                                                 . . . . . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S01  45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01  4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . 1 1 . . . . . 1 . . . . 1 1 1 1 . . . . 1 .
S01 34  : . .   . .   . . . .   . .   . . . .   . .   . . . .   . .   . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . . . . . . . .
S01 345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 3 5 :                                                                 6 1 1 3 . . . . 1 2 1 . . . . . . . . . . . . . . . 1 1 . . . .
S01 3   : . . . . . . . . . .   . . . . . 1 . . . .   . . . . . . . . . .                                 . . 1 4 . . . . . . . . . . . .
S0123   : . . . . . . . . . .   . . . . . . . . . .   . . 6 . . . . . . .                                 . . . . . . . . . . . . . . . .
S0123 5 :                                                                 . . . . 1 1 . . 1 2 1 1 . . . . . . . . . . . . . . . . . . . .
S012345 :                                                                 . . . . . . . .         . . . . . . . . . . . . . . . . . . . .
S01234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . .         . . . . . 1 . . . . . . . . . . . . . .
S012 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . . . 2 2 2 2 . . 1 1 1 3 . 1 . 1 1 . . 1 . . . . 1 .
S012 45 :                                                                 . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . .
S012  5 :                                                                 . . 3 1 2 2 2 1 1 1 . . 2 2 1 1 . . . . . . . . . . . . . . . .
S012    : . . . . . . . . . .   . . . . . 1 2 . . .   . 1 . . . . . . . .                                 1 1 . . . . . . . . . . . . . .
S0 2    : . . . . . . . . . .   . . . 1 1 2 1 . . .   . 1 . . . . . . . .                                 . . . . . . . . . . . . . . . .
S0 2  5 :                                                                 . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . . . . . 2 4 6 4 7 3 . . . . 1 1 . 1 . . . . . . . . . . . .
S0 234  : .     . .     . .     . .     . .     . .     . .     . .     . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 23 5 :                                                                 . . . . . . . . 2 2 1 2 . . . . . . . . . . . . . . . . . . . .
S0 23   : . . . . . . . . . .   . . . . . 1 . . 1 .   . . 3 . . . . . . .                                 . . . . 1 . 1 1 . . . . . . . .
S0  3   : . . . . . . . . . .   . . . . . 2 1 . . .   . . . . . . . . 1 1                                 . . . . . . . . . . . . . . . .
S0  3 5 :                                                                 . . . . . . . . . 1 1 . . . . . . . . . . . . . . . 1 1 . . . .
S0  345 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0  34  : . .   . .   . . . .   . .   . . . .   . .   . . 1 .   1 .   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4  : . . . . .   . . . .   . . . . . . . . . .   . . . .   . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5 :                                                                 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0      :   . . . . . . . . .   . . . . . . . . . .   . . . 1 . . 2 2 1 1                                 2 2 3 3 . . 1 1 . . . . . . .


238/2468
>>>

Note: my current unpublished copy of hex-gliders.db have 377 gliders, but there are no recent discoveries in B0H rules.
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

User avatar
May13
Posts: 786
Joined: March 11th, 2021, 8:33 am

Re: new-glider.py

Post by May13 » March 8th, 2024, 5:41 am

New version of new-glider.py:

Code: Select all

#new-glider.py v0.2
#Written by May13, 2024
from math import gcd
from fnmatch import fnmatch, filter
#Options
map_count_rules=True
file="new-gliders.db" #Name of database
wid=72 #Width of RLE (default: 72)
old_speed=False #if True, use format "2c/5 slope 2"; if False, use format "(2,1)c/5"
#
au="" #part of command (author)
map_char="0123456789abcdefghijklmnopqrstuvwxyz"
disc_0=":UNKNOWN:"
files={"new-gliders.db": ("OT","glider",True), "oscillators.db": ("OT","oscillator",True), "hex-gliders.db": ("Hex","glider",True), "hex-oscillators.db": ("Hex","oscillator",True), "vn-gliders.db": ("von_Neumann","glider",True), "vn-oscillators.db": ("von_Neumann","oscillator",True)}
mode=files[file][0] #OT #Hex #von_Neumann
neighbors={"OT": 8, "Hex": 6, "von_Neumann": 4}
postfix={"OT": "", "Hex": "H", "von_Neumann": "V"}
type=files[file][1] #glider #oscillator
pat_type={"glider": ("Glider", "glider", "gliders"), "oscillator": ("Oscillator", "oscillator", "oscillators")}
auth_splitters=[[","],[";"],[" based"," by "],[" improved"," by "],[" reduced"," by "],[" and "],[" by D8_2 reduction of an existing ship"],[" by D8_2 reduction of "]]
auth_date=[[" before "],[" early ","s"],[" pre-"]]
hex_glider_impossible=[
	["2","012","2456","0123456","No gliders can exist: with B2/S012H, patterns cannot shrink."],
	["23","01","23456","0123456","No gliders can exist: with B23/S01H, patterns cannot shrink."],
	["234","0","23456","023456","No gliders can exist: with B234/S0H, patterns cannot shrink."],
	["23","0234","2356","023456","No gliders can exist: with B23/S0234H, patterns cannot permanently shrink."],
	["2","12345","23456","123456","No gliders can exist: with S12345H, connected patterns cannot shrink"],
	["","","3456","0123456","No gliders can exist: without B2H, patterns cannot escape bounding box."],
	]
hex_glider_impossible+=[
	["0123456","","0123456","","No gliders can exist: patterns cannot grow."],
	["012456","4","0123456","4","No gliders can exist: patterns cannot shrink."],
	["012","5","0123456","45","No gliders can exist: patterns cannot shrink."],
	["013456","4","013456","4","No gliders can exist: patterns cannot shrink."],
	["01356","34","013456","34","No gliders can exist: patterns cannot shrink."],
	["013","5","013456","345","No gliders can exist: patterns cannot shrink."],
	["01","5","01456","2345","No gliders can exist: patterns cannot shrink."],
	["016","1234","0156","1234","No gliders can exist: patterns cannot shrink."],
	["01","15","0156","12345","No gliders can exist: patterns cannot shrink."],
	["0","5","023456","012345","No gliders can exist: patterns cannot shrink."]
	]
hex_glider_impossible+=[
	["012","","0123456","0123","No gliders can exist: with B012H and without S456H, patterns cannot escape bounding orthogonal hexagon."],
	["0","","01","01","No gliders can exist: with B0H and without one of B23456/S23456H, patterns cannot escape bounding orthogonal hexagon."],
	["01234","01234","0123456","012345","No gliders can exist: with B01234/S01234H and without S6H, patterns cannot escape bounding orthogonal hexagon."]
	]
moore_glider_impossible=[
	["3","","345678","012345678","Gliders with speed (m,n)c/p, 2m+n>p, cannot exist with B3 and without B012.","speed_is_known and min_dx*2+min_dy>min_dp"],
	["1","","12345678","012345678","No gliders can exist: with B1, any pattern expands in all directions.","True"],
	["","","45678","012345678","No gliders can exist: without B2 or B3, patterns cannot escape bounding box.","True"],
	["","0123","2345678","012345678","No gliders can exist: with S0123, trailing edge of pattern can not die.","True"],
	["23","0","2345678","012345678","No gliders can exist: with B23/S0, trailing edge of pattern can not die.","True"],
	["","123456","2345678","012345678","No gliders can exist: with S123456, connected patterns can not shrink.","True"],
	["34","12345","2345678","012345678","No gliders can exist: with B34/S12345, connected patterns can not shrink.","True"],
	["345","1234","2345678","012345678","No gliders can exist: with B345/S1234, connected patterns can not shrink.","True"],
	["","234567","345678","012345678","No gliders can exist: with S234567 and without B2, can't escape bounding diamond without immortal triangle.","True"],
	["","","3678","678","No gliders can exist: without one of B245/S012345, can't escape bounding diamond.","True"],
	["3","","345678","0123678","Diagonal speed limit is c/4 diagonal without one of B2/S45.","speed_is_known and min_dx*2+min_dy*2>min_dp"],
	["3","345678","345678","012345678","With S345678 and without B2, fast diagonal growth impossible without creating immortal cross.","speed_is_known and min_dx*2+min_dy*2>min_dp"],
	["3","","3","05678","speed >= c/2 (or c/3 diagonal) impossible without one of B2/S1234.","speed_is_known and min_dx*2+min_dy>=min_dp"]
]
for i in range(len(hex_glider_impossible)):
    hex_glider_impossible[i].append("True")
if mode == "Hex" and type=="glider": glider_impossible=hex_glider_impossible
elif mode == "OT" and type=="glider": glider_impossible=moore_glider_impossible
else: glider_impossible = []
g=gt=""
def load_db():
	global g, gt
	if files[file][2]==True:
		f=open(file)
		g=f.read()
		f.close()
	gt=g.split("\n")
	g=[i.split(":") for i in (gt[:-1] if gt[-1]=="" else gt)]
load_db()
def N1(): return neighbors[mode]+1
def pt(x): return pat_type[type][x]
int_to_trans=lambda x: "".join(str(i) for i in range(N1()) if x//(2**i)%2==1)
trans_to_int=lambda x: sum(2**i for i in range(N1()) if str(i) in x)
inv_trans=lambda x: "".join(str(i) for i in range(N1()) if not str(N1()-1-i) in x)
b0_alt=lambda x: trans_to_int(inv_trans(int_to_trans(x%(2**N1()))))*(2**N1())+trans_to_int(inv_trans(int_to_trans(x//(2**N1()))))
def b0_alt2(x, y):
	return trans_to_int(inv_trans(int_to_trans(y))), trans_to_int(inv_trans(int_to_trans(x)))
def command_filter(string):
	for i in "inpsuv*":
		string = string.replace(i,"")
	while '{' in string:
		string=string[:string.index("{")]+string[string.index("}")+1:]
	return string
def authors(info):
	i=info
	for j in auth_splitters+auth_date:
		if len(j)==1:
			i=i.replace(j[0],":")
		elif len(j)==2:
			while j[0] in i:
				sliceA=i.find(j[0])
				sliceB=i.find(j[1],sliceA+len(j[0]))
				if sliceB<0: break
				i=i[:sliceA]+":"+i[sliceB+len(j[1]):]
	i=i.split(":")
	j=0
	while j < len(i):
		if i[j] in [""," "]:
			i.pop(j)
			continue
		if i[j][0]==" ": i[j]=i[j][1:]
		if i[j][-1]==" ": i[j]=i[j][:-1]
		if i[j].isnumeric() or (i[j][:-1].isnumeric() and i[j][-1]=="?"):
			i.pop(j)
			continue
		j+=1
	if i==[]: i=[disc_0]
	return i
def exclude(command,dx1,dy1,p1,p,name,info=""):
	if not au=="":
		if filter(authors(info),au)==[]: return True
	cond=False
	if "c" in command:
		vel=command_filter(command)
		vel=vel.replace("/","")
		vel=vel.split("c")
		if type=="oscillator":
			if vel[1]=="":
				if p==1: cond=True
			elif p==int(vel[1]): cond=True
		else:
			tdx=tdy=tp=0
			if vel[0]=="": tdx=1
			elif "," in vel[0]: tdx,tdy=[int(k) for k in vel[0].split(",")]
			else: tdx=int(vel[0])
			if "d" in vel[1]: tdy=tdx
			elif "k" in vel[1]: tdy=-1
			elif "o" in vel[1]: tdy=0
			elif not "," in vel[0]: tdy=-2
			tp=vel[1]
			for k in "odk": tp=tp.replace(k,"")
			if tp=="": tp=1
			else: tp=int(tp)
			if tdy==-1:
				if dy1>0 and dy1<dx1 and dx1*tp==tdx*p1: cond=True
			elif tdy==-2:
				if dx1*tp==tdx*p1: cond=True
			else:
				if dx1*tp==tdx*p1 and dy1*tp==tdy*p1: cond=True
	else:
		if "o" in command:
			if dy1==0: cond=True
		elif "d" in command:
			if dy1==dx1: cond=True
		elif "k" in command:
			slope=command_filter(command[1:])
			if slope=="":
				if dx1>dy1>0: cond=True
			else:
				if "/" not in slope:
					if dx1==dy1*int(slope) or (slope=="0" and dy1==0): cond = True
				else:
					slope = slope.split("/")
					if dx1*int(slope[1])==dy1*int(slope[0]) or dx1*int(slope[0])==dy1*int(slope[1]): cond = True
		else: cond=True
	if "{" in command:
		temp = command[command.index("{")+1:]
		temp = temp[:temp.index("}")]
		if not fnmatch(name, temp): return True
	return not cond
def tr4(width,index):
	if (index//width)%4 in [0,3]: return 0
	return 1
def detect_shift(d1,d2):
	if mode=="Hex":
		dx=int(d1)
		dy=int(d2)
		if dx<0 and dy>0:
			if dx+dy>0: dy+=dx
			else: dx+=dy
		elif dx>0 and dy<0:
			if dx+dy>0: dx+=dy
			else: dy+=dx
	else:
		dx=int(d1)
		dy=int(d2)
	return abs(dx), abs(dy)
def detect_speed(dx,dy,p):
	if "/" in p:
		mod=int(p.split("/")[1])
		p0=int(p[:-2])
	else:
		mod=1
		p0=int(p)
	dx0,dy0=max(dx,dy),min(dx,dy)
	gcd3=gcd(p0,gcd(dx0,dy0))
	p1=p0//gcd3
	dx1=dx0//gcd3
	dy1=dy0//gcd3
	return dx1,dy1,p1,p0,mod,gcd3
def get_rule_sets(min1,min2,max1,max2):
	minset1=set(min1[1:])
	maxset1=set(max1[1:])
	p = postfix[mode]
	if p!="":
		minset2=set(min2[1:-len(p)])
		maxset2=set(max2[1:-len(p)])
	else:
		minset2=set(min2[1:])
		maxset2=set(max2[1:])
	return minset1,minset2,maxset1,maxset2
def print_rule_simple(amin1,amin2,amax1,amax2,agens):
	anumstr="".join(str(i) for i in range(N1()))
	print("#C B"+anumstr+" S"+anumstr+(" G"+str(agens) if agens>2 else "")+(" "+postfix[mode] if len(postfix[mode])>0 else ""))
	bs=""
	ss=""
	minset1,minset2,maxset1,maxset2=get_rule_sets(amin1,amin2,amax1,amax2)
	for i1 in range(N1()):
		if str(i1) not in maxset1: bs+="-"
		elif str(i1) in minset1: bs+="X"
		else: bs+=" "
		if str(i1) not in maxset2: ss+="-"
		elif str(i1) in minset2: ss+="X"
		else: ss+=" "
	print("#C  "+bs+"  "+ss+"\n#C")
def print_RLE(ax,ay,arul,RLE):
	print("x = "+ax+", y = "+ay+", rule = "+arul)
	t1=""
	t0=""
	k=0
	for j in RLE:
		if j in "bo$":
			if len(t0)+len(t1)>=wid:
				print(t1)
				t1=t0+j
				k=0
			else:
				t1+=t0+j
			t0=""
		else: t0+=j
		k+=1
		if j=="!":
			if len(t1)==wid: print(t1+"\n!")
			else: print(t1+"!")
def glider(n,rul="",com=":"):
	gi=g[n-1]
	if rul=="": rul=gi[2]
	x1,x2=rul.split("/")
	min1,min2=gi[2].split("/")
	max1,max2=gi[3].split("/")
	if (set(min1) <= set(x1) <= set(max1)) and (set(min2) <= set(x2) <= set(max2)):
		if True:
			dx, dy=detect_shift(gi[5],gi[6])
			dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,gi[4])
			if com!=":" and exclude(com,dx1,dy1,p1,p,g[i][0],g[i][1]): return False
			if dx1==1: dx2=""
			else: dx2=dx1
			if dx==dy and dx1==0:
				if p==1: speed=", still life"
				else: speed=f", period {p}"+(f" (mod {p//mod})" if mod>1 else "")
			elif dy1==0: speed=f", {dx2}c/{p1} orthogonal"
			elif dy==dx: speed=f", {dx2}c/{p1} diagonal"
			else:
				if old_speed:
					sg=gcd(dx1,p1)
					if dx1==sg: dx3=""
					else: dx3=dx1//sg
					if p1==sg: p3=""
					else: p3=f"/{p1//sg}"
					sg1=gcd(dx1,dy1)
					if dy1==sg1: dy4=""
					else: dy4="/{dy1//sg1}"
					dx4=dx1//sg1
					speed=f", {dx3}c{p3} slope {dx4}{dy4}"
					if sg>1: speed+=" (period "+str(p)+")"
				else: speed=f", ({dx1},{dy1})c/{p1}"
			if not (dx==dy and dx1==0):
				if mod==2: speed+=" (period "+str(p)+"/2)"
				elif gcd3>1: speed+=" (period "+str(p)+")"
			if gi[0]=="": print("#C "+pat_type[type][0]+" "+str(n)+speed)
			else: print("#C The "+gi[0]+" ("+pat_type[type][1]+" "+str(n)+")"+speed)
			if gi[1]!="": print("#C Discovered by "+gi[1]+"\n#C")
			else: print("#C")
			print_rule_simple(min1,min2,max1,max2,2)
			print_RLE(gi[7],gi[8],rul,gi[9])
			return True
	return False
def create_map(m1,d1,m2,d2,command=""):
	mapset=False
	if "v" in command or "u" in command: mapset=True
	if mapset: map=[set() for i in range(4**(neighbors[mode]+1))]
	else: map=[0]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[0],i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				ak=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: ak+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				for add1 in [ak]+([b0_alt(ak)] if ak%2==1 else []):
					if mapset:
						if "u" in command: map[add1].add((max(dx,dy),min(dx,dy),p))
						else: map[add1].add((dx1,dy1,p1))
					elif "p" in command:
						if map[add1]==0: map[add1]=p
						else: map[add1]=max(map[add1],p)
					elif "i" in command:
						if map[add1]==0: map[add1]=p1
						else: map[add1]=max(map[add1],p1)
					elif "s" in command:
						if map[add1]==0: map[add1]=max(int(i[7]),int(i[8]))
						else: map[add1]=min(map[add1],max(int(i[7]),int(i[8])))
					else: map[add1]+=1
	colsM=sum(2**int(i) for i in m1)
	rowsM=sum(2**int(i) for i in m2)
	cols=[colsM+sum(2**int(d1[j])*tr4(2**(len(d1)-j-1),i) for j in range(len(d1))) for i in range(2**len(d1))]
	if '0' in m1: rows=[rowsM+sum(2**int(d2[j])*(1-(tr4(2**(j),i))) for j in range(len(d2))) for i in range(2**len(d2))]
	else: rows=[rowsM+sum(2**int(d2[j])*tr4(2**(len(d2)-j-1),i) for j in range(len(d2))) for i in range(2**len(d2))]
	text=" "*(len(m2)+len(d2)+3)+" B"*2**len(d1)+"\n"
	for i in m1:
		text+=" "*(len(m2)+len(d2)+3)+(" "+i)*2**len(d1)+"\n"
	for i in d1:
		text+=" "*(len(m2)+len(d2)+4)
		for j in cols:
			if j//(2**int(i))%2==1: text+=i+" "
			else: text+="  "
		text+="\n"
	text+=" "*(len(m2)+len(d2)+3)+"-"*2**len(d1)*2+"\n"
	q=[]
	co1=0
	co2=0
	speed_is_known = True
	min_dx = 0
	min_dy = 0
	min_dp = 1
	if type=="glider":
		if "c" in command:
			vel=command_filter(command)
			vel=vel.replace("/","")
			vel=vel.split("c")
			if vel[0]=="": min_dx=1
			elif "," in vel[0]:
				min_dx = int(vel[0].split(",")[0])
				min_dy = int(vel[0].split(",")[1])
			else:
				min_dx = int(vel[0])
			vel[1] = vel[1].replace("o","")
			vel[1] = vel[1].replace("d","")
			vel[1] = vel[1].replace("k","")
			if vel[1]=="": min_dp = 1
			else: min_dp = int(vel[1])
			if "d" in command: min_dy = min_dx
			if "k" in command or "o" in command: min_dy = 0
	for i in rows:
		text+="S"+m2
		for j in d2:
			if i//(2**int(j))%2==1: text+=j
			else: text+=" "
		text+=" :"
		for j in cols:
			non_im=True
			for k in glider_impossible:
				if (set(k[0]) <= set(int_to_trans(j)) <= set(k[2])) and (set(k[1]) <= set(int_to_trans(i)) <= set(k[3])) and eval(k[5]):
					text+="  "
					non_im=False
					break
			if non_im and j%2==1:
				for k0 in glider_impossible:
					if (set(k0[0]) <= set(inv_trans(int_to_trans(i))) <= set(k0[2])) and (set(k0[1]) <= set(inv_trans(int_to_trans(j))) <= set(k0[3])) and eval(k[5]):
						text+="  "
						non_im=False
						break
			if non_im:
				co1+=1
				t=map[i*2**N1()+j]
				if mapset: t=len(t)
				ti=t
				if t>35: t="X"
				elif t==0: t="."
				else: t=map_char[t]
				if not t==".": co2+=1
				text+=" "+t
			else:
				t=map[i*2**N1()+j]
				if mapset:
					if len(t)>0:
						print("Error!")
						print(t)
				else:
					if t>0:
						print("Error!")
						print(t)
		text+="\n"
	print(text)
	if map_count_rules: print(f"{co2}/{co1}\n")
def create_list(command=""):
	print(f"Totalistic rules for which {command}{'' if command=='' else ' '}{pt(2)}{' discovered by '+au if not au=='' else ''} are known:\n")
	print(f"    B{''.join(str(i) for i in range(N1()))} S{''.join(str(i) for i in range(N1()))} {postfix[mode]}")
	map=[False]*(4**(neighbors[mode]+1))
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[0],i[1]): continue
		min1,min2=i[2].split("/")
		max1,max2=i[3].split("/")
		gminset1,gminset2,gmaxset1,gmaxset2=get_rule_sets(min1,min2,max1,max2)
		add0=0
		addb=[]
		for j in range(N1()):
			if str(j) in gminset1:
				add0+=2**j
			if str(j) in gminset2:
				add0+=2**(j+N1())
		for j in range(2**len(gmaxset1-gminset1)):
			add1=add0
			for k in range(len(gmaxset1-gminset1)):
				if j//(2**(len(gmaxset1-gminset1)-k-1))%2==1: add1+=2**(int(list(gmaxset1-gminset1)[k]))
			addb+=[add1]
		for a in addb:
			for j in range(2**len(gmaxset2-gminset2)):
				add1=a
				for k in range(len(gmaxset2-gminset2)):
					if j//(2**(len(gmaxset2-gminset2)-k-1))%2==1: add1+=2**(int(list(gmaxset2-gminset2)[k])+N1())
				map[add1]=True
				if add1%2==1: map[b0_alt(add1)]=True
	num=0
	rules = []
	for i in range(4**N1()):
		j=bin(4**N1()-i-1)[2:]
		j=j[::-1]+"0"*(2*N1()-len(j))
		j=int(j,2)
		if map[j]:
			num+=1
			text="     "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			text+="  "
			for k in range(N1()):
				if j%2==1: text+="X"
				else: text+="-"
				j=j//2
			rules.append(text)
	for i in range(2*N1()+2):
		rules_temp = []
		for j in rules:
			if j[-1-i]=='X':
				l = list(j)
				l[-1-i]='-'
				text = ''.join(l)
				if text in rules:
					l[-1-i]=' '
					rules_temp.append(''.join(l))
					rules.remove(text)
				else: rules_temp.append(j)
			else: rules_temp.append(j)
		rules = rules_temp.copy()
	rules.sort()
	print(*rules, sep='\n')
	print(f"\nTotal: {num} rules\n")
def all_discoverers(command=""):
	a={}
	b={}
	d={}
	for i in g:
		dx,dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		if exclude(command,dx1,dy1,p1,p,i[0],i[1]): continue
		j=authors(i[1])
		for k in j:
			if k in a:
				a[k]+=1
				b[k]+=1/len(j)
				d[k]+=1 if len(j)>1 else 0
			else:
				a[k]=1
				b[k]=1/len(j)
				d[k]=1 if len(j)>1 else 0
	l=12
	for i in a.keys():
		l=max(l,len(i))
	c=sorted(a.items(), key=lambda x: x[1])[::-1]
	if au!="": c=[i for i in c if fnmatch(i[0],au)]
	print(f"All discoverers of {command}{'' if command=='' else ' '}{pt(2)}:\n")
	print("    Discoverer"+" "*(l-6)+"Total   Partial      Shared\n")
	for i in c:
		pA = i[0]
		pB = str(i[1])
		pC = str(round(b[i[0]], 4))
		if pC.endswith('.0'): pC = pC[:-2]
		pD = str(d[i[0]])
		print("    "+pA+" "*(l-len(pA)+4)+pB+" "*(8-len(pB))+pC+" "*(13-len(pC))+pD)
	print(f"\nTotal: {len(c)} discoverers\n")
def all_gliders(command=""):
	for i in range(len(g)):
		dx,dy=detect_shift(g[i][5],g[i][6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,g[i][4])
		if exclude(command,dx1,dy1,p1,p,g[i][0],g[i][1]): continue
		glider(i+1)
		print()
def show_redundant_gliders():
	dictionary = dict()
	ret = dict()
	k = 0
	for i in g:
		k += 1
		dx, dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		rule = i[2]
		for j in "BSHV": rule.replace(j,"")
		min1,min2=rule.split("/")
		rule = i[3]
		for j in "BSHV": rule.replace(j,"")
		max1,max2=rule.split("/")
		l = [int(i[7]),int(i[8]),dx1,dy1,p1,i[2],i[3],k,p,trans_to_int(min1),trans_to_int(min2),trans_to_int(max1),trans_to_int(max2)]
		l.extend(b0_alt2(l[11],l[12]))
		l.extend(b0_alt2(l[9],l[10]))
		speed = (dx,dy,p)
		if speed not in dictionary.keys(): dictionary[speed] = [l]
		else: dictionary[speed].append(l)
	q = 0
	k = 0
	t = 0
	for i in dictionary.values():
		t += len(i)*(len(i)-1)
	for speed in dictionary.keys():
		data = dictionary[speed]
		if len(data)==1: continue
		if q/t>0.001: print(f"Loading: {round(100*k/t,2)}%")
		for i in range(len(data)):
			for j in range(len(data)):
				if i==j: continue
				if (data[i][9]&1)!=(data[j][9]&1): continue
				if ((data[i][9]&data[j][9])^data[j][9]==0 and (data[i][10]&data[j][10])^data[j][10]==0 and (data[i][11]&data[j][11])^data[i][11]==0 and (data[i][12]&data[j][12])^data[i][12]==0):
					if data[i][0]*data[i][1]>data[j][0]*data[j][1] or data[i][0]*data[i][1]==data[j][0]*data[j][1] and data[i][7]<data[j][7]:
						text = f"{pat_type[type][0]} {data[i][7]} is made redundant by {pat_type[type][1]} {data[j][7]}.\n"
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[i])
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[j])
						ret[data[i][7]] = text
						break
				if data[i][9]&1 and ((data[i][13]&data[j][9])^data[j][9]==0 and (data[i][14]&data[j][10])^data[j][10]==0 and (data[i][15]&data[j][11])^data[i][15]==0 and (data[i][16]&data[j][12])^data[i][16]==0):
					if data[i][0]*data[i][1]>data[j][0]*data[j][1] or data[i][0]*data[i][1]==data[j][0]*data[j][1] and data[i][7]<data[j][7]:
						text = f"{pat_type[type][0]} {data[i][7]} is made redundant by {pat_type[type][1]} {data[j][7]}.\n"
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[i])
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[j])
						ret[data[i][7]] = text
						break
					
		q = len(data)*(len(data)-1)
		k += q
	print("Loading complete.\n")
	for i in sorted(ret.keys()):
		print(ret[i])
	print(f"Total redundant {pat_type[type][2]}: {len(ret)}\n")
def show_redundant_oscillators():
	dictionary = dict()
	ret = dict()
	k = 0
	for i in g:
		k += 1
		dx, dy=detect_shift(i[5],i[6])
		dx1,dy1,p1,p,mod,gcd3=detect_speed(dx,dy,i[4])
		rule = i[2]
		for j in "BSHV": rule.replace(j,"")
		min1,min2=rule.split("/")
		rule = i[3]
		for j in "BSHV": rule.replace(j,"")
		max1,max2=rule.split("/")
		p = i[4] if not "/" in i[4] else i[4][:i[4].index("/")]
		p = int(p)
		l = [int(i[7]),int(i[8]),0,0,p,i[2],i[3],k,p,trans_to_int(min1),trans_to_int(min2),trans_to_int(max1),trans_to_int(max2)]
		l.extend(b0_alt2(l[11],l[12]))
		l.extend(b0_alt2(l[9],l[10]))
		speed = (0,0,p)
		if speed not in dictionary.keys(): dictionary[speed] = [l]
		else: dictionary[speed].append(l)
	q = 0
	k = 0
	t = 0
	for i in dictionary.values():
		t += len(i)*(len(i)-1)
	for speed in dictionary.keys():
		data = dictionary[speed]
		if len(data)==1: continue
		if q/t>0.001: print(f"Loading: {round(100*k/t,2)}%")
		for i in range(len(data)):
			for j in range(len(data)):
				if i==j: continue
				if (data[i][9]&1)!=(data[j][9]&1): continue
				if ((data[i][9]&data[j][9])^data[j][9]==0 and (data[i][10]&data[j][10])^data[j][10]==0 and (data[i][11]&data[j][11])^data[i][11]==0 and (data[i][12]&data[j][12])^data[i][12]==0):
					if data[i][0]*data[i][1]>data[j][0]*data[j][1] or data[i][0]*data[i][1]==data[j][0]*data[j][1] and data[i][7]<data[j][7]:
						text = f"{pat_type[type][0]} {data[i][7]} is made redundant by {pat_type[type][1]} {data[j][7]}.\n"
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[i])
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[j])
						ret[data[i][7]] = text
						break
				if data[i][9]&1 and ((data[i][13]&data[j][9])^data[j][9]==0 and (data[i][14]&data[j][10])^data[j][10]==0 and (data[i][15]&data[j][11])^data[i][15]==0 and (data[i][16]&data[j][12])^data[i][16]==0):
					if data[i][0]*data[i][1]>data[j][0]*data[j][1] or data[i][0]*data[i][1]==data[j][0]*data[j][1] and data[i][7]<data[j][7]:
						text = f"{pat_type[type][0]} {data[i][7]} is made redundant by {pat_type[type][1]} {data[j][7]}.\n"
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[i])
						text += "{}x{} ({},{})c/{} {} - {}\n".format(*data[j])
						ret[data[i][7]] = text
						break
		q = len(data)*(len(data)-1)
		k += q
	print("Loading complete.\n")
	for i in sorted(ret.keys()):
		print(ret[i])
	print(f"Total redundant {pat_type[type][2]}: {len(ret)}\n")
usage_glider="""usage:
  n               to output the nth known glider
  _n              to output the nth row from the database
  B3/S23          to list known gliders for this rule (add "=" before additional options)
  -string         to list rules having gliders with matching speed and direction
  )string         to chart matching gliders for each rule with B0 and without S8
  @string         to chart matching gliders for each rule with B2
  #string         to chart matching gliders for each rule with B3
  @#string        to chart matching gliders for each rule with B23
  *               to list all gliders
  +               to list all redundant gliders
  a               to list all discoverers

options for -, ), @, #, and @#:
  n               to chart counts of the number of known gliders (the default)
  u               to chart counts of the number of known unsimplified speeds
  v               to chart counts of the number of known simplified speeds
  p               to chart the maximum known glider unsimplified period
  i               to chart the maximum known glider simplified period
  s               to chart the minimum known glider size

additional options:
  MMc/NN          to show only gliders with the given speed
  XX,YYc/PP       to show only gliders with the given speed (XX is greater than YY)
  o               to show only gliders that move orthogonally
  d               to show only gliders that move diagonally
  k               to show only gliders that move at a knights move or other off-slope
  kMM/NN          to show only gliders with slope MM/NN
  {NAME}          to show only gliders with a name matching the given wildcard
  :PERSON         to show only gliders discovered by specified person
"""
usage_oscillator="""usage:
  n               to output the nth known oscillator
  _n              to output the nth row from the database
  B3/S23          to list known oscillators for this rule (add "=" before additional options)
  -string         to list rules having oscillators with matching period
  )string         to chart matching oscillators for each rule with B0 and without S8
  !string         to chart matching oscillators for each rule with B1
  @string         to chart matching oscillators for each rule with B2
  #string         to chart matching oscillators for each rule with B3
  @#string        to chart matching oscillators for each rule with B23
  ;string         to chart matching oscillators for each rule without B0, B1, B2 or B3
  *               to list all oscillators
  +               to list all redundant oscillators
  a               to list all discoverers

options for -, ), !, @, #, @#, and ;:
  n               to chart counts of the number of known oscillators (the default)
  p               to chart the maximum known oscillator period
  s               to chart the minimum known oscillator size

additional options:
  cPP             to show only oscillators with the given period
  {NAME}          to show only oscillators with a name matching the given wildcard
  :PERSON         to show only oscillators discovered by specified person
"""
while True:
	com=input(">>>")
	if ":" in com:
		com,au=com.split(":")
		if au=="": au=disc_0
	else: au=""
	if com.isdecimal():
		if int(com)>len(g): print(f"only {len(g)} {pat_type[type][2]} are known")
		elif com=="0": print("numbering starts from 1")
		else: glider(int(com))
		print()
	elif com.startswith(")"):
		if mode=="OT": create_map("0","12345678","","01234567",com[1:])
		elif mode=="Hex": create_map("0","123456","","012345",com[1:])
		elif mode=="von_Neumann": create_map("0","1234","","0123",com[1:])
	elif com.startswith("@#"):
		if mode=="OT": create_map("23","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("23","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("23","4","","01234",com[1:])
	elif com.startswith("!"):
		if mode=="OT": create_map("1","2345678","","012345678",com[1:])
		elif mode=="Hex": create_map("1","23456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("1","234","","01234",com[1:])
	elif com.startswith("@"):
		if mode=="OT": create_map("2","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("2","3456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("2","34","","01234",com[1:])
	elif com.startswith("#"):
		if mode=="OT": create_map("3","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("3","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("3","4","","01234",com[1:])
	elif com.startswith(";"):
		if mode=="OT": create_map("","45678","","012345678",com[1:])
		elif mode=="Hex": create_map("","456","","0123456",com[1:])
		elif mode=="von_Neumann": create_map("","4","","01234",com[1:])
	elif com.startswith("-"):
		create_list(com[1:])
	elif "/" in com and (not ("c/" in com or 'k' in com) or "B" in com):
		if "=" in com: com = com.split("=")
		else: com = [com,""]
		command = com[1]
		comB, comS=com[0].replace(postfix[mode],"").replace("B","").replace("S","").split("/")
		speed_is_known = True
		min_dx = 0
		min_dy = 0
		min_dp = 1
		if type=="glider":
			if "c" in command:
				vel=command_filter(command)
				vel=vel.replace("/","")
				vel=vel.split("c")
				if vel[0]=="": min_dx=1
				elif "," in vel[0]:
					min_dx = int(vel[0].split(",")[0])
					min_dy = int(vel[0].split(",")[1])
				else:
					min_dx = int(vel[0])
				vel[1] = vel[1].replace("o","")
				vel[1] = vel[1].replace("d","")
				vel[1] = vel[1].replace("k","")
				if vel[1]=="": min_dp = 1
				else: min_dp = int(vel[1])
				if "d" in command: min_dy = min_dx
				if "k" in command or "o" in com: min_dy = 0
		for k in glider_impossible:
			if (set(k[0]) <= set(comB) <= set(k[2])) and (set(k[1]) <= set(comS) <= set(k[3])) and eval(k[5]):
				print(k[4])
				print()
				break
		else:
			no=True
			for i in range(len(g)):
				if glider(i+1,com[0],com[1]):
					print()
					no=False
				if "0" in comB:
					if glider(i+1,"B"+inv_trans(comS)+"/S"+inv_trans(comB)+postfix[mode]):
						print()
						no=False
			if no: print("No gliders are known.\n")
	elif com.startswith("_"):
		num = int(com[1:])
		if num>len(g): print(f"only {len(g)} {pat_type[type][2]} are known")
		elif num<1: print("numbering starts from 1")
		else: print(gt[num-1])
		print()
	elif com.startswith("*"): all_gliders(com[1:])
	elif com.startswith("+"):
		if type=="glider": show_redundant_gliders()
		elif type=="oscillator": show_redundant_oscillators()
	elif com.startswith("a"): all_discoverers(com[1:])
	elif com in ["","c","help","usage","?"]:
		if type=="glider": print(usage_glider)
		else: print(usage_oscillator)
	elif com in ["update","refresh","reload"]:
		try:
			load_db()
			print("Database reloaded")
		except:
			print("Failed to reload database")
		finally: print()
	elif com in ["quit","exit"]: break
What's new:
  • All features of the original glider.c are now implemented, including the "+" command and an explanation of why gliders cannot exist in some non-B0 rules
  • New options: kMM/NN and {NAME}
  • Wildcard support when searching by discoverer or name
  • Reworked implementation of the "-" command
Updated list of commands:

Code: Select all

usage:
  n               to output the nth known glider
  _n              to output the nth row from the database
  B3/S23          to list known gliders for this rule (add "=" before additional options)
  -string         to list rules having gliders with matching speed and direction
  )string         to chart matching gliders for each rule with B0 and without S8
  @string         to chart matching gliders for each rule with B2
  #string         to chart matching gliders for each rule with B3
  @#string        to chart matching gliders for each rule with B23
  *               to list all gliders
  +               to list all redundant gliders
  a               to list all discoverers

options for -, ), @, #, and @#:
  n               to chart counts of the number of known gliders (the default)
  u               to chart counts of the number of known unsimplified speeds
  v               to chart counts of the number of known simplified speeds
  p               to chart the maximum known glider unsimplified period
  i               to chart the maximum known glider simplified period
  s               to chart the minimum known glider size

additional options:
  MMc/NN          to show only gliders with the given speed
  XX,YYc/PP       to show only gliders with the given speed (XX is greater than YY)
  o               to show only gliders that move orthogonally
  d               to show only gliders that move diagonally
  k               to show only gliders that move at a knights move or other off-slope
  kMM/NN          to show only gliders with slope MM/NN
  {NAME}          to show only gliders with a name matching the given wildcard
  :PERSON         to show only gliders discovered by specified person
Examples of new features:
new-gliders.db:

Code: Select all

>>>*{sir*}
#C The Sir Robin (glider 22084), (2,1)c/6
#C Discovered by Adam P. Goucher and Tomas Rokicki, 2018
#C
#C B012345678 S012345678
#C  ---X-----  --XX-----
#C
x = 79, y = 31, rule = B3/S23
65b2obo3bo$43b3o18bo3bob3o$39b2o2b2o15b2o3b3o4b2o$41bobo2bo14b2o6bo3bo$
38bobo4bo11bobo2bo3bob2o4bo3bo$37b2o4bo13bo4bo2b3o5b3obo$32b2obobo4bobo
3bo2b3o2bob2obo3b2obob4o3bo$32b2obobo3b2o2b2o3bob2o2b2o5b2o2bo2b3o$24b2o
11bo2bo4b2obobob2o2b2o5b2o2bo2b2o$23bobo5bo4b2obo5bob2obo2bo2b2o6bobo$
21bo3bo5bo3b2o2b2o3b2o3b2ob2obobo$18b4o3bo5bo2bo4bob2obo5b3o5bo$13b3o5bo
3bo2bo3b2o9bo8b3o3bo$17bo2bo6bob3obo24bo$11b2obobo10bo3b3o22bo$6b2o2bobo
b4ob2o3bo3b2o2b2o$6bo7bo5bo5bob3obo$4b3o5bo4bobo6bob2o2b2o$4b2o4bo3bobob
o6b2o$4b2ob2ob2ob3o2b2obob2o4bobo$4b2ob2o4bob4o11bo2$2b2o6bo$bobo6bo$3bo
2bo3bo$o4bobobo$3o2bobo$4bo2bo3bo$4b2obo3bo$6bo2bo$8bo!

>>>*k3
#C Glider 1400, (3,1)c/20
#C
#C B012345678 S012345678
#C  XX----X-   XXX-X----
#C
x = 4, y = 5, rule = B016/S0124
ob2o$4o$3bo$o2bo$3bo!

#C Glider 2955, (3,1)c/26
#C
#C B012345678 S012345678
#C  ---X-X-X-  X-X-XX-XX
#C
x = 6, y = 5, rule = B357/S024578
2b2o$2b3o$b2o$b2o$4obo!

#C Glider 3331, (3,1)c/10
#C
#C B012345678 S012345678
#C  X-XXX----  --X-X----
#C
x = 6, y = 6, rule = B0234/S24
obo$o$o3bo$b2ob2o$5o$b3o!

#C Glider 3435, (3,1)c/20
#C
#C B012345678 S012345678
#C  XXXX-X---   X-XXXX--
#C
x = 6, y = 6, rule = B01235/S13456
2b3o$obob2o$o2bobo$6o$3bobo$3bobo!

#C Glider 3442, (3,1)c/66
#C
#C B012345678 S012345678
#C  XX-XX--X-  -XXXXX---
#C
x = 6, y = 6, rule = B01347/S12345
bo$ob2o$bo2bo$2b4o$4bo$2b2o!

#C Glider 4204, (3,1)c/66
#C
#C B012345678 S012345678
#C  XXX-----X  X-XX--X--
#C
x = 5, y = 7, rule = B0128/S0236
o2bo$4bo$ob2o$bo$bobo$4bo$2b2o!

#C Glider 6697, (3,1)c/10
#C
#C B012345678 S012345678
#C  XXXX-X-XX  XXXX---X-
#C
x = 8, y = 8, rule = B0123578/S01237
2ob2o$bob2o$3bob2o$7bo$2bobob2o$5o2bo$o2bo2bo$bo3bo!

>>>*c2k{?*}
#C The Great Britain and France (glider 31682), (2,1)c/4
#C Discovered by LaundryPizza03, 2021
#C
#C B012345678 S012345678
#C  X-XXX-X--  X-XX-----
#C
x = 25, y = 25, rule = B02346/S023
7bo$5b2o$bo3b3o$6bo$o6bo2bo$5b2obo2bo$6b4o$5b3ob2o$3bob4obo3bobo$3bob5o
4b2o$11bo$11b2o5b2o$4b3o3bobo2bob2obo$4b3o6b5ob3o$11b2ob2ob3obo$11b10ob
2o$13bobob4ob2o$16b6ob2o$16b2ob4obo$17b7o$16b6obo$17b5obo$18b2obobo$19b
2o2bo$21b2o!

>>>-2,1c6
Totalistic rules for which 2,1c6 gliders are known:

    B012345678 S012345678 
     ---X----   ---XXX-- 
     ---X----   ---XXX-X-
     ---X----   --XX-----
     ---X--X--  --X-XX---
     ---X--XXX  ---XX-XXX
     ---X-XX--   --X-XX-X
     ---X-XX-X  ---X-XX--
     ---X-XX-X  X--X-XX-X
     ---X-XXX-  -X--XX-XX
     X-XXXX---  X--XX----
     XXX-XX---  XXX--X---
     XXXX--XX-  XXX----X-

Total: 18 rules

>>>ac3o:m*
All discoverers of c3o gliders:

    Discoverer            Total   Partial      Shared

    May13                 115     115          0
    Matthias Merzenich    58      58           0
    Michael Simkin        1       1            0
    Mark Niemiec          1       1            0

Total: 4 discoverers
B3 map of c/3 diagonal spaceships ():

Code: Select all

>>>#c/3d
             B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B B
             3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
                                             4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 
                             5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5                 
                     6 6 6 6 6 6 6 6                 6 6 6 6 6 6 6 6         
                 7 7 7 7         7 7 7 7         7 7 7 7         7 7 7 7     
               8 8     8 8     8 8     8 8     8 8     8 8     8 8     8 8   
            ----------------------------------------------------------------
S          :                                                                
S        8 :                                                                
S       78 :                                                                
S       7  :                                                                
S      67  :                                                                
S      678 :                                                                
S      6 8 :                                                                
S      6   :                                                                
S     56   :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     56 8 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     5678 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     567  :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     5 7  :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     5 78 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     5  8 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S     5    :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    45    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    45  8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    45 78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    45 7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4 6   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4 6 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4 678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4 67  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4  7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4  78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4   8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S    4     : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S   34     : 3 3 3 3 1 1 1 1 1 1 1 1 2 2 2 3 1 1 . . . . . . 1 1 2 1 . . 1 1
S   34   8 : 3 3 3 3 1 1 1 1 1 1 1 1 2 2 2 3 1 1 . . . . . . . 1 2 1 1 . 1 1
S   34  78 : 4 4 3 3 2 2 2 2 2 2 1 2 3 3 2 2 1 1 . . . . . . 1 1 1 1 1 1 1 1
S   34  7  : 4 4 3 3 2 2 2 2 2 1 1 1 2 2 2 3 1 1 . . . . . . . 1 1 1 1 1 1 1
S   34 67  : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 2 1 1 1 1 . . . . 2 1 1 2 1 2 1 1
S   34 678 : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . 2 1 1 2 1 1 1 1
S   34 6 8 : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 2 2 2 1 1 1 1
S   34 6   : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 1 1 1 1 1 1 1
S   3456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S   3456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S   345678 :                                                                
S   34567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S   345 7  : 1 1 1 1 1 1 1 1 1 . 1 . 1 2 2 1 . . . . . . . . . . . . . . . .
S   345 78 : 1 1 1 1 1 2 1 1 1 1 1 . 1 1 2 . . . . . . . . . . . . . . . . .
S   345  8 : . . . . 1 1 . . . . 1 . 1 1 1 1 . . . . . . . . . . . . . . . .
S   345    : . . . . 1 1 . 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S   3 5    : . . . . 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 . 1 1 1 1 1 1 1 1 1 . 1
S   3 5  8 : . . . . 1 1 1 1 1 1 1 1 2 2 1 2 1 1 1 2 1 1 1 1 3 2 2 3 1 1 . 1
S   3 5 78 : . . . . 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2
S   3 5 7  : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 1 2 1 1 2
S   3 567  : . . . . 1 . . . 1 1 1 1 1 1 1 1 . . . 1 . . . . 1 1 2 1 1 2 1 1
S   3 5678 : . . 1 1 1 1 . . 1 1 1 1 1 1 1 1 . 1 . . . . . . 1 1 2 2 1 1 1 1
S   3 56 8 : . . . . 1 1 1 1 3 1 1 2 1 1 1 1 1 1 1 1 . . . . 2 1 1 3 1 1 2 2
S   3 56   : . . . . 1 . . 1 1 . 1 1 2 1 1 . . . . . . . . . 1 1 1 1 1 1 1 1
S   3  6   :                                                                
S   3  6 8 :                                                                
S   3  678 :                                                                
S   3  67  :                                                                
S   3   7  :                                                                
S   3   78 :                                                                
S   3    8 :                                                                
S   3      :                                                                
S  23      :                                                                
S  23    8 :                                                                
S  23   78 :                                                                
S  23   7  :                                                                
S  23  67  :                                                                
S  23  678 :                                                                
S  23  6 8 :                                                                
S  23  6   :                                                                
S  23 56   : . . . . 1 1 2 2 . 1 . . 1 1 1 1 . . . . . . . . . . . . . . . .
S  23 56 8 : . . . . 1 1 1 1 . 1 1 . 1 1 1 1 . . . . . . . . . . . . . . . .
S  23 5678 : . . 1 1 . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . .
S  23 567  : . . . . 1 1 2 . . . . . . 1 . . . . . . . . . . . . . . . . . .
S  23 5 7  : 1 1 1 1 2 2 2 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S  23 5 78 : 1 1 2 1 2 2 2 2 1 1 1 1 1 1 1 1 . . . . . . . . . . . 1 . . . .
S  23 5  8 : 1 1 2 3 2 1 2 2 1 1 1 1 2 1 2 3 . . . . . . . . . . . . . . . .
S  23 5    : 1 1 1 2 1 1 2 1 1 1 2 1 1 1 1 1 . . . . . . . . . . . . . . . .
S  2345    : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2345  8 : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2345 78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2345 7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  234567  :                                                                
S  2345678 :                                                                
S  23456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  23456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  234 6   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  234 6 8 : . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . .
S  234 678 : . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S  234 67  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  234  7  : . . . . . . . . 1 1 . . 1 1 . . . . . . . . . . . . . . . . . .
S  234  78 : . . . . 1 1 . . . . . . 1 1 . . . . . . . . . . . . . . . . . .
S  234   8 : 1 1 . . . . . . 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S  234     : 1 1 . . . . . . 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S  2 4     : 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 . . . . . 1 . . 2 2 1 2 1 . 1 1
S  2 4   8 : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . . . . 1 1 . . 1 1 1 2 1 . 1 1
S  2 4  78 : . . . . 1 . . . 2 1 1 1 1 1 1 1 . . . . . . . . 2 1 1 3 2 1 1 2
S  2 4  7  : . . . . 1 . . . 1 1 2 1 1 1 1 1 . . 1 . . . . . 2 1 1 3 1 . 1 2
S  2 4 67  : . . . . 1 1 . 2 1 1 2 1 2 1 2 2 . . . 1 . . . . 1 1 1 1 1 2 1 1
S  2 4 678 : . . . . 1 1 1 2 1 2 3 1 2 1 2 3 1 1 . 1 . . . . 1 1 1 1 1 1 1 1
S  2 4 6 8 : 1 1 1 1 1 1 2 3 2 2 2 2 1 1 2 2 . . . . . . . . 1 2 1 1 1 1 1 1
S  2 4 6   : 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 2 . . . . . . . . 1 2 1 1 1 1 1 1
S  2 456   : . . . . . 1 . . 1 . . 1 . 1 2 2 . . . . . . . . . . . . . . . .
S  2 456 8 : . . . . 1 1 1 1 1 . . 1 1 1 2 1 . . . . . . . . . . . . . . . .
S  2 45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2 4567  : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2 45 7  : 1 1 1 . 1 2 1 1 1 2 1 1 1 1 2 2 . . . . . . . . . 1 . 1 . 1 1 2
S  2 45 78 : 1 1 1 . . 1 1 1 2 1 2 1 2 1 1 2 . . . . . . . . . . . . . 1 2 1
S  2 45  8 : 1 1 . . 1 1 1 1 1 1 2 1 1 1 1 1 . . . . . . . . 1 1 1 1 1 1 1 1
S  2 45    : 1 1 . . 1 1 1 1 1 1 1 1 1 1 1 1 . . 1 1 1 . . . . . 1 2 1 . 1 1
S  2  5    : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 3 1 1 1 1 1 1 1 1 1
S  2  5  8 : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1
S  2  5 78 : . . . . . . . . 1 1 1 1 4 4 2 2 . . 1 1 1 1 . . 2 1 1 1 1 2 1 1
S  2  5 7  : . . . . . . . . 1 1 1 1 3 3 1 1 1 1 1 1 1 1 . . 3 2 1 1 1 2 2 2
S  2  567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2  5678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S  2  56 8 : . . . . . . . . 2 2 1 2 1 1 1 2 . . 1 1 . . 1 1 . 1 1 . 1 1 . 1
S  2  56   : . . . . . . . . 2 2 1 1 1 1 2 2 1 1 1 1 1 . 1 1 1 1 . 1 . . . .
S  2   6   :                                                                
S  2   6 8 :                                                                
S  2   678 :                                                                
S  2   67  :                                                                
S  2    7  :                                                                
S  2    78 :                                                                
S  2     8 :                                                                
S  2       :                                                                
S 12       :                                                                
S 12     8 :                                                                
S 12    78 :                                                                
S 12    7  :                                                                
S 12   67  :                                                                
S 12   678 :                                                                
S 12   6 8 :                                                                
S 12   6   :                                                                
S 12  56   : . . . . . . . . 1 1 . . 1 1 1 1 . . . . . . . . . . . . . . . .
S 12  56 8 : . . . . . . . . 1 1 . 1 1 1 1 1 . . . . . . . . . . 1 . . . . .
S 12  5678 : . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . . . . . .
S 12  567  : . . . . . . . . 1 1 1 1 . . . 1 . . . . . . . . . . . . . . . .
S 12  5 7  : . . . . 1 1 . . 1 1 1 1 1 1 1 1 . . . . . . . . . . 1 1 . . . .
S 12  5 78 : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . 1 . 1 1 . . . .
S 12  5  8 : . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . 1 . . 1 . .
S 12  5    : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . 1 . . . . .
S 12 45    : 1 1 1 . 2 1 1 1 . 2 . . 1 1 3 1 . . . . . . . . . . . . . . . .
S 12 45  8 : 1 1 1 . 3 1 1 1 . 1 1 1 1 1 2 1 . . . . . . . . . . . . . . . .
S 12 45 78 : 1 1 1 . . . 2 3 . 1 2 1 1 2 2 1 . . . . . . . . . . . . . . . .
S 12 45 7  : 1 1 1 . . 1 1 2 1 1 1 1 1 1 2 1 . . . . . . . . . . . . . . . .
S 12 4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 12 45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 12 456 8 : . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . .
S 12 456   : . . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . .
S 12 4 6   : . . . . 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 12 4 6 8 : . . 1 . 2 1 . 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 12 4 678 : . . . . 1 . 1 . 1 2 1 2 1 1 2 2 . . . . . . . . 1 . . . . . . .
S 12 4 67  : . . . . 2 1 . . 1 1 1 1 1 1 2 2 . . . . . . . . . . . . . . . .
S 12 4  7  : . . . . . . 1 1 2 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 12 4  78 : . . . . . . 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 12 4   8 : . . . . . . 1 2 1 2 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 12 4     : . . . . . . 1 2 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 1234     : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234   8 : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234  78 : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234  7  : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234 67  : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234 678 : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234 6 8 : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 1234 6   : . . . . . . . . . . . . . . . .                 . . . . . . . .
S 123456   :                                                                
S 123456 8 :                                                                
S 12345678 :                                                                
S 1234567  :                                                                
S 12345 7  : . . . . . . . . . . . . . . . .                                
S 12345 78 : . . . . . . . . . . . . . . . .                                
S 12345  8 : . . . . . . . . . . . . . . . .                                
S 12345    : . . . . . . . . . . . . . . . .                                
S 123 5    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5  8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5 78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5 7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 5678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 56 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123 56   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 123  6   :                                                                
S 123  6 8 :                                                                
S 123  678 :                                                                
S 123  67  :                                                                
S 123   7  :                                                                
S 123   78 :                                                                
S 123    8 :                                                                
S 123      :                                                                
S 1 3      :                                                                
S 1 3    8 :                                                                
S 1 3   78 :                                                                
S 1 3   7  :                                                                
S 1 3  67  :                                                                
S 1 3  678 :                                                                
S 1 3  6 8 :                                                                
S 1 3  6   :                                                                
S 1 3 56   : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . 2 1 . 1 1 1 1 1
S 1 3 56 8 : . . . . 1 1 1 1 2 1 1 1 1 1 2 2 . . . . . . . . 1 1 1 . 1 1 1 1
S 1 3 5678 : . . 1 1 2 1 1 1 1 2 . 1 1 1 1 2 . . . . . . . . . . . . 1 1 2 2
S 1 3 567  : . . . . 1 1 1 1 1 3 1 1 1 1 1 1 . . . . . . . . 1 . . . 1 1 1 1
S 1 3 5 7  : . . 1 . 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . . . 1 1 1 2 1 1 1 1
S 1 3 5 78 : . . 1 . 2 2 1 1 1 1 2 2 1 1 1 1 . . . . . . . . 2 1 2 3 1 1 2 3
S 1 3 5  8 : . 1 2 . 1 1 1 1 1 2 2 2 1 1 1 1 . . . . . . . . 3 2 1 1 1 2 1 1
S 1 3 5    : . 1 2 . 1 1 1 1 1 1 2 2 1 2 1 1 . . . . . . . . 2 1 1 1 1 1 1 1
S 1 345    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 345  8 : . . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . .
S 1 345 78 : 1 1 1 1 1 2 2 1 . . . 1 . . . . . . . . . . . . . . . . . . . .
S 1 345 7  : 1 1 1 1 1 1 1 1 . . . . 1 1 1 . . . . . . . . . . . . . . . . .
S 1 34567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 345678 :                                                                
S 1 3456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 3456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1 34 6   : 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . 1 . . . . . .
S 1 34 6 8 : 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 1 34 678 : 2 2 2 2 1 1 1 1 1 2 . 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 1 34 67  : 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 1 34  7  : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 2 2 . . . . . . . . . . . . . . . .
S 1 34  78 : 1 1 1 1 2 2 2 2 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . 1 . .
S 1 34   8 : 2 2 2 2 1 1 2 2 1 1 . 1 2 2 1 1 . . . . . . . . . . . . . . . .
S 1 34     : 2 2 2 2 1 1 2 2 1 1 . 1 1 1 1 1 . . . . . . . . . . . . . . . .
S 1  4     : . . . . . . . . 1 1 . . . 1 . . . . . . . . . . . . . . . . . .
S 1  4   8 : . . . . . . . . 1 1 . . . 1 . . . . . . . . . . . . . . . . . .
S 1  4  78 : . . . . . . . . 1 1 . . . 1 . . 1 1 1 2 . . 1 1 . . . . . . . 1
S 1  4  7  : . . . . . . . . 1 1 . . . 1 . . 1 2 . 1 . . . . . . . . . . . 1
S 1  4 67  : . . . . . . . . 1 1 1 1 1 1 . . . 1 1 1 . . 1 . . . . 1 . . . .
S 1  4 678 : . . . . . . . . 1 1 1 1 . 1 . . 1 1 1 1 . . 1 . 1 . . 1 . . . .
S 1  4 6 8 : . . . . . . . . 1 1 1 1 1 1 1 . . . . 1 . . . . 1 1 . 1 . 1 . .
S 1  4 6   : . . . . . . . . 1 1 1 2 1 1 1 . . . 1 . . . . . 1 . . . . 1 . .
S 1  456   : . . . . . . . . 1 1 1 1 . . . . 1 1 1 1 . . . . . . . . . . . .
S 1  456 8 : . . . . . . . . 1 . . . . . 1 . . 1 1 . . . . . . . . . . . . .
S 1  45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1  4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1  45 7  : . . . . . . . . 1 1 1 2 . . . . 1 1 . 1 . . 1 . 1 1 . 1 . . . .
S 1  45 78 : . . . . . . . . 1 1 1 1 1 . . . . . . 1 . 1 . 1 . 1 . 1 . . . .
S 1  45  8 : . . . . . . . . . . 1 1 . . . . 2 3 . 1 . 1 1 . . . . . . . . .
S 1  45    : . . . . . . . . 1 1 1 1 . . . . 1 1 . 1 . . 1 1 . . . . . . . .
S 1   5    : . . . . . . . . . . . . . . . . . . 1 1 1 1 1 1 . . . . . . . .
S 1   5  8 : . . . . . . . . . . . . . . . . . . . . 1 1 1 1 . . . . . . . .
S 1   5 78 : . . . . . . . . . . . . . . . . . . 1 1 1 1 1 1 2 2 1 1 . . . .
S 1   5 7  : . . . . . . . . . . . . . . . . . . 1 1 . . . 1 1 1 . . . . . .
S 1   567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1   5678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1   56 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1   56   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S 1    6   :                                                                
S 1    6 8 :                                                                
S 1    678 :                                                                
S 1    67  :                                                                
S 1     7  :                                                                
S 1     78 :                                                                
S 1      8 :                                                                
S 1        :                                                                
S01        :                                                                
S01      8 :                                                                
S01     78 :                                                                
S01     7  :                                                                
S01    67  :                                                                
S01    678 :                                                                
S01    6 8 :                                                                
S01    6   :                                                                
S01   56   : . . . . . . . . 1 1 . . . . . . . . . . . . . . . 1 . . . . . .
S01   56 8 : . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . .
S01   5678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01   567  : . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . .
S01   5 7  : . . . . . . . . . . . . . . 1 1 1 2 1 2 . . . . 1 1 . . . . . .
S01   5 78 : . . . . . . . . . . . . . . . 1 . . . . . . 1 1 . . . . . . . .
S01   5  8 : . . . . . . . . . . . . . . 1 1 . . . . . . 1 1 . . . . 1 1 . .
S01   5    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1 . .
S01  45    : . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . .
S01  45  8 : . . . . . . . . 1 . . . . . . 1 1 2 . 1 . . . . . . . . . . . .
S01  45 78 : . . . . . . . . 1 1 . . 1 2 . . . 1 . . . . . . 1 1 . 1 1 2 . .
S01  45 7  : . . . . . . . . 1 1 1 2 2 2 . . . 1 . . . . 1 . . . 1 . . . . .
S01  4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01  45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01  456 8 : . . . . . . . . . . . . 1 1 1 1 . 1 . . . . . . . . . . . . . .
S01  456   : . . . . . . . . 1 1 . . 1 1 2 1 1 1 1 . . . . . . . . . . . . .
S01  4 6   : . . . . . . . . 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 1 . . 1 1 . .
S01  4 6 8 : . . . . . . . . 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 . . . 1 1 . .
S01  4 678 : . . . . . . . . 1 1 1 1 1 1 1 . 1 1 1 1 . . . . 1 1 1 2 . 1 . .
S01  4 67  : . . . . . . . . 1 1 1 1 1 1 2 1 1 1 . . . . . . 1 1 . 1 . . . .
S01  4  7  : . . . . . . . . 1 1 . 1 1 2 2 1 . . . . . . . . . 1 1 1 1 1 . .
S01  4  78 : . . . . . . . . 1 1 . 1 1 2 2 1 . . . . . . . . 1 2 . . 1 1 . .
S01  4   8 : . . . . . . . . 1 1 1 1 1 2 2 1 . . . . . . . . . . 1 1 1 1 1 1
S01  4     : . . . . . . . . 1 1 1 1 1 2 2 1 . . . . . . . . . . . . 1 1 1 1
S01 34     : 2 2 2 2 1 1 2 2 1 . . 1 . . 1 1 . . . . . . . . . . . . 1 . . 1
S01 34   8 : 2 2 2 2 1 1 2 2 1 . . 1 . 1 1 1 . . . . . . . . . . . . 1 . . 1
S01 34  78 : 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S01 34  7  : 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S01 34 67  : 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 . . . . . . . . . . . . . . . .
S01 34 678 : 1 1 1 1 1 1 1 1 1 1 . 1 1 2 1 1 . . . . . . . . . . . . . . . .
S01 34 6 8 : 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 . . . . . . . . . . . . . . . .
S01 34 6   : 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 1 . . . . . . . . . . . . . . . .
S01 3456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 3456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 345678 :                                                                
S01 34567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 345 7  : . . . . 1 1 1 . . . . . . 1 1 . . . . . . . . . . . . . . . . .
S01 345 78 : . . . . 1 1 1 . . . . . . . . . . . . . . . . . . . . . . . . .
S01 345  8 : . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . .
S01 345    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S01 3 5    : 1 1 1 1 1 2 1 1 2 1 1 1 2 2 1 1 . . . . . . . . . . . . . . . .
S01 3 5  8 : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . 1 . . . .
S01 3 5 78 : 1 1 1 1 3 2 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . 1 1 . . . .
S01 3 5 7  : 1 1 1 1 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . 1 . . . . .
S01 3 567  : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S01 3 5678 : . . 1 1 1 1 1 2 1 2 1 2 1 1 1 1 . . . . . . . . . . . . . . 1 1
S01 3 56 8 : . . 1 1 1 2 2 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . 1
S01 3 56   : 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 . . . . . . . . . . . . . 1 . .
S01 3  6   :                                                                
S01 3  6 8 :                                                                
S01 3  678 :                                                                
S01 3  67  :                                                                
S01 3   7  :                                                                
S01 3   78 :                                                                
S01 3    8 :                                                                
S01 3      :                                                                
S0123      :                                                                
S0123    8 :                                                                
S0123   78 :                                                                
S0123   7  :                                                                
S0123  67  :                                                                
S0123  678 :                                                                
S0123  6 8 :                                                                
S0123  6   :                                                                
S0123 56   :                                                                
S0123 56 8 :                                                                
S0123 5678 :                                                                
S0123 567  :                                                                
S0123 5 7  :                                                                
S0123 5 78 :                                                                
S0123 5  8 :                                                                
S0123 5    :                                                                
S012345    :                                                                
S012345  8 :                                                                
S012345 78 :                                                                
S012345 7  :                                                                
S01234567  :                                                                
S012345678 :                                                                
S0123456 8 :                                                                
S0123456   :                                                                
S01234 6   :                                                                
S01234 6 8 :                                                                
S01234 678 :                                                                
S01234 67  :                                                                
S01234  7  :                                                                
S01234  78 :                                                                
S01234   8 :                                                                
S01234     :                                                                
S012 4     : . . . . . . . . 1 . . . 1 1 . 1 . . . . . . . . . . . . . . . .
S012 4   8 : . . . . . . . . . . 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S012 4  78 : . . . . . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S012 4  7  : . . . . . . . . . 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S012 4 67  : . . . . . . . 1 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S012 4 678 : . . . . . . . 1 1 1 1 1 1 2 1 1 . . . . . . . . . . . . . . . .
S012 4 6 8 : . . . . . . . . 1 1 1 1 1 2 2 2 . . . . . . . . . . . . . . . .
S012 4 6   : . . . . . . . . 1 1 1 1 1 1 2 1 . . . . . . . . . . . . . . . .
S012 456   : . . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . .
S012 456 8 : . . . . 1 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S012 45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S012 4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S012 45 7  : . . . . . . . . 1 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S012 45 78 : . . . . . . . 1 . . 1 1 1 2 1 1 . . . . . . . . . . . . . . . .
S012 45  8 : . . . . 1 1 . 1 . 1 1 1 1 1 1 1 . . . . . . . . . . . . . . . .
S012 45    : . . . . . . 1 1 . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S012  5    : . . . . . . . . 1 . . . . . 1 1 . . . . . . . . . . . . . . . .
S012  5  8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S012  5 78 : . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . . . . . . . .
S012  5 7  : . . . . . . . . . 1 1 . . 1 . . . . . . . . . . . . . . . . . .
S012  567  : . . . . . . . . 1 1 1 1 . . . . . . . . . . . . . . . . . . . .
S012  5678 : . . . . . . . . 1 1 2 1 . . . . . . . . . . . . . . . . . . . .
S012  56 8 : . . . . . . . . . 1 1 1 1 1 1 . . . . . . . . . . . . . . . . .
S012  56   : . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . .
S012   6   :                                                                
S012   6 8 :                                                                
S012   678 :                                                                
S012   67  :                                                                
S012    7  :                                                                
S012    78 :                                                                
S012     8 :                                                                
S012       :                                                                
S0 2       :                                                                
S0 2     8 :                                                                
S0 2    78 :                                                                
S0 2    7  :                                                                
S0 2   67  :                                                                
S0 2   678 :                                                                
S0 2   6 8 :                                                                
S0 2   6   :                                                                
S0 2  56   : . . . . 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . 1 1 1 1 1 1 . . . .
S0 2  56 8 : . . . . 1 2 1 . 1 1 1 2 1 1 1 1 . . 1 1 1 . 1 1 1 1 1 1 . . . .
S0 2  5678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2  567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2  5 7  : . . . . . . . . 1 1 1 1 3 2 2 1 1 2 1 1 1 1 . 1 1 1 1 1 3 2 3 3
S0 2  5 78 : . . . . . . . . 1 1 1 1 2 1 1 1 . . 1 1 1 . 1 1 1 1 1 1 2 1 1 1
S0 2  5  8 : . . . . . . 1 1 2 1 1 2 2 2 1 2 1 1 1 . 1 1 1 1 1 1 1 1 1 1 1 1
S0 2  5    : . . . . . . . . 2 1 1 2 2 2 1 1 1 1 1 1 2 1 2 1 1 1 1 1 2 2 2 2
S0 2 45    : 1 1 . . 1 1 1 1 1 1 1 . 1 1 1 1 . . . . . . . . . 1 . . . . 1 1
S0 2 45  8 : 1 1 . . 1 1 1 1 1 1 2 1 1 1 1 1 . . . . . . . . . . 1 . 1 1 1 1
S0 2 45 78 : 1 1 . . 1 . 1 1 1 1 1 1 1 2 1 1 . . . . . . . . . 1 . . . 1 . .
S0 2 45 7  : 1 1 . . 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . . . . 1 . . 1 . 1 1
S0 2 4567  : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2 456 8 : . . . . 2 1 1 1 1 1 . 1 1 1 1 1 . . . . . . . . . . . . . . . .
S0 2 456   : . . . . . . . . . . . . . 1 1 1 . . . . . . . . . . . . . . . .
S0 2 4 6   : 1 1 . 1 2 1 3 3 1 1 2 1 2 2 2 2 . . . . . . . . 1 1 1 1 2 1 1 1
S0 2 4 6 8 : 1 1 1 1 2 1 2 2 1 1 2 1 1 1 1 1 . . . . . . . . 1 2 1 1 2 2 1 1
S0 2 4 678 : . . . . 2 1 2 3 1 1 2 1 2 1 1 2 1 . . . . . . . 1 1 1 2 1 1 1 1
S0 2 4 67  : . . . . 2 1 1 2 1 1 1 1 2 1 1 1 . . . . . . . . 1 1 1 1 3 1 2 1
S0 2 4  7  : . . . . 1 1 1 2 1 1 2 1 1 1 1 1 . . . . . . . . 1 1 1 1 1 1 1 1
S0 2 4  78 : . . . . 1 1 1 2 2 1 2 1 1 1 1 1 . . . . . . . . 1 1 1 1 1 1 1 1
S0 2 4   8 : 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 1 . . 1 . . . . . 1 3 1 . 1 1 1 1
S0 2 4     : 2 2 1 1 1 2 1 1 1 1 1 1 1 1 1 1 . . 1 . . . . . 1 2 . . 1 1 1 1
S0 234     : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 234   8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 234  78 : . . . . . . . . . . . . 1 1 . . . . . . . . . . . . . . . . . .
S0 234  7  : . . . . . . . . 1 1 . . 1 1 . . . . . . . . . . . . . . . . . .
S0 234 67  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 234 678 : . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . .
S0 234 6 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 234 6   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 23456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 23456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345678 :                                                                
S0 234567  :                                                                
S0 2345 7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345 78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345  8 : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 2345    : . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . .
S0 23 5    : 1 1 1 1 1 1 1 1 2 1 1 . 1 1 3 2 . . . . . . . . . . . . . . . .
S0 23 5  8 : 1 1 . . 2 2 2 1 1 1 1 1 2 2 3 2 . . . . . . . . . . . . . . . .
S0 23 5 78 : 1 1 . . 1 1 1 1 1 1 1 1 1 2 2 1 . . . . . . . . . . . . . . . .
S0 23 5 7  : 1 1 . . 1 1 1 1 1 1 1 1 1 2 2 1 . . . . . . . . . . . . . . . .
S0 23 567  : . . . . 1 1 1 . . . . . . . 1 . . . . . . . . . . . . . . . . .
S0 23 5678 : . . 1 1 . . 2 1 . . . . . . 1 1 . . . . . . . . . . . . . . . .
S0 23 56 8 : . . . . 1 1 2 1 . . . . 1 1 3 2 . . . . . . . . . . . . . . . .
S0 23 56   : . . . . 1 . 1 1 . . . . . . 1 1 . . . . . . . . . . . . . . . .
S0 23  6   :                                                                
S0 23  6 8 :                                                                
S0 23  678 :                                                                
S0 23  67  :                                                                
S0 23   7  :                                                                
S0 23   78 :                                                                
S0 23    8 :                                                                
S0 23      :                                                                
S0  3      :                                                                
S0  3    8 :                                                                
S0  3   78 :                                                                
S0  3   7  :                                                                
S0  3  67  :                                                                
S0  3  678 :                                                                
S0  3  6 8 :                                                                
S0  3  6   :                                                                
S0  3 56   : . . . . 1 1 . 1 1 1 1 1 2 1 1 1 . 1 . . . . . . 1 1 1 1 1 1 1 1
S0  3 56 8 : . . . . 1 3 1 1 2 1 1 1 1 1 1 1 1 1 1 1 . . . . 1 1 1 2 1 1 1 1
S0  3 5678 : . . 1 1 1 1 . . 1 1 1 1 1 1 1 1 . . . . . . . . 2 1 2 1 2 1 1 1
S0  3 567  : . . . . . . . . 1 1 1 1 1 1 1 1 1 . . . . . . . 1 1 1 1 1 1 1 1
S0  3 5 7  : . . . . 1 1 1 1 2 1 1 1 1 1 1 2 . 1 1 1 1 . 1 . 1 1 1 1 2 2 1 2
S0  3 5 78 : . . . 1 2 2 1 1 2 2 1 1 1 1 1 2 1 1 1 1 1 . 1 1 1 1 1 1 1 1 1 2
S0  3 5  8 : . . . . 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
S0  3 5    : . . . . . . 1 1 1 1 1 1 1 1 2 2 . 1 1 1 1 1 . 1 1 1 1 1 1 1 1 1
S0  345    : . . . . . 1 . . . . 1 1 1 . 1 1 . . . . . . . . . . . . . . . .
S0  345  8 : . . . . 1 1 1 1 . . . . 1 1 1 1 . . . . . . . . . . . . . . . .
S0  345 78 : 1 1 1 1 1 1 1 1 1 1 1 . 1 1 2 . . . . . . . . . . . . . . . . .
S0  345 7  : 1 1 1 1 1 1 1 1 . . 1 . 1 1 2 . . . . . . . . . . . . . . . . .
S0  34567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0  345678 :                                                                
S0  3456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0  3456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0  34 6   : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 1 1 1 1 1 1 1
S0  34 6 8 : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 1 1 1 2 1 1 1
S0  34 678 : 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 . . . . . . 2 1 1 1 1 1 1 1
S0  34 67  : 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 . . . . . . 2 1 1 2 1 1 1 1
S0  34  7  : 2 2 1 1 2 1 2 2 2 2 2 1 1 1 1 1 1 1 . . . . . . 1 2 1 1 2 1 1 1
S0  34  78 : 2 2 1 1 2 1 2 2 1 1 1 1 1 1 1 1 1 1 . . . . . . 1 1 2 1 1 1 1 1
S0  34   8 : 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 . . . . . . 1 1 1 1 1 1 1 1
S0  34     : 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 . . . . . . 1 1 1 1 1 1 1 1
S0   4     : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4   8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4  78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4  7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4 67  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4 678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4 6 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4 6   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   456   : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   456 8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45678 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   4567  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45 7  : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45 78 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45  8 : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0   45    : . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5    :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5  8 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5 78 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5 7  :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    567  :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    5678 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    56 8 :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0    56   :   . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
S0     6   :                                                                
S0     6 8 :                                                                
S0     678 :                                                                
S0     67  :                                                                
S0      7  :                                                                
S0      78 :                                                                
S0       8 :                                                                
S0         :                                                                

3095/10992
Redundant gliders in hex-gliders.db (with 640 gliders):

Code: Select all

>>>+
Loading: 0.25%
Loading: 1.72%
Loading: 4.45%
Loading: 53.59%
Loading: 56.43%
Loading: 59.61%
Loading: 60.38%
Loading: 62.48%
Loading: 63.63%
Loading: 92.72%
Loading: 97.81%
Loading: 99.06%
Loading: 99.21%
Loading: 99.92%
Loading complete.

Glider 35 is made redundant by glider 29.
12x11 (1,0)c/2 B2456/S24H - B2456/S246H
11x11 (1,0)c/2 B245/S24H - B2456/S246H

Glider 73 is made redundant by glider 71.
12x7 (1,0)c/2 B0136/S124H - B0136/S124H
8x8 (1,0)c/2 B0136/S124H - B0136/S124H

Glider 104 is made redundant by glider 254.
39x39 (1,0)c/6 B2/S245H - B2/S2456H
18x18 (1,0)c/6 B2/S245H - B26/S2456H

Glider 124 is made redundant by glider 157.
87x87 (1,0)c/5 B24/S345H - B24/S3456H
27x25 (1,0)c/5 B24/S345H - B246/S3456H

Glider 128 is made redundant by glider 129.
16x13 (1,0)c/2 B245/S125H - B245/S125H
13x12 (1,0)c/2 B245/S125H - B2456/S1256H

Glider 139 is made redundant by glider 627.
22x22 (1,0)c/2 B24/S16H - B24/S16H
12x9 (1,0)c/2 B24/S1H - B24/S16H

Glider 176 is made redundant by glider 175.
4x5 (1,0)c/4 B01234/S24H - B012346/S0124H
4x4 (1,0)c/4 B01234/S24H - B012346/S0124H

Glider 179 is made redundant by glider 192.
14x13 (1,0)c/8 B01234/S24H - B012346/S024H
12x11 (1,0)c/8 B01234/S24H - B0123456/S0124H

Glider 228 is made redundant by glider 229.
27x9 (1,0)c/5 B246/S3H - B246/S36H
25x9 (1,0)c/5 B246/S3H - B246/S36H

Glider 295 is made redundant by glider 296.
38x39 (1,0)c/4 B01345/S23H - B01345/S23H
32x31 (1,0)c/4 B01345/S23H - B01345/S023H

Glider 302 is made redundant by glider 344.
28x28 (1,0)c/5 B26/S2H - B26/S26H
26x23 (1,0)c/5 B2/S2H - B26/S26H

Glider 341 is made redundant by glider 342.
20x12 (1,0)c/2 B25/S0345H - B25/S0345H
15x15 (1,0)c/2 B25/S0345H - B256/S03456H

Glider 433 is made redundant by glider 420.
11x11 (1,1)c/8 B0135/S02H - B0135/S02H
10x10 (1,1)c/8 B013/S2H - B0135/S02H

Glider 520 is made redundant by glider 528.
18x18 (1,0)c/4 B01246/S135H - B01246/S135H
19x16 (1,0)c/4 B01246/S135H - B01246/S0135H

Total redundant gliders: 14
Edit: option {NAME} is experimental and may not work correctly in combination with other options.
The latest version of hex-gliders.db have 668 gliders from OT hexagonal rules. Let's find more!
My CA (13 rules)
My scripts: new-glider.py v0.2 (new version), nbsearch2a.py, collector.py v0.3

Post Reply