Exemple #1
0
def main():
  from dunes import Dunes
  from sand import Sand
  from fn import Fn
  from time import time

  from modules.helpers import get_initial_rnd
  initial = get_initial_rnd(SIZE, n=4)
  bw = zeros(initial.shape,'float')

  dunes = Dunes(initial, DELTA, PROB)

  sand = Sand(SIZE)
  sand.set_rgba(FRONT)
  fn = Fn(prefix='./res/', postfix='.png')

  try:
    while True:
      t0 = time()
      itt = dunes.steps(LEAP)
      print(itt, time()-t0)
      dunes.get_normalized_sand_limit(bw, 10)
      # bw *= 0.8
      # sand.set_bg_from_bw_array(bw)
      # dunes.get_shadow(shadow)
      # rgb = dstack((bw,bw,shadow))
      # sand.set_bg_from_rgb_array(rgb)
      sand.set_bg_from_bw_array(bw)
      name = fn.name()
      sand.write_to_png(name)
  except KeyboardInterrupt:
    pass
def random_bw_array():
  size = 1000
  rnd = random((size,size))
  rnd[:,int(size/2):] = 0.0

  s = Sand(size)
  s.set_bg_from_bw_array(rnd)

  s.write_to_png('./out_random_bw_array.png')
Exemple #3
0
def random_bw_array():
    size = 1000
    rnd = random((size, size))
    rnd[:, int(size / 2):] = 0.0

    s = Sand(size)
    s.set_bg_from_bw_array(rnd)

    s.write_to_png('./out_random_bw_array.png')