def make_viewer(n, m, row, col, *strings): """Makes a Life and LifeViewer object. n, m: rows and columns of the Life array row, col: upper left coordinate of the cells to be added strings: list of strings of '0' and '1' """ life = Life(n, m) # n行m列的格子 life.add_cells(row, col, *strings) # 左上角坐标 viewer = LifeViewer(life) # 瞅一眼 return viewer
def main(script, *args): """Constructs the rabbits methusela. http://www.argentum.freeserve.co.uk/lex_r.htm#rabbits """ rabbits = ['1000111', '111001', '01'] n = 400 m = 600 life = Life(n, m) life.add_cells(n // 2, m // 2, *rabbits) viewer = LifeViewer(life) anim = viewer.animate(frames=100, interval=1) plt.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99) plt.show()
def main(script, *args): """Constructs the rabbits methusela. http://www.argentum.freeserve.co.uk/lex_r.htm#rabbits """ rabbits = [ '1000111', '111001', '01' ] n = 400 m = 600 life = Life(n, m) life.add_cells(n//2, m//2, *rabbits) viewer = LifeViewer(life) anim = viewer.animate(frames=100, interval=1) plt.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99) plt.show()
def main(script, *args): """Constructs a puffer train. Uses the entities in this file: http://www.radicaleye.com/lifepage/patterns/puftrain.lif """ lwss = ['0001', '00001', '10001', '01111'] bhep = ['1', '011', '001', '001', '01'] n = 400 m = 600 life = Life(n, m) col = 120 life.add_cells(n // 2 + 12, col, *lwss) life.add_cells(n // 2 + 26, col, *lwss) life.add_cells(n // 2 + 19, col, *bhep) viewer = LifeViewer(life) anim = viewer.animate(frames=100, interval=1) plt.subplots_adjust(left=0.01, right=0.99, bottom=0.01, top=0.99) plt.show()