コード例 #1
0
ファイル: main.py プロジェクト: styts/pycellautomat
def main():
    if not os.path.exists("../output/images"): # output path must exist
        os.makedirs("../output/images")
    
    if make_anyway or not os.path.isfile("../output/images/rule%s.png" % rule_numbers[len(rule_numbers)-1]): # last file exists -> don't generate
        for rn in rule_numbers:
            # init first line
            line = list(numpy.zeros(a, dtype=numpy.int))
            line[a/2] = 1
            
            im = Ca().getImage(line,rn)
        
            im.save("../output/images/t_rule%s.png" % rn, "PNG")
            im = im.resize((a*pixel_factor,a*pixel_factor), Image.NEAREST)
            
            im.save("../output/images/rule%s.png" % rn, "PNG")
            
            print "Rule %s" % rn
            
            rulestudy.foo(rn,"../output/rules/",a,rule_study_number)
            
            print "Study complete"
            
    out_html(rule_numbers)
    rulestudy.html_out("../output/rules/")