File: export.py

package info (click to toggle)
golly 3.2-2
  • links: PTS
  • area: main
  • in suites: buster
  • size: 19,516 kB
  • sloc: cpp: 69,819; ansic: 25,894; python: 7,921; sh: 4,267; objc: 3,721; java: 2,781; xml: 1,362; makefile: 530; perl: 69
file content (12 lines) | stat: -rw-r--r-- 346 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
# Change the entire pattern from emulated-Margolus states to N-state:

from glife import rect
import golly as g

r = rect( g.getrect() )
if r.empty: g.exit("There is no pattern.")

for row in xrange(r.top, r.top + r.height):
    for col in xrange(r.left, r.left + r.width):
        s = g.getcell(col,row)
        g.setcell(col, row, (s+s%2)/2-1)