Mosaic matrix: Difference between revisions
Content added Content deleted
(Added Quackery.) |
(Added Sidef) |
||
Line 843: | Line 843: | ||
<br> |
<br> |
||
[http://keptarhely.eu/view.php?file=20220218v00xf1rfh.jpeg Mosaic Matrix] |
[http://keptarhely.eu/view.php?file=20220218v00xf1rfh.jpeg Mosaic Matrix] |
||
=={{header|Sidef}}== |
|||
<lang ruby>func mosaic_matrix(n) { |
|||
n.of {|k| |
|||
var(a,b) = (k.is_even ? (1,0) : (0,1)) |
|||
n.of {|j| j.is_even ? a : b } |
|||
} |
|||
} |
|||
mosaic_matrix(5).each { .join(' ').say }; say '' |
|||
mosaic_matrix(6).each { .join(' ').say }</lang> |
|||
{{out}} |
|||
<pre> |
|||
1 0 1 0 1 |
|||
0 1 0 1 0 |
|||
1 0 1 0 1 |
|||
0 1 0 1 0 |
|||
1 0 1 0 1 |
|||
1 0 1 0 1 0 |
|||
0 1 0 1 0 1 |
|||
1 0 1 0 1 0 |
|||
0 1 0 1 0 1 |
|||
1 0 1 0 1 0 |
|||
0 1 0 1 0 1 |
|||
</pre> |
|||
=={{header|Wren}}== |
=={{header|Wren}}== |