示例#1
0
文件: vote.py 项目: msarch/py
def main(stdscr):
    try:
        player = cage.CursesPlayer(stdscr)
        automaton = VoteAutomaton(player.size)
        cage.RandomInitializer().initialize(automaton)
        player.main(automaton)
    finally:
        player.done()
示例#2
0
文件: stepping.py 项目: msarch/py
def main(stdscr):
    states = int(sys.argv[1])
    threshold = float(sys.argv[2])
    try:
        player = cage.CursesPlayer(stdscr)
        automaton = SteppingStoneAutomaton(player.size, states, threshold)
        cage.RandomInitializer().initialize(automaton)
        player.main(automaton)
    finally:
        player.done()
示例#3
0
def main(stdscr):
    global RULES
    rule = sys.argv[1]
    if rule in RULES:
        rule = RULES[rule]
    try:
        player = cage.CursesPlayer(stdscr)
        map = cage.MooreMap(player.size)
        automaton = cage.TwoStateTotalisticAutomaton(map, rule)
        cage.RandomInitializer().initialize(automaton)
        player.main(automaton)
    finally:
        player.done()
示例#4
0
文件: 110.py 项目: iammosespaulr/cage
def main():
    player = None
    try:
        player = cage.ImagePlayer(400, 600)
        automaton = cage.LinearCodedAutomaton(player.size, RULE)
        rightMostAddress = player.size[0] - 1,
        if RANDOM:
            initializer = cage.RandomInitializer()
        else:
            initializer = cage.PointInitializer(rightMostAddress)
        initializer.initialize(automaton)
        player.main(automaton)
    finally:
        if player is not None:
            player.done()
示例#5
0
文件: 1dtotal.py 项目: msarch/py
def main():
    player = None
    k = 2
    r = 2
    total = 2 * k**(2 * r + 1)
    for code in range(0, total + 1, 2):
        print "%d/%d" % (code, total)
        try:
            player = cage.LinePlayer(79)
            automaton = LinearTotalisticAutomaton(player.size, k, r, code)
            cage.RandomInitializer().initialize(automaton)
            player.main(automaton)
        finally:
            if player is not None:
                player.done()
        print