Monday, December 21, 2009
Merry Christmas
In celebration of the Federal Government having a snow day today, I tweeted this:
.........X.........
........XXX........
.......XX..X.......
......XX.XXXX......
.....XX..X...X.....
....XX.XXXX.XXX....
...XX..X....X..X...
..XX.XXXX..XXXXXX..
.XX..X...XXX.....X.
XX.XXXX.XX..X...XXX
say <. X>[my@i=0 xx 9,1,0 xx 9];map {say <. X>[@i=map {%([^8]>>.fmt("%03b") Z 0,1,1,1,1,0,0,0){@i[($_-1)%19,$_,($_+1)%19].join}},^19]},^9;It's my geekery for the day. It is written in Perl 6, and it prints out a Christmas tree, which is also a cellular automaton (Wolfram rule #30). Thanks to the phenomenal people at Parrot and Rakudo, it looks like this when it is run:
.........X.........
........XXX........
.......XX..X.......
......XX.XXXX......
.....XX..X...X.....
....XX.XXXX.XXX....
...XX..X....X..X...
..XX.XXXX..XXXXXX..
.XX..X...XXX.....X.
XX.XXXX.XX..X...XXX
Merry Christmas, Perl6!
Labels: christmas, perl, perl6, software
Subscribe to Posts [Atom]