Add tasks for all the new languages
This commit is contained in:
parent
9dc3c2bb62
commit
bba7bfd280
13208 changed files with 134745 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(1)
|
||||
|
||||
var (rows, cols) = `stty size`.words.map{.to_i}...
|
||||
|
||||
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";
|
||||
chars.range.each { |i|
|
||||
print position(x + i, y);
|
||||
print [chars[i][indices()]].join(' ');
|
||||
}
|
||||
print position(1, 1);
|
||||
Sys.sleep(1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue