Inspired by Braille graphics and Build an analog clock.

  • The goal there is to create a tool that use terminal console to draw and animate a clock by using UTF-8 fonts \U2800: to \U28FF: .

    00:[⠀] 01:[⠁] 02:[⠂] 03:[⠃] 04:[⠄] 05:[⠅] 06:[⠆] 07:[⠇] 08:[⠈] 09:[⠉] 0A:[⠊]
    0B:[⠋] 0C:[⠌] 0D:[⠍] 0E:[⠎] 0F:[⠏] 10:[⠐] 11:[⠑] 12:[⠒] 13:[⠓] 14:[⠔] 15:[⠕] 
    EA:[⣪] EB:[⣫] EC:[⣬] ED:[⣭] EE:[⣮] EF:[⣯] F0:[⣰] F1:[⣱] F2:[⣲] F3:[⣳] F4:[⣴]
    F5:[⣵] F6:[⣶] F7:[⣷] F8:[⣸] F9:[⣹] FA:[⣺] FB:[⣻] FC:[⣼] FD:[⣽] FE:[⣾] FF:[⣿] 
  • The program takes HEIGHT and WIDTH -- the height and width of the displayed clock in terminal characters -- as input.

  • From pixelWidth = WIDTH x 2 and pixelHeight = HEIGHT x 4 you have to build something like a map, drawn your clock as described then extract 2 pixel width and 4 pixel height characters to choose one of 256 character in \U2800 to \U28FF.

  • They must be upgraded every second!! Care of code efficiency! (not 1 second delay plus drawing time) +25 byte penalty if your clock drop any second!

  • The full circle of the clock is 1 point width, at 100% of ray, meaning ray could vary between horizontal (ray=pixelWidth/2) and vertical (ray=pixelHeight/2)!

  • 12 hour ticks from 90% to 100% of ray.

  • 60 minute ticks as single dot located at 90%, but displayed only if width > 20 (terminal width greather than 20 characters).

  • Hours arm length is 45% of ray.

  • Minutes arm length is 77% of ray.

  • Seconds arm is 88% or ray.

  • Seconds arm is 1 point width.

  • Hours and minutes arms have to be larger, for this, you will draw each of them 3 time: 1x centered, 1x shifted left by 1 dot and 1x shifted up by 1 dot.

  • Hours, minutes and seconds arms have to progress each second like a regular analog clock.

  • Of course, there could be some variants, mostly depending on how you drawn the circle. But as other graphic parts are lines, except some rare rounding bug, with a give size, at some precise time, all clock program could show same design... with some 1px difference somewhere... Some sample you could copy-paste:

    A 18x8 clock at 10h10'42" like (without minutes ticks):


    A '39x15@3h42'02"`:


    Or a 48x24 @ 9h16'23":


There is an accelerated sample of what they could look like, in a 80x24 terminal window, shot between 09h17'00" and 09h18'00"


Another sample in a small 20x10 window shot between 09h59 and 10h00:


This is code golf, so the shortest answer (in bytes) wins.

  • 2
    \$\begingroup\$ I think you need to clarify exactly what is required for this to challenge to work as code golf. Remember that the goal for solvers is to save as many bytes as possible while meeting the specification however minimally or literally, with no value on how nice the output is, so solvers need to know just how much or little is required in their ASCII art output. \$\endgroup\$
    – xnor
    May 12, 2020 at 8:33
  • \$\begingroup\$ @xnor I don't understand your comment... Clock must be drawable at any width and height, I think I did not miss something in requirement, Size of draw could be submited as argument, like: drawBrailleClock $COLUMNS $LINES. From there ray may vary between horizontal and vertical. size of path, tick and border is explained... \$\endgroup\$ May 12, 2020 at 8:41
  • 1
    \$\begingroup\$ For instance, what characters should the outer circle be made of? What does something like "minute path are 2 point width" mean when it's tilted? For the challenge to be fully specified, one needs to be able to derive exactly what symbol is to displayed at each coordinate for any size. \$\endgroup\$
    – xnor
    May 12, 2020 at 8:44
  • \$\begingroup\$ Ok, So in a 45° angle, 2 to 3 point witdh could use upto 4 points horizontaly and verticaly ⠻⣷⣄.... answer edited \$\endgroup\$ May 12, 2020 at 9:03
  • \$\begingroup\$ I would recommend posting future challenges in our sandbox first. This seems like a neat idea, but there are some things that need to be clarified. In order to make this challenge well-specified enough for us to golf, it would be useful if you provided an ungolfed example program, or some pseudocode to show us how you want the results formatted. It may seem perfectly clear to you as the author, but we can't be entirely sure of what to output without more specification. \$\endgroup\$ Oct 1, 2020 at 2:50


Browse other questions tagged or ask your own question.