# Display a clock face

Display the 12 numbers on a clock face exactly like this:

12
11           1

10                   2

9                       3

8                   4

7           5
6

To better see the grid, here's one with dots:

...........12............
.....11...........1......
.........................
.10...................2..
.........................
.........................
9.......................3
.........................
.........................
..8...................4..
.........................
......7...........5......
............6............

Note that the grid is stretched in width by a factor of two to make it look more square.

Also note that two-digit numbers are aligned with their ones digit in place. The 9 digit should be flush against the left.

Return or print the result as a multiline string (not a list of lines). Any trailing spaces are optional. The final newline also optional.

• Are the spaces on the right (after 12, 1, 2, ...) or between rows necessary ? Feb 21, 2022 at 13:15
• @CreaZyp154 The trailing spaces are optional
– xnor
Feb 24, 2022 at 17:52

# Charcoal, 40 bytes

Ｆ¹²«Ｍ⁻↔⁻¹⁴⊗÷×⁴ι³¦⁸⁻⁴↔⁻⁷÷×⁴﹪⁺³ι¹²¦³Ｐ←⮌Ｉ⊕ι

Try it online! Link is to verbose version of code. Explanation: Computes the offsets between each digit mathematically. Charcoal is 0-indexed (thus the to output $1 \ldots 12$), so the formulae for the horizontal and vertical offsets are as follows:

\begin{align} \delta x &= \left \lvert 14 - 2 \left \lfloor \frac {4i} 3 \right \rfloor \right \rvert - 8 \\ \delta y &= 4 - \left \lvert 7 - \left \lfloor \frac {4i'} 3 \right \rfloor \right \rvert \end{align}

where $i' = i + 3 \pmod {12}$.

# JavaScript (Node.js), 91 bytes

Not a very clever approach, but I've failed to find anything shorter at the moment.

_=>K12
E11K1

A10S2

9W3

B8S4

F7K5

Try it online!

• I love the use of Buffer() as alternative to charCodeAt() Aug 9, 2018 at 18:32
• @Downgoat Which makes me wonder if we should have a Tips for golfing in Node.js question, for Node specific features. Not sure it's worth it, though. Aug 9, 2018 at 22:09
• Maybe add a separate answer that contains all the Node specific features, or at least a list linking all the different answers?
– user77406
Aug 11, 2018 at 13:25

# 05AB1E, 3933 31 bytes

Thanks to Magic Octopus Urn for saving 6 bytes!

### Code

6xsG12N-N•°£•NèØú«тR∞Nè¶×]\6».c

Some 33 byte alternatives:

711ćŸā•Σ°w•₂вú‚øJƵt3в¶×‚ø»6xŠ».c¦
6xsŸ5L•Σ°w•₂вúõ¸ì‚ζJï2ÝÂ«Ć¶×)ø».c

Uses the 05AB1E encoding. Try it online!

• Nice answer! I like the use of ÿ with .V, very original! And funny how you've used 12¤ to get both 12 and 2 on the stack. I probably would have just used 12Y, but I guess how is irrelevant, since both have 12 and 2 on the stack. If I would have tried this challenge in 05AB1E I would have ended way higher in byte-count.. Guess I still have much to learn. ;) Aug 9, 2018 at 9:52
• @KevinCruijssen Oh yeah, I forgot about Y. That would have been an easier option hahaha. Aug 9, 2018 at 11:29
• I don't know if I'm fixing the 6 in under 6 bytes: 6xsŸ5L•δ;Ì’•2ôúð.ø‚ζJ012∞S¶×‚ζJ.c but you're welcome to anything of use in here. Aug 9, 2018 at 15:05
• @MagicOctopusUrn Nice trick with the zip, I did not think of that. Aug 9, 2018 at 17:00
• @adnan props on 6xŠ» too, I would've never thought of that. Aug 9, 2018 at 17:19

# 6502 machine code (C64), 8276 73 bytes

00 C0 A2 0E BD 38 C0 29 03 A8 A9 0D 20 25 C0 BD 38 C0 4A 4A A8 A9 20 20 25 C0
BD 29 C0 20 D2 FF CA 10 E1 60 20 D2 FF 88 10 FA 60 36 35 37 34 38 33 39 32 30
31 31 31 31 32 31 31 2C 1A 4C 0B 5C 03 4C 00 06 2C 00 15 00 2C
• -6 bytes, thanks to Arnauld for the clever idea :)
• another -3 bytes after Arnauld's idea not to treat leading 1 digits specially

The idea here is to only store the digits of all the numbers in the order they are needed. Additional info required is the number of newlines to prepend and the number of spaces in front.

The maximum number of newlines is 3, so we need 2 bits for this, and the maximum number of spaces is 23, therefore 5 bits are enough. Therefore, for each digit to print, we can squeeze this info in a single "control byte".

So, the data for this solution takes exactly 30 bytes: 15 single digits and 15 associated "control bytes".

### Online demo

Usage: SYS49152 to start.

Commented disassembly:

.C:c000  A2 0E       LDX #$0E ; table index, start from back (14) .C:c002 .mainloop: .C:c002 BD 38 C0 LDA .control,X ; load control byte .C:c005 29 03 AND #$03           ; lowest 3 bits are number of newlines
.C:c007  A8          TAY                ; to Y register for counting
.C:c008  A9 0D       LDA #$0D ; load newline character .C:c00a 20 25 C0 JSR .output ; repeated output subroutine .C:c00d BD 38 C0 LDA .control,X ; load control byte .C:c010 4A LSR A ; and shift by two positions for ... .C:c011 4A LSR A ; ... number of spaces .C:c012 A8 TAY ; to Y register for counting .C:c013 A9 20 LDA #$20           ; load space character
.C:c015  20 25 C0    JSR .output        ; repeated output subroutine
.C:c018  BD 29 C0    LDA .digits,X      ; load current digit
.C:c01b  20 D2 FF    JSR $FFD2 ; output .C:c01e CA DEX ; decrement table index .C:c01f 10 E1 BPL .mainloop ; still positive -> repeat .C:c021 60 RTS ; and done. .C:c022 .outputloop: .C:c022 20 D2 FF JSR$FFD2          ; output a character
.C:c025   .output:
.C:c025  88          DEY                ; decrement counting register
.C:c026  10 FA       BPL .outputloop    ; still positive -> branch to output
.C:c028  60          RTS                ; leave subroutine
.C:c029   .digits:
.C:c029  36 35 37 34 .BYTE "6574"
.C:c02d  38 33 39 32 .BYTE "8392"
.C:c031  30 31 31 31 .BYTE "0111"
.C:c035  31 32 31    .BYTE "121"
.C:c038   .control:
.C:c038  31 2C 1A 4C .BYTE $31,$2C,$1A,$4C
.C:c03c  0B 5C 03 4C .BYTE $0B,$5C,$03,$4C
.C:c040  00 06 2C 00 .BYTE $00,$06,$2C,$00
.C:c044  15 00 2C    .BYTE $15,$00,$2C • Could you save 2 bytes by using a subroutine doing JSR$FFD2 / DEY / BNE loop / LDA .control,X / RTS called for both newlines and spaces? I think it would be +10 bytes long and save -12 bytes in the main code. Aug 9, 2018 at 15:06
• Actually, I think you can save more bytes if the subroutine is doing JSR $FFD2 / DEY / BPL loop / LDA .control,X / RTS and the entry point is the DEY. This way, you don't have to test 0 in the main code. Aug 9, 2018 at 15:25 • Thanks nice idea, will edit later. The latter however won't work, I need a case that skips the whole loop. Aug 9, 2018 at 16:12 • If Y=0, DEY / BPL / RTS will exit immediately without processing any JSR$FFD2. (Note that with that scheme, the entry point of the subroutine must be DEY.) Aug 9, 2018 at 16:14
• @Arnauld after quite some experimentation, I think it's shortest to keep the subroutine while using your suggestion of storing all digits :) Aug 17, 2018 at 11:17

# Perl 6, 76 74 70 bytes

"K12
E11K1

A10S2

9W3

B8S4

F7K5
L6"~~say S:g{<:Lu>}=" "x$/.ord-64 Try it online! Port of Arnauld's answer until I can come up with something shorter. # HTML + JavaScript (Canvas), 13 + 161 = 174 bytes Arbitrary canvas positioning uses 6 bytes. with(C.getContext2d)with(Math)for(font='9px monospace',textAlign='end',f=x=>round(sin(x*PI/6)*6)*measureText(0).width*2,x=13;--x;)fillText(x,f(x)+80,f(9-x)+80) <canvas id=C> With grid for comparison: with(C.getContext2d)with(Math){ for(font='9px monospace',textAlign='end',f=x=>round(sin(x*PI/6)*6)*measureText(0).width*2,x=13;--x;)fillText(x,f(x)+80,f(9-x)+80) for(globalAlpha=0.2,y=-6;y<=6;y++)fillText('.'.repeat(25),6*measureText('.').width*2+80,y*measureText(0).width*2+80) } <canvas id=C> ## Explanation of Positioning Formula See my JavaScript with SVG answer. • I don't think this counts because since this is ASCII-art we are supposed to generate the exact byte-stream specifies in the challenge while this renders an image that looks like output. Aug 9, 2018 at 18:31 # Java 8 11, 141 138 bytes v->{for(var x:"92BCN5BB92BNN1BA991CNNNJ995DNNN2I991ENN6H92FN93G".getBytes())System.out.print(x<59?" ".repeat(x-48):(char)(x>76?10:x-17));} Try it online (NOTE: String.repeat(int) is emulated as repeat(String,int) for the same byte-count, because Java 11 isn't on TIO yet.) Explanation is similar as below, but it uses " ".repeat(x-48) for the spaces instead of format with "%"+(x-48)+"s". # Java 8, 141 bytes v->{for(var x:"92BCN5BB92BNN1BA991CNNNJ995DNNN2I991ENN6H92FN93G".getBytes())System.out.printf("%"+(x>58?"c":x-48+"s"),x>76?10:x>58?x-17:"");} Try it online. Explanation: v->{ // Method with empty unused parameter and no return-type for(var x:"92BCN5BB92BNN1BA991CNNNJ995DNNN2I991ENN6H92FN93G".getBytes()) // Loop over the bytes of the above String: System.out.printf("%"+ // Print with format: (x>58? // If the character is a letter / not a digit: "c" // Use "%c" as format : // Else: x-48+"s"), // Use "%#s" as format, where '#' is the value of the digit x>76? // If the byte is 'N': 10 // Use 10 as value (newline) :x>58? // Else-if the byte is not a digit: x-17 // Use 48-58 as value (the 0-9 numbers of the clock) : // Else: "");} // Use nothing, because the "%#s" already takes care of the spaces Further explanation 92BCN5BB92BNN1BA991CNNNJ995DNNN2I991ENN6H92FN93G: • All the digits will be replaced with that amount of spaces. (For 11 spaces it's therefore 92.) • All 'N' are new-lines • All ['A','J'] are clock digits ([0,9]) # R, 75 68 bytes write("[<-"(rep("",312),utf8ToInt('*®÷ĥĹĚä—M '),1:12),1,25) Try it online! Compressed the digits positions. Did this after spending lots of time trying to come up with a trigonometric answer (see history of edits). Inspired by this other R answer buy J.Doe - upvote it ! Saved 7 bytes thanks to J.Doe. • 68 bytes - changed hash to avoid arithmetic and altered the write call to use the default separator. Sep 3, 2018 at 8:51 • @J.Doe It makes more sense this way. Of course not having documented my golf I have no clue why I did a convoluted hash in the first place... Sep 3, 2018 at 15:11 # Python 2, 97 bytes for i in range(7):w=abs(3-i);print'%*d'%(1-~w*w,12-i),'%*d'%(24-3**w-2*w,i)*(w<3),'\n'*min(i,5-i) Try it online! Computes all spacings and newlines in the loop # R, 168159 125 bytes The naive solution of writing the numbers at the prescribed points in a text matrix. Points are stored as UTF-8 letters decoded via utf8ToInt "!"=utf8ToInt write("[<-"(matrix(" ",25,13),cbind(!"LMFGSBCWAYCWGSM",!"AABBBDDDGGJJLLM")-64,-64+!"ABAAAA@BICHDGEF"),1,25,,"") Dropped 9 bytes with JayCe's suggestion to use write and avoid defining the matrix. Dropped another 34 bytes with JayCe's storage suggestion. • Hello and welcome to PPCG! I think the dots are supposed to help visualize the pattern, but not part of the output. Aug 9, 2018 at 18:42 • Welcome to PPCG! you can asve some bytes not defining m and using write: TIO. PS: you are not obliged to include a TIO link in your answer but it formats the answer nicely for you, see link icon on top of TIO page. Aug 9, 2018 at 18:49 • You can store the points in a string and overload the ! operator to get to 125 chars. Really nice solution! Aug 9, 2018 at 19:07 # Jelly, 32 bytes ⁶ẋ“¿×¿ Œ4ç4Œ!¿Ø‘ż“øn0œ’Œ?D¤Fs25Y A full program which prints the result. Try it online! ### How? (I have not yet thought of/found anything shorter than “¿×¿ Œ4ç4Œ!¿Ø‘ which seems long to me for this part - bouncing / base-decompression / increments, nothing seems to save!) ⁶ẋ“¿×¿ Œ4ç4Œ!¿Ø‘ż“øn0œ’Œ?D¤Fs25Y - Main Link: no arguments ⁶ - space character “¿×¿ Œ4ç4Œ!¿Ø‘ - code-page indices list = [11,17,11,32,19,52,23,52,19,33,11,18] ẋ - repeat (vectorises) -> [' '*11, ' '*17, ...] ¤ - nilad followed by link(s) as a nilad: “øn0œ’ - base 250 number = 475699781 Œ? - first natural number permutation which would be at - index 475699781 if all permutations of those same - natural numbers were sorted lexicographically - = [12,11,1,10,2,9,3,8,4,7,5,6] D - to decimal lists = [[1,2],[1,1],[1],[1,0],[2],[9],[3],[8],[4],[7],[5],[6]] ż - zip together = [[' '*11, [1,2]], [' '*17, [1,1]], ...] F - flatten = [' ',' ',...,1,2,' ',' ',...,1,1,...] s25 - split into chunks of 25 (trailing chunk is shorter) Y - join with new line characters - implicit print • LOL I'm actually surprised this is the naive approach. Aug 9, 2018 at 21:28 ## Haskell, 88 87 bytes f=<<"k12{e11k1{{a10s2{{{9w3{{{b8s4{{f7k5{l6" f c|c>'z'="\n"|c>'9'=' '<$['a'..c]|1<2=[c]

The encode-spaces-as-letters method (first seen in @Arnauld's answer) in Haskell. Using { and expanding it to \n is one byte shorter than using \n directly.

Try it online!

# Rust, 96 bytes

||format!(r"{:13}
11{:12}

10{:20}

9{:24}

8{:20}

{:7}{:12}
{:13}",12,1,2,3,4,7,5,6)

Try it online!

# brainfuck, 240 235 bytes

++++++++++[>++>+>+++>+++++>++>++[<]>-]>>>++...........>-.+.<<.>.....>-..<...........>.<<..>.>.-.>-[<<.>>-]<++.<<...>>+++++++.>>+++[<<<.>>>-]<<------.<<...>..>+++++.<<<-[>>.<<-]>>>----.<<..>......>+++.<...........>--.<<.>............>+.

Try it online!

Commented code

++++++++++                              Put 10 in cell 0
[>++>+>+++>+++++>++>++[<]>-]            Loop 10 times incrementing to leave 0 20 10 30 50 20 20 in memory
>>>++                                   30 plus 2 = 32 (ascii space)
...........>-.+.                        print 11spaces followed by 12 (ascii 49 50)
<<.>.....>-..<...........>.             print 1newline 5spaces 11 11spaces 1
<<..>.>.-.>-[<<.>>-]<++.                print 2newlines 1space 10 19spaces 2
<<...>>+++++++.>>+++[<<<.>>>-]<<------. print 3newlines         9 23spaces 3
<<...>..>+++++.<<<-[>>.<<-]>>>----.     print 3newlines 2spaces 8 19spaces 4
<<..>......>+++.<...........>--.        print 2newlines 6spaces 7 11spaces 5
<<.>............>+.                     print 1newline  12spaces 6

A rare example where the text is repetitive enough that the brainfuck program is less than twice 1.6 times the length of the output!

2 bytes saved by suggestion from Jo King: >>>>>>- -> [<]>-

3 bytes saved by moving the third 20-place downcounter from far right of the ascii codes 10 30 50 to immediately to the left of them. Saves <<>> when filling the gap between 8 and 4 but adds 1 byte to the line >>>++ .

Original version

++++++++++                              Put 10 in cell 0
[>+>+++>+++++>++>++>++<<<<<<-]          Loop 10 times incrementing to leave 0 10 30 50 20 20 20 in memory
>>++                                    30 plus 2 = 32 (ascii space)
...........>-.+.                        print 11spaces followed by 12 (ascii 49 50)
<<.>.....>-..<...........>.             print 1newline 5spaces 11 11spaces 1
<<..>.>.-.>-[<<.>>-]<++.                print 2newlines 1space 10 19spaces 2
<<...>>+++++++.>>+++[<<<.>>>-]<<------. print 3newlines         9 23spaces 3
<<...>..>+++++.>>>-[<<<<.>>>>-]<<<----. print 3newlines 2spaces 8 19spaces 4
<<..>......>+++.<...........>--.        print 2newlines 6spaces 7 11spaces 5
<<.>............>+.                     print 1newline  12spaces 6

# PHP, 97 bytes

<?=gzinflate(base64_decode(U1CAA0MjLghtqIAkyMWlYGiggAmMuLi4LBWwA2OgnIKCBRYZEy6IHQrmSIKmXMhKzAA));

Try it online!

This is a hard coded compressed string. I couldn't find a solution shorter than this!

• Can you put the binary compressed string in the source file and skip the base64_decode? I tried this and I get a 'gzinflate(): data error', but it might be possible if the source file was written witha hex editor instead of a text editor.
– bdsl
Aug 9, 2018 at 19:35
• @bdsl actually I did that before and you don't need a HEX editor, you can just use PHP itself file_put_contents($path, '<?=gzinflate("'.gzdeflate($clockString,9).'");');, but I'm not sure how to post a code with binary data inside it. A file like that is 70 bytes. Aug 10, 2018 at 4:28

# C (gcc), 125109 105 bytes

x,*d=L"<;1:2938475640PP05";main(i){for(;i=d[12];printf("%*d",i/4,*d++-48))for(x=i&3;x--;)puts("");}
• -16 bytes (-3 for better loop arrangement, -13 for directly including the non-printable chars) thanks to Jonathan Frech.
• -4 bytes by replacing a division for a shift and abusing the fact that on many systems (like the one hosting TIO), sizeof(wchar_t) == sizeof(int) -- won't work on windows :) Thanks ErikF for the idea.

Try it online!

This is a port of my general idea from the 6502 solution to C. It's a bit modified: Instead of having a flag for a leading 1, the character is printed as a decimal by subtracting 48, so 10 - 12 are encoded as : to <.

• Aug 9, 2018 at 14:14
• @JonathanFrech nice loop rearrangement, I wonder how I missed that one :o But really didn't expect gcc to accept non-printable characters in the source :) Aug 9, 2018 at 14:24
• As long as the character can be represented in UTF-8, it's technically acceptable by the compiler. Whether that's a good thing rather depends on what you're doing :-) Aug 9, 2018 at 15:28
• Speaking of Unicode, you can save 3 more bytes by using wide characters: Try it online! Aug 9, 2018 at 15:37
• That's why I like code golfing: I get to abuse UB and use all those "things you shouldn't do" that you pick up over time! Aug 9, 2018 at 22:55

# C (gcc), 145137 125 bytes

Only the tab positions are hard-coded: all the line spacings and clock values are generated in the loop.

Thanks again to ceilingcat for the suggestions.

i,j,k;f(char*t){for(i=7;i--;t=memset(t+sprintf(t,"%*d%*d"+3*!j,"NHDA"[j]-65,6+i,"AMUY"[j]-65,6-i),10,k=j+i/4)+k)j=i>3?6-i:i;}

Try it online!

• Suggest "\r\7\3"[j] instead of "NHDA"[j]-65 Oct 22, 2019 at 22:01

# Pyke, 37 bytes

3B 32 35 75 07 0d 13 0c 22 14 35 18 44 74 5F 74 2B 46 6F 68 32 C4 52 7D 74 2A 31 32 25 31 32 7C 60 52 2D 29 73

Try it here! (raw bytes)

;25Dt_t+Foh2.DR}t*12%12|R-)s

- o = 0
;25                           - set line width to 25 characters
-      [13, 19, 12, 34, 20, 53, 24]
-       (In hex version, encoded in base 256, regular version in input field)
t_t                       -     reversed(^[1:])[1:]
D   +                      -    ^^ + ^
Foh2.DR}t*12%12|R-)  -   for i in ^:
o                    -            o++
h                   -           ^+1
2.DR               -          divmod(^, 2)
}t             -         (remainder*2)-1
*            -        quotient * ^
12%         -       ^ % 12
12|      -      ^ or 12 (12 if 0 else ^)
     -     str(^)
R-   -    ^.rpad(i) (prepend spaces such that length i)
s -  sum(^)
- output ^ (with newlines added)

# brainfuck, 315 313 bytes

saved 2 bytes thanks to ovs!

++++[>++++<-]>[>+++>+++>+++>+++>>++>+++>+++>+++<<<<<<<<<-]>+++++>++++>+++>++>++++++++++>>+++++++>+><<<...........>>.<<<<.>.>.....>>..<<...........>>.<<<..>.>>.>.<<<...................<<.>...>>++.<.......................<<<.>>...>..>-.<...................<<<<.>>>..>......>-.<...........<<<<<.>>>>.>............>-.

Try it online!

all in one code block:

++++[>++++<-]>[>+++>+++>+++>+++>>++>+++>+++>+
++<<<<<<<<<-]>+++++>++++>+++>++>++++++++++>>+
++++++>+><<<...........>>.<<<<.>.>.....>>..<<
...........>>.<<<..>.>>.>.<<<................
...<<.>...>>++.<.......................<<<.>>
...>..>-.<...................<<<<.>>>..>.....
.>-.<...........<<<<<.>>>>.>............>-.
• You can use ++++[>++++<-]> for the 16 at the beginning.
– ovs
Aug 9, 2018 at 19:17
• @ovs Ah, of course, thanks!! Aug 9, 2018 at 19:56
• Lol, you have >< in your code
– Jo King
Aug 10, 2018 at 9:19

# Powershell, 9488 82 bytes

Direct Powershell format operator. {i,w} means a placeholder for a parameter with index i, width of the placeholder is w with right align.

"{11,13}
{10,7}{0,12}

10{1,20}

9{2,24}

8{3,20}

{6,7}{4,12}
{5,13}"-f1..12

# Powershell, 88 bytes

[RegEx]::Replace("K12
E11K1

A10S2

9W3

B8S4

F7K5
L6",'[A-Z]',{' '*("$args"[0]-64)}) To better see the grid, use '.' instead ' '. • Why not string multiplication instead of .PadLeft for 88 bytes -- Try it online! Aug 9, 2018 at 13:01 • That's a clever use of -f. Why don't you include links to Try it online! so others can see how your code works? Aug 10, 2018 at 12:51 • I have the error This site can’t be reached only. Sorry. Aug 10, 2018 at 13:01 • Ah, that's a shame. It's a good resource. :-( Aug 10, 2018 at 13:10 # JavaScript with SVG, 188 bytes Arbitrary line height of 120% uses 4 bytes. with(Math)for(s='<pre><svg viewBox=-8-8+16+16 style=font-size:1;text-anchor:end>',f=x=>round(sin(x*PI/6)*6),x=13;--x;)s+=<text x=${f(x)*2}ch y=${f(9-x)*1.2}>${x}</text>
document.write(s)

With grid for comparison:

with(Math)for(s='<pre><svg viewBox=-8-8+16+16 style=font-size:1;text-anchor:end>',f=x=>round(sin(x*PI/6)*6),x=13;--x;)s+=<text x=${f(x)*2}ch y=${f(9-x)*1.2}>${x}</text> for(y=-6;y<=6;y++)s+=<text x=12ch y=${y*1.2} style=fill:#0002>${'.'.repeat(25)}</text> document.write(s) ## Explanation of Positioning Formula Let f(x) = round(sin(x * π/6) * 6). Assuming the origin is the center of the clock, the grid coordinates of the right-most digit of any given clock number x is [f(x) * 2, f(9 - x)]. # Attache, 69 bytes {ReplaceF["l12 f11l1 b10t2 9x3 c8t4 g7l5 m6",/"\\l",sp&*@STN]} Try it online! This encodes each run of spaces as: NTS[count of spaces]; NTS is the "numeric to short" builtin, which allows numbers to be expressed as strings. E.g., NTS[95] =$R1 and NTS[170297] = $XQO. STN is the inverse of this builtin. This answer replaces (ReplaceF) all occurences of letters (/\l/) in the input with the result of the function sp&*@STN, which firsts decodes the letter and then repeats sp (a space) that many times. # Swift, 178 165 bytes var b="";for c in"L12nF11L1nnB10T2nnn9X3nnnC8T4nnG7L5nM6"{let i=c.unicodeScalars.first!.value;if c=="n"{b+="\n"}else if i>64{for _ in 0..<(i-65){b+=" "}}else{b+="(c)"}};print(b) Based on what Downgoat posted, I've reduced this to 165 bytes: print("L12nF11L1nnB10T2nnn9X3nnnC8T4nnG7L5nM6".unicodeScalars.map{let x=Int($0.value);return x==110 ?"\n":(x>64 ?String(repeating:" ",count:x-65):"($0)")}.joined()) Expanded out, with$0 converted to a named variable:

print("L12nF11L1nnB10T2nnn9X3nnnC8T4nnG7L5nM6".unicodeScalars.map { c in let x = Int(c.value) return x == 110 ? "\n" : (x>64 ? String(repeating:" ", count: x-65) : "(c)") }.joined())

The input string is encoded as follows: Uppercase letters (A-Z) represent blocks of spaces, offset by 65. So A means 0 spaces, B means 1 space, the first L means 11 spaces, etc. ns are converted to newlines. All other characters are printed as-is.

Run it online here (thanks, mbomb007)

• Welcome to PPCG! Many of us use Try It Online (TIO) for online interpreters to include a hyperlink to the program in our answers. Here is the one for your answer: tio.run/##JY1BC4IwGIb/yvpOSjScqRW2DgV1sVMeOgQx14SBfMacdhB/… Aug 9, 2018 at 17:40
• Here's a golf of your answer that's 172 bytes. It uses a function instead: {"L12NF11L1NNB10T2NNN9X3NNNC8T4NNG7L5NM6".unicodeScalars.map({(c)->String in let x=c.value;return x==78 ? "\n" : x>64 ?String(repeating:" ",count:x-65) : "\(c)"}).joined()} (swift 3 (-swift-version 3 on repl) because swift 4 dropped subtraction it looks like) Aug 9, 2018 at 18:52
• @Downgoat I reduced it another 3 bytes and made it compatible with Swift 4. See updated post. Aug 9, 2018 at 19:43

# vim, 103 bytes

25a <ESC>r30r9O0i <C-v><ESC>15l2xA <C-v><ESC><ESC>0"aDddqbYp<C-x>e<C-a>q2@a@b4@a@b6@aggqbYP<C-a>e<C-x>q@axr 2hr2@b4@a@b6@ayyjpr lr yyj2p2j2p2jp

<ESC> is 0x1b, <C-a> is 0x01, <C-x> is 0x18, and <C-v> is 0x16.

This includes all trailing spaces because I didn't notice they were optional until I'd finished for the additional challenge.

## Annotated

25a <ESC>r30r9                            # create the 9...3 line
o0i <C-v><ESC>15l2xA <C-v><ESC><ESC>"a0D  # create macro a that moves 2 spaces from the middle to the ends
# 15 is a magic number that lets the same macro work for the 6 and 12 lines
dd                                        # delete empty line
qb                                        # record macro b to...
Yp                                      #    duplicate line (down)
q
2@a                                       # adjust spacing for line 8..4
@b4@a                                     # create line 7..5
@b6@a                                     # create line 6
gg                                        # move cursor to first line
qb                                        # record macro b to...
YP                                      #    duplicate line (up)
q
@axr 2hr2                                 # adjust spacing for 2-digit numbers
@b4@a                                     # 11..1
@b6@a                                     # 12
yyjpr lr yy                               # add a line of all spaces below 12, and copy to default register
j2p2j2p2jp                                # add the rest of the blank lines

Try it online!

# Red, 151 bytes

foreach[a b c d][13 12 1""7 11 12 1 1""1""3 10 20 2 1""1"^/"0 9 24 3 1""1"^/"3 8 20 4 1""1""7 7 12 5 13 6 1""][print rejoin[pad/left b a pad/left d c]]

Try it online!

# Python 3, 11288 87 bytes

A solution using string interpolation.

print(f'''{12:13}
{11:7}{1:12}

10{2:20}

9{3:24}

8{4:20}

{7:7}{5:12}
{6:13}''')

Try it online!

-25 bytes thanks to ovs and Herman L.

• And if you use Hermans formatting string you can get this to ~85 bytes.
– ovs
Aug 9, 2018 at 20:52
• One more byte with {11:7}.
– ovs
Aug 9, 2018 at 21:11

# Pure Bash, 123

printf does the heavy-lifting here:

n=" 0 a 0 a"
printf -vo %*s%*s\\n 0 a 13 12 7 11 12 1 $n 3 10 20 2$n$n 1 9 24 3$n$n 3 8 20 4$n 7 7 12 5 13 6
echo "${o//a}" Try it online! # C (gcc), 135123 110 bytes This uses a simple encoding where any c between 'a' and 'z' represents c-'a'+1 repeated spaces, '' represents a newline, and all other characters are left unchanged. f(i){char*s="k12e11k1a10s29w3b8s4f7k5l6`";for(;i=*s;s++)i>96?printf("%*s",i-96,""):putchar(i%86);} Try it online! • Suggest *s=L"...";f(i){ instead of f(i){char*s="..."; Aug 30, 2018 at 19:27 # T-SQL, 132 bytes PRINT SPACE(11)+'12 11 1 10'+SPACE(20)+'2 9'+SPACE(23)+'3 8'+SPACE(19)+'4 7 5 6' Only 12 bytes shorter than the trivial solution (PRINT of the entire string as-is). Found a variation I like that is much longer (235 226 bytes), but much more SQL-like: SELECT CONCAT(SPACE(PARSENAME(value,4)),PARSENAME(value,3), SPACE(PARSENAME(value,2)),PARSENAME(value,1)) FROM STRING_SPLIT('11.1..2,5.11.11.1,. .. ,1.10.20.2,. .. ,. .. ,.9.23.3, . .. ,. .. ,2.8.19.4,. .. ,6.7.11.5,12.6.. ',',') STRING_SPLIT breaks it into rows at the commas, and PARSENAME splits each row at the dots. The 1st and 3rd are used for how many spaces to print, the 2nd and 4th are used for what to display. (line breaks in this one are just for readability) # Perl 6, 116 bytes my@a=[" "xx 13]xx 13;($_=pi/6*++$;@a[0+|6*(1.1-.cos);0+|6*(1.1+.sin)]=fmt ++$: "%2s")xx 12;@a>>.join>>.&{say S/.//}

Try it online!

(Ta @JoKing for saving 26 bytes)

# Perl 6, 142 bytes

my@a=[[[32,32]xx 13]xx 13];for 1..12 {$_=$^b*pi/6;@a[round 6*(1-.cos);round 6*(1+.sin)]=[" \$b".ords.tail(2)]}
{say S/^.//}(.[*;*].chrs) for @a

Try it online!

I wanted to do something... different. So this one calculates the positions of all the digits, via pairs of characters, strips off the initial space and prints the lines.

Easily modifiable for different parameters, e.g. a 45 character wide version with 17 digits.

• 116 bytes
– Jo King
Aug 31, 2018 at 5:53
• @JoKing: Ta, I've pasted that in & made it a wiki. Aug 31, 2018 at 7:50