# 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.

# 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() – Downgoat Aug 9 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. – Arnauld Aug 9 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? – Rogem Aug 11 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. ;) – Kevin Cruijssen Aug 9 at 9:52
• @KevinCruijssen Oh yeah, I forgot about Y. That would have been an easier option hahaha. – Adnan Aug 9 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. – Magic Octopus Urn Aug 9 at 15:05
• @MagicOctopusUrn Nice trick with the zip, I did not think of that. – Adnan Aug 9 at 17:00
• @adnan props on 6xŠ» too, I would've never thought of that. – Magic Octopus Urn Aug 9 at 17:19

# 6502 machine code (C64), 82 76 bytes

00 C0 A2 0B BD 3E C0 29 03 A8 A9 0D 20 2B C0 29 7F 4A 4A A8 A9 20 20 2B C0 10
05 A9 31 20 D2 FF BD 32 C0 20 D2 FF CA 10 DB 60 20 D2 FF 88 10 FA BD 3E C0 60
36 35 37 34 38 33 39 32 30 31 31 32 31 2C 1A 4C 0B 5C 03 4C 86 2C 95 AC

• -6 bytes, thanks to Arnauld for the clever idea :)

The idea here is to only store the lower digit of all the numbers in the order they are needed. Additional info required is the number of newlines to prepend, the number of spaces and whether to print a 1 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. Whether or not to print a 1 needs one single bit. Therefore, for each number to print, we can squeeze all this info in a single "control byte".

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

### Online demo

Usage: SYS49152 to start.

Commented disassembly:

         00 C0                          ; load address
.C:c000  A2 0B       LDX #$0B ; table index, start from back (11) .C:c002 .mainloop: .C:c002 BD 3E 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 2B C0 JSR .output ; repeated output subroutine .C:c00d 29 7F AND #$7F           ; mask highest bit from control byte
.C:c00f  4A          LSR A              ; and shift by two positions for ...
.C:c010  4A          LSR A              ; ... number of spaces
.C:c011  A8          TAY                ; to Y register for counting
.C:c012  A9 20       LDA #$20 ; load space character .C:c014 20 2B C0 JSR .output ; repeated output subroutine .C:c017 10 05 BPL .skip1 ; highest bit in control byte set? .C:c019 A9 31 LDA #$31           ; if yes, load '1' character ...
.C:c01b  20 D2 FF    JSR $FFD2 ; ... and output .C:c01e .skip1: .C:c01e BD 32 C0 LDA .digits,X ; load current digit .C:c021 20 D2 FF JSR$FFD2          ; output
.C:c024  CA          DEX                ; decrement table index
.C:c025  10 DB       BPL .mainloop      ; still positive -> repeat
.C:c027  60          RTS                ; and done.
.C:c028   .outputloop:
.C:c028  20 D2 FF    JSR $FFD2 ; output a character .C:c02b .output: .C:c02b 88 DEY ; decrement counting register .C:c02c 10 FA BPL .outputloop ; still positive -> branch to output .C:c02e BD 3E C0 LDA .control,X ; load control byte (needed in main) .C:c031 60 RTS ; leave subroutine .C:c032 .digits: .C:c032 36 35 37 34 .BYTE "6574" .C:c036 38 33 39 32 .BYTE "8392" .C:c03a 30 31 31 32 .BYTE "0112" .C:c03e .control: .C:c03e 31 2C 1A 4C .BYTE$31,$2C,$1A,$4C .C:c042 0B 5C 03 4C .BYTE$0B,$5C,$03,$4C .C:c046 86 2C 95 AC .BYTE$86,$2C,$95,$AC  • 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. – Arnauld Aug 9 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. – Arnauld Aug 9 at 15:25 • Thanks nice idea, will edit later. The latter however won't work, I need a case that skips the whole loop. – Felix Palmen Aug 9 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.) – Arnauld Aug 9 at 16:14
• @Arnauld Yep, that's clever :) Used this idea now, thanks! – Felix Palmen Aug 10 at 9:15

# Perl 6, 76 74 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. – Downgoat Aug 9 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])

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! # 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  # 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, 75 bytes write("[<-"(rep(" ",312),utf8ToInt('4j¸āįłģí V(')-9,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 - upvote it ! # 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! # 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 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. – Night2 Aug 10 at 4:28 # 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  Try it here! (Human readable)  - 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)  # 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. – Jonathan Frech Aug 9 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. – JayCe Aug 9 at 18:49 • You can store the points in a string and overload the ! operator to get to 125 chars. Really nice solution! – JayCe Aug 9 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. – Erik the Outgolfer Aug 9 at 21:28 # 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 at 19:17 • @ovs Ah, of course, thanks!! – Conor O'Brien Aug 9 at 19:56 • Lol, you have >< in your code – Jo King Aug 10 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 Port of Arnauld's Javascript answer -6 bytes thanks to @AdmBorkBork [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! – AdmBorkBork Aug 9 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? – AdmBorkBork Aug 10 at 12:51
• I have the error This site can’t be reached only. Sorry. – mazzy Aug 10 at 13:01
• Ah, that's a shame. It's a good resource. :-( – AdmBorkBork Aug 10 at 13:10
• I'm agree. Thanks. – mazzy Aug 10 at 13:11

# 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!

# 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/… – mbomb007 Aug 9 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) – Downgoat Aug 9 at 18:52 • @Downgoat I reduced it another 3 bytes and made it compatible with Swift 4. See updated post. – Ezekiel Elin Aug 9 at 19:43 # 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), 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 <.

• – Jonathan Frech Aug 9 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 :) – Felix Palmen Aug 9 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 :-) – ErikF Aug 9 at 15:28
• Speaking of Unicode, you can save 3 more bytes by using wide characters: Try it online! – ErikF Aug 9 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! – ErikF Aug 9 at 22:55

# 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!

# 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)].

# Bash, 225 bytes

s=(12 0 6 11 0 0 2 19 0 0 0 0 1 23 0 0 0 0 3 19 0 0 7 11 13 0)
n=(12 11 1 10 2 9 3 8 4 7 5 6) j=0;for i in {0..25};{
[ ${s[i]} = 0 ]||{ printf %${s[i]}s " ";echo -n ${n[j]} j=$((j+1));};[ $((i%2)) -gt 0 ]&&echo;}|sed 's/ //'  Annoyingly this is longer than the naive solution of just printing each line in a loop (132 characters if making use of tabstops). # 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. # 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 bytes), but much more SQL-like: SELECT CONCAT(SPACE(a),b,SPACE(c),d) FROM(VALUES(11,'1',0,'2'),(5,'11',11,'1'),(0,'',0,''),(1,'10',20,'2') ,(0,'',0,''),(0,'',0,''),(0,'9',23,'3'),(0,'',0,'') ,(0,'',0,''),(2,'8',19,'4'),(0,'',0,''),(6,'7',11,'5'), (12,'6',0,''))t(a,b,c,d)  (line breaks in this one are just for readability) # 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 at 20:52 • One more byte with {11:7}. – ovs Aug 9 at 21:11 • @ovs Ah, thanks. – mbomb007 Aug 9 at 22:51 # Perl 5, 73 bytes Port of Arnauld's answer. say"K12 E11K1 A10S2 9W3 B8S4 F7K5 L6"=~s,[A-Z]," "x(ord($&)-64),erg


Try it online!

As a one-liner:

perl -E'say"K12\nE11K1\n\nA10S2\n\n\n9W3\n\n\nB8S4\n\nF7K5\nL6"=~s,[A-Z]," "x(ord($&)-64),erg'  Another approach, but longer: map$s.=$_%26?{12,12,32,11,44,1,80,10,100,2,157,9,181,3,237,8,257,4,293,7, 305,5,325,6}->{$_}||" ":"\n",1..338;
say$s  # 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.