Example #1
0
def main(script, rule=30, n=100, *args):
    rule = int(rule)
    n = int(n)

    ca = CA(rule, n)
    # ca = CircularCA(rule, n)

    if 'random' in args:
        ca.start_random()
    else:
        ca.start_single()

    ca.loop(n-1)

    if 'eps' in args:
        drawer = CADrawer.EPSDrawer()
    elif 'pil' in args:
        drawer = CADrawer.PILDrawer()
    else:
        drawer = CADrawer.PyplotDrawer()

    if 'trim' in args:
        drawer.draw(ca, start=n/2, end=3*n/2+1)
    else:
        drawer.draw(ca)

    drawer.show()
Example #2
0
def main(script, rule=30, n=100, *args):
    rule = int(rule)
    n = int(n)

    ca = CA(rule, n)
    # ca = CircularCA(rule, n)

    if 'random' in args:
        ca.start_random()
    else:
        ca.start_single()

    ca.loop(n - 1)

    if 'eps' in args:
        drawer = CADrawer.EPSDrawer()
    elif 'pil' in args:
        drawer = CADrawer.PILDrawer()
    else:
        drawer = CADrawer.PyplotDrawer()

    if 'trim' in args:
        drawer.draw(ca, start=n / 2, end=3 * n / 2 + 1)
    else:
        drawer.draw(ca)

    drawer.show()
Example #3
0
def main(script, rule=30, n=100, *args):

    #figure1()

    rule = int(rule)
    n = int(n)

    ca = CA(rule, n)

    filename = 'rule-%d-%d' % (rule, n)

    if 'random' in args:
        filename += '-random'
        ca.start_random()
    else:
        ca.start_single()

    ca.loop(n-1)

    if 'eps' in args:
        drawer = CADrawer.EPSDrawer()
        filename += '.eps'
    elif 'pil' in args:
        drawer = CADrawer.PILDrawer()
        filename += '.png'
    else:
        drawer = CADrawer.PyplotDrawer()
        filename += '.pdf'

    if 'trim' in args:
        drawer.draw(ca, start=n/2, end=3*n/2+1)
    else:
        drawer.draw(ca)

    #drawer.show()
    print 'Writing', filename
    drawer.save(filename)
Example #4
0
def main(script, rule=30, n=100, *args):

    #figure1()

    rule = int(rule)
    n = int(n)

    ca = CA(rule, n)

    filename = 'rule-%d-%d' % (rule, n)

    if 'random' in args:
        filename += '-random'
        ca.start_random()
    else:
        ca.start_single()

    ca.loop(n - 1)

    if 'eps' in args:
        drawer = CADrawer.EPSDrawer()
        filename += '.eps'
    elif 'pil' in args:
        drawer = CADrawer.PILDrawer()
        filename += '.png'
    else:
        drawer = CADrawer.PyplotDrawer()
        filename += '.pdf'

    if 'trim' in args:
        drawer.draw(ca, start=n / 2, end=3 * n / 2 + 1)
    else:
        drawer.draw(ca)

    #drawer.show()
    print 'Writing', filename
    drawer.save(filename)