Keluaran
# # # # # ##### ## # ## #### ####### # # ## #### ## ## # ### ####### # # # # ##### ### # # # # ### ##### ##### # # # ####### ### # ### # ## #### ## # # ### # ####### ## # ## ##### ##### # # # ## # # # # ##### # ## ## ####### # ####### #### ## # ### ### # # # # # ##### # # # # ### ##### # #### ####### ### # ## ## ## # # ######## # # ## ##### # # # # ##### ## # # ####### # # ## ## ## # ### ####### #### # ##### ### # # # # ##### # # # # # ### ### # ## #### ####### # ####### ## ## # ##### # # # ### # # # ##### ##### ## # ## ####### # ### # # ## #### ## # ### # ### ####### # # # ##### ##### ### # # # # ### ##### # # # # ####### ### # ## ## #### ## # # ####### #### ## # ## ##### # # # # # # ## #### # # # # ### ######## ## # # ## ##### ## # ### # # ## # ### ######## ##### ### # # # # # ## #### #### ## # # # # # # # # ##### ## #### ####### # #### ## ## # ### # # # # ##### # # ### ##### ##### # ####### ### # ### # ## ## # # ### # ####### # ## ##### ##### # # ## # # # ## ## ####### #### ### # # # # # # # # ### #### ######## ## ## # # # ##
Ruang tambahan diperbolehkan. Solusi terpendek menang.
hint1:
terima kasih @ Tawg untuk mengoreksi hint1
Jawaban:
SOGL V0.12 ,
171614 byteCoba Di Sini!
Pada pembaruan selanjutnya
č▓
dapat dihapus selama 12 byte - yang mengubah ToS dari array array karakter string multiline ke array string -[["#","#"],[" ","#"]] -> ["##"," #"]
-, karena┼
- append horisontal - tidak berurusan dengan array array karakter - yangI
menciptakan, karena digunakan untuk rotasi array juga. Dalam SOGL array array karakter harus = array string, tetapi banyak hal yang belum mendukungnya ..Penjelasan:
sumber
JavaScript (ES6),
233217213198182170163122 byteSunting: Disimpan
1418 byte berkat @Shaggy. Disimpan 3 byte berkat @ngn. Menyimpan 12 byte lebih lanjut berkat keduanya bekerja bersama. Disimpan 41 byte dengan mencuri pengamatan @ user202729 bahwa perempat menggunakan refleksi daripada rotasi. Tidak Disatukan:sumber
f=
sini? Omong-omong, berhasil.f=
dalam hitungan byte, tetapi cuplikan kode tidak berfungsi tanpa itu.LOGO,
375341297295278 + 3 byteTambahkan 3 byte karena
-p
flag, yang memungkinkan mode perspektif secara default, sehingga tidak perlu menjalankanperspective
perintah, menghemat 9 byte secara keseluruhan.Gunakan FMSLogo pada Windows dengan format baris baru Unix (LF) (FMSLogo memiliki masalah dengan parsing format CR baris baru)
Sayangnya, tidak, "Coba online!" tautan karena saya tidak dapat menemukan mode perspektif dukungan juru bahasa online.
Ide: Gambar gambar, lalu ambil piksel dari gambar dan cetak sebagai output.
Perincian gambar ke bagian berulang sederhana:
.
Manfaatkan petunjuk di atas. Namun, karena LOGO tidak mendukung refleksi, kami hanya dapat mensimulasikannya dengan masuk ke
perspective
mode 3D ( ) dan memutar kura-kura 180 derajat di sekitar sumbu yang sejajar dengan layar komputer.Ini mendefinisikan fungsi pembantu
g
, yang memberikan 2 parameterl
(panjang sisi gambar) danw
(prosedur yang digunakan untuk menggambar gambar), menggambar 3 salinan dari gambar yang dipantulkan. (lihat petunjuk dalam pertanyaan) Prosedurh
melakukan prosedur utama.sumber
90 fd
->90fd
dan menyimpan beberapa byte.05AB1E ,
3026 byteCobalah online!
sumber
CJam, 30 bytes
Cobalah online!
sumber
Python 2,
205195 ... 145144142144 bytesTry it online!
Inspired by Neil's JS answer.
sumber
n>>1
isn/=2
.a
is defined and then used once. Replacing its reference with its value could save four bytes.[...[x],...[x]][z]
selection.Haskell,
126125113106103 bytesA direct implementation of hint1 in the spoiler.
Function
m
generates the next iteration. The main functions appliesm
6 times. Details tom
:Edit: @ngn saved a byte and @Laikoni another 3. Thanks!
sumber
n$n$n$n$n$n["#"]
is shorter thaniterate n["#"]!!6
:)e=[]:e;foldr(zipWith(:))e
instead ofimport Data.List;transpose
and then shortenzipWith
.Java 7,
259 238 237200 bytesSaved 2 bytes by removing the {} on the x loop, thanks ngn
Saved 19 bytes from various assignment changes, thanks Jonathan
Saved 24 bytes for print vs return (didn't know this was allowed), and
Saved 13 bytes for loop changes, thanks Nevay
Try it online!
My first challenge, and I think respectable for Java. Uses hint 1, (which is wrong btw, but I can't write comments). It can probably be golfed further, this pass was basically as is, without pretty printing.
sumber
s=1
from your for loop and replacingint s,t,x,y;
withint s=1,t,x,y;
.n[s-1-y][x]=o[y][x];n[y][t-1-x]=o[y][x];
->n[s-1-y][x]=n[y][t-1-x]=o[y][x];
.J,
3027 bytesTry it online!
Original version.
Try it online!
sumber
Python 2, 586 bytes
Try it online.
Python 2,
10321025 bytesI like this one more. But it is much longer. It could be golfed down but there is no need for that. officialaimm's approach is much shorter.
-7 thanks to Jonathan Frech
Try it online.
sumber
[t]railing spaces
, though your solution omits some spaces.x=='!'
->x<'#'
if x.isdigit()
->if"/"<x<"@"
Mathematica,
11290 bytesThanks to Jonathan Frech for help saving 2 bytes!
Try it online! (Mathics)
For some reasons, Mathics prints leading spaces in all lines except the first one when print multiline string. Also Mathics doesn't support operator
.Explanation:
{{Reverse@#,Reverse/@#},{" "+0#,#}}
: Represent the reverse-horizontally, reverse-vertically, replace-all-by-" "
, and transpose (
is transpose operator in Mathematica), corresponding to different ways to reflect or rotate the image.~Flatten~{{1,3},{2,4}}
: Flatten in particular dimensions.Nest[ ... ,{{"#"}},6]
: Apply the function inside to{{"#"}}
6 times.~Riffle~"<literal newline character>"
: Riffle a newline character between each line.""<>
: Join all strings together.sumber
Reverse
withR
and defineR=Reverse;
to save two bytes.C# (.NET Core),
10161002980955 bytesSaved 14 bytes thanks to Kevin Cruijssen!
Saved 47 bytes thanks to Jonathan Frech!
Try it online!
Explanation
The format of the output is stored inside an array of signed 64-bit numbers, which fits perfectly since each line is 64 characters long. Empty spaces are represented by
0
and#
is represented by1
.The numbers are then converted to their binary string, zeros are padded left until the string is 64 characters wide and then the
and
0
and1
characters are replaced with#
.The code is stored inside a lamba function, more specifically a
System.Func<string>
.Some constants in the
long[]
are shortened by performing some bit-shifting.sumber
long[] n=new[]
?l
is not needed, you can probably save even more bytes.Charcoal, 42 bytes
Try it online! Link is to verbose version of code. Would be 25 bytes if this worked:
Explanation:
Manually generate the first recursion, since it's not possible to rotate around (1, 0.5). (Such a rotation would only make sense if it was 180°.)
Loop over the first five powers of 2 (1, 2, 4, 8, 16).
Reflect the canvas vertically. This completes the top left quarter of the result.
Rotate the canvas 180° around a point half-way up the right-hand side. The copy ends up in the correct position for the top right quarter of the result.
Rotate the canvas 90° around the bottom right corner. The copy of the top right corner ends up in the correct position for the bottom right corner of the result. The copy of the top left corner is extraneous.
Trim the canvas to the size we want. The trim starts at the cursor or the top left of the canvas, whichever is bottom rightmost. The cursor is therefore sent to (0, -1000) to ensure that it doesn't interfere with the trim.
sumber
Dyalog APL, 29 bytes
Try it online!
sumber
((⊖,⌽)⍪∊,⍉)⍣6⍪⍕#
with⎕ML←0
.Python 2,
715711 bytesTry it online!
sumber
Perl 5, 452 bytes
451 bytes code + 1 for
-p
.Packs all the data into the string, rather than stealing @Neil's correct answer.
Reversible output from
xxd
for 451 byte file:Try it online!
sumber
Jq 1.5,
538535488476 bytesThis is a straightforward representation.
I haven't attempted any fancy encodings yet.Replaced 0,0 pairs with Z function.Thanks again to Jonathan Frech for helping eliminate 3 bytes!
Character count
Sample run
sumber
B: rec
and16) as $l|
.if.==0then" "else"#"end
->if.>0then"#"else" "end
.Python 2,
174164154 bytes (based on matrix operations)Try it online!
sumber
import *
->import*
;in s.tolist()
->in s
Canvas, 10 bytes
Try it here!
sumber
JavaScript (Node.js), 1233 bytes
Try it online!
sumber
C# (.NET Core),
976969 bytesTry it online!
sumber
<s>969</s>
to cross out the previous bytes.C# (.NET Core), 739 bytes
Try it online!
Uses the same approach is this other answer.
sumber
K (ngn/k),
323127 bytesTry it online!
6{
}/
6 times do+x
transpose|x
reverse vertically+|+x
reverse horizontally,
concatenate vertically,'
concatenate horizontally,[A;B]
is the same asA,B
. it helps avoid parentheses aroundA
and around the whole expression""x
use the elements ofx
as indices in the empty string. out-of-bounds indexing produces spaces, so this expression will return an all-spaces matrix, same size asx
sumber