June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
21
Task/Munching-squares/Factor/munching-squares.factor
Normal file
21
Task/Munching-squares/Factor/munching-squares.factor
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
USING: accessors images images.loader kernel math sequences ;
|
||||
IN: rosetta-code.munching-squares
|
||||
|
||||
: img-data ( -- seq ) 256 sq [ B{ 0 0 0 255 } ] replicate ;
|
||||
|
||||
: (munching) ( elt index -- elt' )
|
||||
256 /mod bitxor [ rest ] dip prefix ;
|
||||
|
||||
: munching ( -- seq )
|
||||
img-data [ (munching) ] map-index B{ } concat-as ;
|
||||
|
||||
: <munching-img> ( -- img )
|
||||
<image>
|
||||
{ 256 256 } >>dim
|
||||
BGRA >>component-order
|
||||
ubyte-components >>component-type
|
||||
munching >>bitmap ;
|
||||
|
||||
: main ( -- ) <munching-img> "munching.png" save-graphic-image ;
|
||||
|
||||
MAIN: main
|
||||
Loading…
Add table
Add a link
Reference in a new issue