Jump to content

Sierpinski carpet: Difference between revisions

m
→‎Bash/Ksh/Zsh + dc(1): Use shell parameter substitution instead of `tr` to turn ternary into binary
(→‎{{header|Commodore BASIC}}: Add implementation.)
m (→‎Bash/Ksh/Zsh + dc(1): Use shell parameter substitution instead of `tr` to turn ternary into binary)
Line 6,087:
(( size = 3 ** n ))
for (( y=0; y<size; ++y )); do
y1=$(dc <<<"$y 3op" | tr 2 0)
for (( x=0; x<size; ++x )); do
x1=$(dc <<<"$x 3op" | tr 2 0)
if (( 2#${x1//2/0} & 2#${y1//2/0} )); then
printf ' '
else
1,481

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.