Munching squares: Difference between revisions

m
→‎{{header|REXX}}: added/changed whitespace and comments.
m (→‎{{header|REXX}}: added/changed whitespace and comments.)
Line 1,208:
<lang rexx>/*REXX program renders a graphical pattern by coloring each pixel with x XOR y */
/*───────────────────────────────────────── from an arbitrary constructed color table. */
rows=25 2 /*the number of rows in the color table*/
cols=50 5 /* " " " cols " " " " */
do row x=0 for cols rows*3 /*createconstruct a graphicalcolor table, patternsize with XORs25x50.*/
do ycol=0 for rowscols*3
x2b( d2x( $+2,= 2(row+col) )// 255
@.row.col= x2b( d2x($+0, 2) ) ||, /*ensure $ is converted──►2 hex nibbles*/
x2b( d2x($+1, 2) ) ||,
x2b( d2x($+2, 2) )
end /*col*/ /* [↑] construct a three-byte pixel. */
end /*row*/
 
do row x=0 for rows*3cols /*constructcreate a color table,graphical sizepattern with 25x50XORs.*/
do coly=0 for cols*3rows
@.x.y= bitxor(@.x, @.y) /*renders $=3 bytes (row+cola pixel) //at 255a time. */
end /*y*/
@.row.col= x2b( d2x($+0, 2) ) ||, /*ensure $ is converted──►2 hex nibbles*/
end /*x*/ x2b( d2x($+1, 2) ) || /*stick a fork in it, we're all done. */</lang>
x2b( d2x($+2, 2) )
end /*col*/ /* [↑] construct a three-byte pixel. */
end /*row*/
 
do x=0 for cols /*create a graphical pattern with XORs.*/
do y=0 for rows
@.x.y=bitxor(@.x, @.y) /*renders 3 bytes (a pixel) at a time. */
end /*y*/
end /*x*/
/*stick a fork in it, we're all done. */</lang>
Must be converted to an image with a separate program. <br><br>