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
67
Task/Draw-a-clock/FunL/draw-a-clock.funl
Normal file
67
Task/Draw-a-clock/FunL/draw-a-clock.funl
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
import concurrent.{scheduleAtFixedRate, scheduler}
|
||||
|
||||
val ROW = 10
|
||||
val COL = 20
|
||||
val digits = array( [
|
||||
" __",
|
||||
" / /",
|
||||
"/__/ ",
|
||||
" ",
|
||||
" /",
|
||||
" / ",
|
||||
" __",
|
||||
" __/",
|
||||
"/__ ",
|
||||
" __",
|
||||
" __/",
|
||||
" __/ ",
|
||||
" ",
|
||||
" /__/",
|
||||
" / ",
|
||||
" __",
|
||||
" /__ ",
|
||||
" __/ ",
|
||||
" __",
|
||||
" /__ ",
|
||||
"/__/ ",
|
||||
" __",
|
||||
" /",
|
||||
" / ",
|
||||
" __",
|
||||
" /__/",
|
||||
"/__/ ",
|
||||
" __",
|
||||
" /__/",
|
||||
" __/ "
|
||||
] )
|
||||
val colon = array( [
|
||||
" ",
|
||||
" .",
|
||||
". "
|
||||
] )
|
||||
|
||||
def displayTime =
|
||||
def pad( n ) = if n < 10 then '0' + n else n
|
||||
|
||||
t = $time
|
||||
s = (t + $timeZoneOffset)\1000%86400
|
||||
time = pad( s\3600 ) + ':' + pad( s%3600\60 ) + ':' + pad( s%60 )
|
||||
|
||||
for row <- 0:3
|
||||
print( if $os.startsWith('Windows') then '\n' else '\u001B[' + (ROW + row) + ';' + COL + 'H' )
|
||||
|
||||
for ch <- time
|
||||
print( if ch == ':' then colon(row) else digits(int(ch)*3 + row) )
|
||||
|
||||
println()
|
||||
t
|
||||
|
||||
if not $os.startsWith( 'Windows' )
|
||||
print( '\u001B[2J\u001B[?25l' )
|
||||
|
||||
scheduleAtFixedRate( displayTime, 1000 - displayTime()%1000, 1000 )
|
||||
readLine()
|
||||
scheduler().shutdown()
|
||||
|
||||
if not $os.startsWith( 'Windows' )
|
||||
print( '\u001B[?25h' )
|
||||
14
Task/Draw-a-clock/Nim/draw-a-clock.nim
Normal file
14
Task/Draw-a-clock/Nim/draw-a-clock.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import times, os
|
||||
|
||||
const
|
||||
t = ["⡎⢉⢵","⠀⢺⠀","⠊⠉⡱","⠊⣉⡱","⢀⠔⡇","⣏⣉⡉","⣎⣉⡁","⠊⢉⠝","⢎⣉⡱","⡎⠉⢱","⠀⠶⠀"]
|
||||
b = ["⢗⣁⡸","⢀⣸⣀","⣔⣉⣀","⢄⣀⡸","⠉⠉⡏","⢄⣀⡸","⢇⣀⡸","⢰⠁⠀","⢇⣀⡸","⢈⣉⡹","⠀⠶ "]
|
||||
|
||||
while true:
|
||||
let x = getClockStr()
|
||||
stdout.write "\e[H\e[J"
|
||||
for c in x: stdout.write t[c.ord - '0'.ord]
|
||||
echo ""
|
||||
for c in x: stdout.write b[c.ord - '0'.ord]
|
||||
echo ""
|
||||
sleep 1000
|
||||
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