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