56
56
data = fp.readlines()
59
if data[0].strip() != '#Life 1.05':
66
elif s.startswith('#N') or s.startswith('#R'):
67
# assume Conway (Normal) rules for now
69
elif s.startswith('#D'):
71
description = s[3:].strip()
73
description += "\n" + s[3:].strip()
74
elif s.startswith('#P'):
75
# beginning of a cell block
77
pattern['size'] = (width, height)
78
patterns.append(pattern.copy())
79
x, y = s[3:].split(' ')
83
pattern['position'] = (int(x), int(y))
60
if data[0].strip() != '#Life 1.05':
66
elif s.startswith('#N') or s.startswith('#R'):
67
# assume Conway (Normal) rules for now
69
elif s.startswith('#D'):
71
description = s[3:].strip()
86
pattern['rows'].append(s)
91
pattern['size'] = (width, height)
92
patterns.append(pattern.copy())
94
left, top, right, bottom = patternDimensions(patterns)
95
#print "bounds", left, top, right, bottom
96
#print "size", abs(right - left), abs(bottom - top)
97
return description, patterns, (left, top), (abs(right - left), abs(bottom - top))
73
description += "\n" + s[3:].strip()
74
elif s.startswith('#P'):
75
# beginning of a cell block
77
pattern['size'] = (width, height)
78
patterns.append(pattern.copy())
79
x, y = s[3:].split(' ')
83
pattern['position'] = (int(x), int(y))
86
pattern['rows'].append(s)
91
pattern['size'] = (width, height)
92
patterns.append(pattern.copy())
93
left, top, right, bottom = patternDimensions(patterns)
94
#print "bounds", left, top, right, bottom
95
#print "size", abs(right - left), abs(bottom - top)
96
return description, patterns, (left, top), (abs(right - left), abs(bottom - top))