Jump to content

Munching squares: Difference between revisions

added Factor
(Added AWK version)
(added Factor)
Line 389:
(plot-much) ;; ESC to see tge drawing
</lang>
 
=={{header|Factor}}==
<lang factor>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</lang>
Output image is identical to the Racket version.
{{out}}
[[File:munching-racket.png]]
 
=={{header|FreeBASIC}}==
<lang freebasic>' version 03-11-2016
1,827

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.