Munching squares: Difference between revisions
m
→{{header|Wren}}: Changed to Wren S/H
(add evaldraw (.kc) solution for Munching Squares) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 608:
>2%*28*:**-2/\1-:v<:8:-1<_@ v
^\-1*2%2/*:*82::\_$0.0..:^:*<</syntaxhighlight>
=={{header|BQN}}==
Outputs a string that represents a PPM image.
BQN uses the <code>•bit</code> namespace for native bitwise operations, including casting. An input bit width and output bit width have to be given.
<syntaxhighlight lang="bqn">nl←@+10
XORppm ← {
g←⥊(0∾∾˜)¨((↕𝕩)16‿16•bit._xor⊢)˘↕𝕩
s←•Repr 𝕩
h←"P3"∾nl∾s∾" "∾s∾nl∾(•Repr 𝕩-1)∾nl
h∾∾∾⟜nl¨{¯1↓∾∾⟜' '¨•Repr¨𝕩}¨g
}</syntaxhighlight>
Example usage:
<syntaxhighlight lang="bqn">"xor.ppm" •FChars XORppm 256</syntaxhighlight>
=={{header|Burlesque}}==
Line 902 ⟶ 916:
Since all variables in Evaldraw are doubles, convert to binary and do a custom per bit xor operation.
[[File:Evaldraw xor squares.gif|thumb|alt=xor pattern where color is the result of xor(x,y) over values x from 0 to 128 and y to 128|Coloring the xor munching squares pattern over time]]
<syntaxhighlight lang="c">enum{NUMBITS=7, MAXNUMS=3}
Line 989 ⟶ 1,005:
=={{header|EasyLang}}==
[https://easylang.dev/show/#cod=VYxLCoAwDET3PcWsFWqL4s7DaK0f0BZSEb29iRTBZDHJG2aSQwdrDCq0jZoi4QL1YfZGfgCC7j/iWTg1rEcfRpHrjd1o62xL6SKVH4hbpJo5b0Z7PD2nCiTHUZFskHeHwBJG2+8QUyutHg== Run it]
<syntaxhighlight lang="easylang">
Line 1,054 ⟶ 1,070:
{{FormulaeEntry|page=https://formulae.org/?script=examples/Munching_squares}}
'''Solution'''
[[File:Fōrmulæ - Munching squares 01.png]]
'''Test case'''
[[File:Fōrmulæ - Munching squares 02.png]]
[[File:Fōrmulæ - Munching squares 03.png]]
=={{header|GLSL}}==
Line 1,902 ⟶ 1,928:
{{trans|D}}
{{libheader|DOME}}
<syntaxhighlight lang="
import "dome" for Window
|