Mosaic matrix: Difference between revisions

Content added Content deleted
imported>Maxima enthusiast
No edit summary
(Add Factor)
Line 614: Line 614:
</pre>
</pre>


=={{header|Factor}}==
{{works with|Factor|0.99}}
<syntaxhighlight lang="factor">USING: accessors colors kernel math math.matrices ui
ui.gadgets.grid-lines ui.gadgets.grids ui.gadgets.labels
ui.pens.solid ;
IN: mosaic

: <square> ( m n -- gadget )
+ 2 mod 0 = [
" 1 " <label> COLOR: AntiqueWhite2 <solid> >>interior
[ 50 >>size ] change-font
] [ "" <label> ] if ;

: <checkerboard> ( n -- gadget )
dup [ <square> ] <matrix-by-indices> <grid>
COLOR: gray <grid-lines> >>boundary ;

MAIN: [ 8 <checkerboard> "Mosaic" open-window ]</syntaxhighlight>
{{out}}
[[File:Factor-mosaic.png|thumb|center]]


=={{header|FreeBASIC}}==
=={{header|FreeBASIC}}==