Example #1
0
def main():
    width = 250
    height = 250
    if '-manual' in sys.argv:
        width = int(input('Enter Width: '))
        height = int(input('Enter Height: '))

    space, history = initialize(1500, width, height, False)
    data = gravitational_field(200, space)
    utility.bw_render(data, 40, False, '')
Example #2
0
def main():
    state_size = 250
    egg_size = 124
    n_particles = 300
    egg = create_egg(False, state_size, egg_size, n_particles)

    # RUN SIMULATION LOOP
    steps = 100
    film = simulation(egg, egg_size, steps)
    utility.bw_render(film, 125, False, '')
Example #3
0
def generate_random_squares(n_squares, N, fine, show):
    squares = []
    sqN = int(np.sqrt(N))
    for square in range(n_squares):
        if fine==0:
            squares.append(np.random.random_integers(0, 2, N).reshape((sqN, sqN)))
        else:
            genes = np.random.random_integers(0, 2, N) < fine
            squares.append(np.array(genes).reshape((sqN, sqN)))
    if show:
        utility.bw_render(squares, 1000, False, '')
    return squares
Example #4
0
def main():
    t0 = time.time()
    ''' 4 is highly complex  but fast '''
    f0 = [[1,1,1],[1,1,1],[1,1,1]]
    f1 = [[1, 1, 1], [1, 2, 1], [1, 1, 1]]

    if '-bleed' in sys.argv:
        history_5 = simulate(density=10000, dims=[320, 320], thresh=4, t0=t0, kernel=f0, ai=False)
        utility.bw_render(history_5, 100, False, 'decay.mp4')
        exit(0)
    if '-bacterial':
        history_5 = simulate(density=20000, dims=[350, 350], thresh=4, t0=t0, kernel=f1, ai=True)
        utility.color_render(history_5, 65, False , 'organisms.mp4')
        exit(0)
Example #5
0
    def add_particles(self, show):
        Particles = {}
        history = []
        for pt in range(self.n_particles):
            location = utility.spawn_random_point(self.state)
            self.state[location[0], location[1]] = 1
            history.append(self.state)
            Particles[pt] = Particle(location, self.state, self.fuel)
            for frame in Particles[pt].data:
                history.append(frame)
        if show:
            plt.imshow(self.state, 'gray_r')
            plt.show()

            utility.bw_render(history, 10, False, '')
def main():
    spark = [[2, 2, 2], [2, 1, 2], [2, 2, 2]]
    nFrames = 220
    gas = build_log([100, 100], False)

    if '-coal' in sys.argv:
        coal = np.zeros((200, 200))
        coal[50:150, 50:150] = 1
        small_fire = burn(coal, nFrames, spark)
        if '-save' in sys.argv:
            utility.bw_render(small_fire, 70, True, 'large_coal.mp4')
        else:
            render(small_fire, False, 70)

        coal = np.zeros((200, 200))
        coal[75:100, 75:100] = 1
        fire = burn(coal, nFrames, spark)
        if '-save' in sys.argv:
            utility.bw_render(fire, 70, True, 'small_coal.mp4')
        else:
            render(fire, False, 70)

    if '-log' in sys.argv:
        s0 = time.time()
        flames = burn(gas, nFrames, spark)
        print str(nFrames) + " Frame Simulation finished [" + str(time.time() -
                                                                  s0) + "s]"
        if '-save' in sys.argv:
            utility.bw_render(flames, 70, True, 'fractalFireLog.mp4')
        else:
            render(flames, False, 70)
Example #7
0
def main():
    life = osmosis([250, 250], 100, [3, 5])
    # life.show_states()
    test = life.internal_phase(100)
    utility.bw_render(test, 100, False, '')