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' )
|
||||
Loading…
Add table
Add a link
Reference in a new issue