Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; unbounded linear with n cells conways game of life
- (l "core")
- (= moore-neighborhood (rem [iso _ '(0 0)] (flat1:mapn list -1 1 -1 1)))
- (def translate (cells dir)
- (set-map [map + _cell dir] cells))
- (def neighborhood (cells)
- (table-map-values len
- (union-tables:map [translate cells _] moore-neighborhood)))
- (def next-gen (cells)
- (table-map-to-values
- (fn (key count) (case count 3 t 2 cells.key))
- neighborhood.cells))
- (def conway (cells gens)
- (zap to-set cells)
- (repeat gens
- prn:ppr:keys.cells
- (zap next-gen cells)))
- (= blinker '((1 2) (2 2) (3 2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement