Mosaic matrix: Difference between revisions

Content added Content deleted
(→‎J: simplify)
mNo edit summary
Line 1: Line 1:
{{Draft task}}
{{Draft task|Matrices}}
;Task:
;Task:
Draw a 'mosaic' matrix which, for the purposes of this task, is a square matrix which has 1's in alternate cells (both horizontally and vertically) starting with a 1 in the top-left hand cell.
Draw a 'mosaic' matrix which, for the purposes of this task, is a square matrix which has 1's in alternate cells (both horizontally and vertically) starting with a 1 in the top-left hand cell.
Line 17: Line 17:
=={{header|11l}}==
=={{header|11l}}==
{{trans|Python}}
{{trans|Python}}

<syntaxhighlight lang="11l">
<syntaxhighlight lang="11l">
V size = 9
V size = 9
Line 45: Line 44:
<syntaxhighlight lang="action!">
<syntaxhighlight lang="action!">
;;; draw a "mosaic matrix" - one with a 1 in the top-left and then
;;; draw a "mosaic matrix" - one with a 1 in the top-left and then
;;; alternating with another character vertically and horiontally
;;; alternating with another character vertically and horizontally


;;; draws a mosaic matrix with height and width = n
;;; draws a mosaic matrix with height and width = n
Line 230: Line 229:


=={{header|Arturo}}==
=={{header|Arturo}}==

<syntaxhighlight lang="rebol">drawSquare: function [side][
<syntaxhighlight lang="rebol">drawSquare: function [side][
loop 1..side 'x ->
loop 1..side 'x ->
Line 1,095: Line 1,093:
0 1 0 1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1 0 1 0
1 0 1 0 1 0 1 0 1 0 1</pre>
1 0 1 0 1 0 1 0 1 0 1</pre>



=={{header|PL/M}}==
=={{header|PL/M}}==
Line 1,272: Line 1,269:


=={{header|Quackery}}==
=={{header|Quackery}}==

<syntaxhighlight lang="quackery"> [ 1 & not ] is even ( n --> b )
<syntaxhighlight lang="quackery"> [ 1 & not ] is even ( n --> b )