Golly question
-
- Posts: 841
- Joined: June 27th, 2009, 10:58 am
- Location: Germany
Golly question
How do I save a pattern in #P fromat instead of .rle or .mc?
Re: Golly question
It's not one of Golly's native output formats, so you'll have to write a script to do it.HartmutHolzwart wrote:How do I save a pattern in #P fromat instead of .rle or .mc?
It could be a fairly short script, depending on what you want. I can write an inefficient version in a few minutes:
copy-in-#P-format.py:
Code: Select all
import golly as g
r=g.getselrect()
if r==[]: g.exit("No pattern selected.")
if len(g.getcells(r))%2: g.note("States above 1 will be reduced to 1.")
out="#P "+str(r[0])+","+str(r[1])+"\n"
for y in range(r[1],r[1]+r[3]):
for x in range(r[0],r[0]+r[2]):
out += "." if g.getcell(x,y)==0 else "*"
out+="\n"
g.setclipstr(out)
Maybe the right way to do it would be to break up the pattern into non-overlapping small rectangles, and save each one separately, to keep the pattern size reasonable for large objects. Would that be useful to you, or no?
-
- Posts: 841
- Joined: June 27th, 2009, 10:58 am
- Location: Germany
Re: Golly question
It's meant to produce input files for gencols only. So just small files...