Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
31
Task/Draw-a-clock/Sidef/draw-a-clock.sidef
Normal file
31
Task/Draw-a-clock/Sidef/draw-a-clock.sidef
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
STDOUT.autoflush(true)
|
||||
|
||||
var (rows, cols) = `stty size`.nums...
|
||||
|
||||
var x = (rows/2 - 1 -> int)
|
||||
var y = (cols/2 - 16 -> int)
|
||||
|
||||
var chars = [
|
||||
"┌─┐ ╷╶─┐╶─┐╷ ╷┌─╴┌─╴╶─┐┌─┐┌─┐ ",
|
||||
"│ │ │┌─┘╶─┤└─┤└─┐├─┐ │├─┤└─┤ : ",
|
||||
"└─┘ ╵└─╴╶─┘ ╵╶─┘└─┘ ╵└─┘╶─┘ "
|
||||
].map {|s| s.split(3) }
|
||||
|
||||
func position(i,j) {
|
||||
"\e[%d;%dH" % (i, j)
|
||||
}
|
||||
|
||||
func indices {
|
||||
var t = Time.local
|
||||
"%02d:%02d:%02d" % (t.hour, t.min, t.sec) -> split(1).map{|c| c.ord - '0'.ord }
|
||||
}
|
||||
|
||||
loop {
|
||||
print "\e[H\e[J"
|
||||
for i in ^chars {
|
||||
print position(x + i, y)
|
||||
print [chars[i][indices()]].join(' ')
|
||||
}
|
||||
print position(1, 1)
|
||||
Sys.sleep(0.1)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue