Simple complexity
JavaScript (ES6), 233 217 213 198 182 170 163 122 bytes
f=_=>[...Array(64)].map((_,x,a)=>a.map(g=(i=(n=64,x),j)=>(n>>=1)?i&n?j&n?g(j,i):` `:j&n?g(i,~j):g(~i,j):`#`).join``).join`
`
document.write(`<pre>${f()}</pre>`)
Edit: Saved 14 18 bytes thanks to @Shaggy. Saved 3 bytes thanks to @ngn. Saved a further 12 bytes thanks to the two working together. Saved 41 bytes by stealing @user202729's observations that the quarters use reflections rather than rotations. Ungolfed:
function f() {
var s = '';
for (var i = 0; i < 64; i++) {
for (var j = 0; j < 64; j++) {
var x = i, y = j, c = '#'; // Default to #
// Each non-blank quadrant maps to to the original
// image by doubling and a reflection. Repeat
// this six times unless we hit the blank quadrant.
for (var n = 0; n < 6; n++) {
if (x >= 32) {
if (y >= 32) {
// Bottom right quarter is a diagonal reflection
var t = x - 32;
x = y - 32;
y = t;
} else {
// Bottom left quarter is blank
c = ' ';
break;
}
} else {
if (y >= 32) {
// Top right corner is a horizontal reflection
y = 63 - y;
} else {
// Top left corner is a vertical reflection
x = 31 - x;
}
}
x *= 2;
y *= 2;
}
s += c;
}
s += '\n';
}
return s;
}
SOGL V0.12, 17 16 14 bytes
#6{³IIč▓┼;I+§
Try it Here!
At a later update č▓
could be removed for 12 bytes - that converts ToS from an array of arrays of characters a multiline string to an array of strings - [["#","#"],[" ","#"]] -> ["##"," #"]
- , because ┼
- horizontal append - doesn't deal well with arrays of arrays of characters - which I
creates, because it's used for array rotation too. In SOGL an array of arrays of characters should be = array of strings, but many things don't support that yet..
Explanation:
# push "#"
6{ 6 times do
³ create 3 total copies of ToS
II rotate clockwise twice
č▓ normalize as explained above
┼ append horizontally
; get the 3rd copy ontop
I rotate clockwise
+ append vertically
§ reverse horizontally
LOGO, 375 341 297 295 278 + 3 bytes
Add 3 bytes because of -p
flag, which enable perspective mode by default, thus don't need to run perspective
command, saves 9 bytes overall.
Use FMSLogo on Windows with Unix (LF) newline format (FMSLogo have problem with parsing CR newline format)
to R
rt 90
end
to g :w :l
R fd 2*:l R bk :l up 180
run :w
R run :w
fd 2*:l R bk :l run :w
fd 2*:l up 180
end
to h
pu
ask -1[setxyz 0 0 870]g[g[g[g[g[g[rt 45 fd .7 pd fd 0 pu bk .7 lt 45]1]2]4]8]16]32
repeat 64[sety 64-# repeat 64[setx #-1 type if pixel=[0 0 0]""#["\ ]](pr)]
end
Unfortunately, no "Try it online!" link because I can't find any online interpreter support perspective mode.
Idea: Draw a picture of the image, then retrieve the pixels from the picture and print as output.
Picture breakdown to simple repeated parts:
.
Make use of the hint above. However, since LOGO does not support reflection, we can only simulate that by enter 3D (perspective
) mode and turn the turtle 180 degree around an axis parallel to the computer screen.
This defines a helper function g
, which given 2 parameters l
(image side length) and w
(procedure used to draw the image), draw 3 copies of its reflected image. (see hint in the question) The procedure h
perform the main procedure.