Munching squares: Difference between revisions

→‎{{header|MiniScript}}: simplified for modern Mini Micro
(→‎{{header|MiniScript}}: simplified for modern Mini Micro)
Line 1,174:
 
=={{header|MiniScript}}==
This version runs in Mini Micro (for the graphics). Note that because MiniScript does not currently have any bit operations (all numbers are floating-point), we have to implement an <code>xor</code> functionand the hardbitXor wayintrinsic).
 
<syntaxhighlight lang="miniscript">xorfor =x functionin range(a0, b255)
result = 0
bit = 1
while a > 0 or b > 0
if (a%2 == 0) != (b%2 == 0) then result = result + bit
bit = bit * 2
a = floor(a/2)
b = floor(b/2)
end while
return result
end function
 
for x in range(0,255)
for y in range(0,255)
gfx.setPixel x, y, color.rgb(0, xorbitXor(x,y), 0)
end for
end for</syntaxhighlight>
222

edits