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

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 '18 at 5:53
• @JoKing: Ta, I've pasted that in & made it a wiki. – Phil H Aug 31 '18 at 7:50

# Deadfish~, 290 bytes

{iii}ii{c}c{ii}dddcic{dddd}c{ii}iiccccc{ii}dddcc{dd}iii{c}c{ii}dddc{dddd}icc{ii}iic{ii}dddcdc{d}dddddd{c}ccccccccc{ii}ddc{dddd}ccc{iiiii}dddc{dd}ddddd{cc}ccc{ii}dc{dddd}dccc{ii}iicc{ii}iiiic{dd}dddd{c}ccccccccc{ii}c{dddd}ddcc{ii}iicccccc{ii}iiic{dd}ddd{c}c{ii}ic{dddd}dddc{ii}ii{c}cc{ii}iic


Try it online!

# Canvas, 49 bytes

12∙11∙1７«１╋¶10∙2‾⁶２╋¶¶9∙3‾⁹３╋¶¶8∙4‾⁵３╋¶7∙5‾¹２╋6）ｒ


Try it here!

# 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


# Python, 99, 91

print"%13d\n%7d%12d\n\n%3d%20d\n\n\n9%24d\n\n\n%3d%20d\n\n%7d%12d\n%13d"%(12,11,1,10,2,3,8,4,7,5,6)

print"""%13d
%7d%12d

%3d%20d

9%24d

%3d%20d

%7d%12d
%13d"""%(12,11,1,10,2,3,8,4,7,5,6)


Thanks to Jo King

Spaces hardcoded in -- I'm sure its possible to golf the \ns down, by repeating but I don't know how...

# Javascript, 93 bytes

console.log((

_=>F 12
A11F 1

10FE2

9FCB3

8FE4

B7F 5

)())

Port of Arnauld's answer to general JS

# 05AB1E, 47 42 bytes

•1)âÝÈÝ‰ʒ%и&ñjÓU‰÷JêĆ+•₆B'X¶:AuðAuÇ31&×‡.c


Try it online!

•...•₆B'X¶:AuðAuÇ31&×‡.c  # trimmed program
•...•                     # push 1902039976984631753317213270923121051329258518010...
B                   # in base...
₆                    # 36...
:               # with all...
'X                 # literal...
:               # s replaced by...
¶                # newline...
:               # s...
‡    # with each...
Au             # letter...
‡    # replaced by the corresponding...
Au          # letter...
Ç         # 's codepoint...
&      # bitwise and...
31       # literal...
ð            # " "...
×     # s...
.c  # with each line centered more to the left
# implicit output