Browse Source

frames are now determined by seconds as command line argument

master
informaniac 7 years ago
parent
commit
59cb9db3b3
  1. 6
      generators/gameOfLife.py

6
generators/gameOfLife.py

@ -4,6 +4,7 @@ from blup import frame @@ -4,6 +4,7 @@ from blup import frame
from blup import animation
import blup.writebml
import argparse
import math
r.seed()
@ -42,9 +43,12 @@ if __name__ == "__main__": @@ -42,9 +43,12 @@ if __name__ == "__main__":
argument_parser = argparse.ArgumentParser(description="Game of Life bml generator")
argument_parser.add_argument('-o', dest="output_path", type=str, help="output file (mandatory)")
argument_parser.add_argument('-w', dest="world", type=list, default=None, help="pre-constructed world (optional)")
argument_parser.add_argument('-t', dest="secs", type=int, default=90, help="time in seconds (optional)")
argument_parser.add_argument('-d', dest="delay", type=int, default=300, help="delay between frames (optional)")
args = argument_parser.parse_args()
frames = math.floor(args.secs * 1000 / 300)
dimension = frame.FrameDimension(WIDTH, HEIGHT, COLOR_DEPTH, COLORS)
game_of_life_animation = animation.Animation(dimension)
@ -66,7 +70,7 @@ if __name__ == "__main__": @@ -66,7 +70,7 @@ if __name__ == "__main__":
print("len(rows) != "+str(WIDTH)+". counted "+str(len(i)))
exit()
for frame in range(500):
for frame in range(frames):
# construct frame
new_frame = animation.AnimationFrame(dimension, args.delay)
for row_index in range(HEIGHT):

Loading…
Cancel
Save