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
andWIDTH
-- the height and width of the displayed clock in terminal characters -- as input.From
pixelWidth = WIDTH x 2
andpixelHeight = 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 at10h10'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.
drawBrailleClock $COLUMNS $LINES
. From there ray may vary between horizontal and vertical. size of path, tick and border is explained... \$\endgroup\$⠻⣷⣄
.... answer edited \$\endgroup\$