Draw a clock: Difference between revisions
Content added Content deleted
No edit summary |
(Added uBasic/4tH version) |
||
Line 699: | Line 699: | ||
ENDSUB |
ENDSUB |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
==={{header|uBasic/4tH}}=== |
|||
This program requires an ANSI terminal for the best results. |
|||
<syntaxhighlight lang="uBasic/4tH">Dim @c(3) |
|||
' clock digits |
|||
@c(0) := " _ _ _ _ __ _ _ " |
|||
@c(1) := "/ \\ /| ) _)|_||_ / /(_)(_) * " |
|||
@c(2) := "\\_/ | /_ _) | _)(_) / (_) / * " |
|||
p = 0 ' previous time equals zero |
|||
Do ' repeat forever |
|||
Do |
|||
t = Time() % 86400 ' get the time and encode it |
|||
t = ((t / 3600) * 10000) + ((t % 3600) / 60) * 100 + ((t % 3600) % 60) |
|||
Until t > p ' until a second has been passed |
|||
Loop |
|||
p = t : Print "\e[2J\e[H" ' set old time to new time |
|||
' clear screen |
|||
For x = 0 To 2 ' for all rows |
|||
d = t ' preserve time |
|||
For y = 5 To 0 Step -1 ' get all digit columns |
|||
Print Show(FUNC(_Figure(d/(10^y), x))); |
|||
Print Show(Iif (y*(y%2=0), FUNC(_Figure(10, x)),"")); |
|||
d = d%(10^y) ' get next digit column |
|||
Next : Print ' next column, terminate row |
|||
Next ' next row |
|||
Loop ' next second |
|||
End |
|||
' get figure row/column |
|||
_Figure: Param (2) : Return (Clip(Chop(@c(b@), a@ * 3), (10-a@) * 3))</syntaxhighlight> |
|||
{{Out}} |
|||
<pre> _ _ _ _ _ |
|||
/ \(_) * / \|_| * |_ (_) |
|||
\_/ / * \_/ | * _)(_)</pre> |
|||
==={{header|BBC BASIC}}=== |
==={{header|BBC BASIC}}=== |
||
Line 739: | Line 775: | ||
ENDPROC |
ENDPROC |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
==={{header|Commodore BASIC}}=== |
==={{header|Commodore BASIC}}=== |