mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Make the automata more interesting
This commit is contained in:
parent
997d6ca25c
commit
a50663fc69
3 changed files with 42 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
#
|
||||
# Need to install ImageMagick, libpng, and libpng headers to build this project.
|
||||
# To install these packages on Ubuntu: sudo apt-get install imagemagick libpng-dev
|
||||
#
|
||||
SCM_PROGRAM = life
|
||||
SCM_LIBS = example/grid example/life
|
||||
|
||||
|
|
|
@ -29,10 +29,11 @@
|
|||
(if (< iteration 10) "0" "")
|
||||
(number->string iteration)
|
||||
".png")))
|
||||
(png:fill! img 255 255 255)
|
||||
(each grid
|
||||
(lambda (i j v)
|
||||
(if v
|
||||
(png:set! img i j 0 250 0))
|
||||
(png:set! img i j 0 250 (* 3 iteration))) ; 250 0))
|
||||
))
|
||||
(png:save img path)
|
||||
(png:free img)
|
||||
|
@ -73,6 +74,14 @@
|
|||
((int)(unbox_number(g))),
|
||||
((int)(unbox_number(b))));
|
||||
return_closcall1(data, k, boolean_t); ")
|
||||
(define-c png:fill!
|
||||
"(void *data, int argc, closure _, object k, object opq, object r, object g, object b)"
|
||||
" RGBBitmap *img = (RGBBitmap *)opaque_ptr(opq);
|
||||
bitmap_fill(img,
|
||||
((int)(unbox_number(r))),
|
||||
((int)(unbox_number(g))),
|
||||
((int)(unbox_number(b))));
|
||||
return_closcall1(data, k, boolean_t); ")
|
||||
(define-c png:save
|
||||
"(void *data, int argc, closure _, object k, object opq, object path)"
|
||||
" RGBBitmap *img = (RGBBitmap *)opaque_ptr(opq);
|
||||
|
|
|
@ -31,5 +31,32 @@
|
|||
(put! grid 3 0 #t)
|
||||
(put! grid 3 1 #t)
|
||||
(put! grid 3 2 #t)
|
||||
|
||||
(put! grid 11 11 #t)
|
||||
(put! grid 12 12 #t)
|
||||
(put! grid 13 10 #t)
|
||||
(put! grid 13 11 #t)
|
||||
(put! grid 13 12 #t)
|
||||
|
||||
(put! grid 6 6 #t)
|
||||
(put! grid 7 7 #t)
|
||||
(put! grid 8 5 #t)
|
||||
(put! grid 8 6 #t)
|
||||
(put! grid 8 7 #t)
|
||||
|
||||
(put! grid 1 11 #t)
|
||||
(put! grid 2 12 #t)
|
||||
(put! grid 3 10 #t)
|
||||
(put! grid 3 11 #t)
|
||||
(put! grid 3 12 #t)
|
||||
|
||||
(put! grid 15 0 #t)
|
||||
(put! grid 15 1 #t)
|
||||
(put! grid 16 1 #t)
|
||||
(put! grid 16 2 #t)
|
||||
(put! grid 17 2 #t)
|
||||
(put! grid 17 3 #t)
|
||||
(put! grid 18 2 #t)
|
||||
(put! grid 18 3 #t)
|
||||
;; Run for x iterations.
|
||||
(life grid 80)
|
||||
(life grid 100)
|
||||
|
|
Loading…
Add table
Reference in a new issue