コード例 #1
0
ファイル: main.py プロジェクト: leweegie/game-of-life
def equil_histo(n, nsweeps):
    g = Game_Of_Life(n, 'r')
    equil_t = []

    for i in range(100):
        while True:
            for j in range(nsweeps):
                init_sites = g.active_states()
                g.sweep()

                current_sites = g.active_states()
                if init_sites == current_sites:
                    equil_t.append(i)
                    break

    plt.hist(equil_t)
    plt.show()
コード例 #2
0
def equil_histo(n, nsweeps):
    equil_t = []

    for i in range(500):
        print (i)
        g = Game_Of_Life(n, 'r')
        counter = 0
        for j in range(5000):
            init_sites = g.active_states()
            g.sweep()
            current_sites = g.active_states()
            if init_sites == current_sites:
                counter += 1
                if counter == 5:
                    equil_t.append(j-4)
                    break
            else:
                counter = 0

    np.savetxt('GOL_equilibration_t_histo.dat', np.column_stack([equil_t]))