Jump to content

Draw a clock: Difference between revisions

Added Quackery.
(Added Quackery.)
Line 5,246:
There is a 3D analog clock in the
[http://www.vpython.org/contents/contributed/cxvp_clock.py VPython contributed section]
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="Quackery"> [ $ "turtleduck.qky" loadfile
$ "bigrat.qky" loadfile ] now!
 
[ $ \
import datetime
sec = datetime.timedelta(seconds=1)
time_will_be = datetime.datetime.now()+sec
hours = time_will_be.hour
minutes = time_will_be.minute
seconds = time_will_be.second
to_stack([hours, minutes, seconds])
\ python ] is time+1 ( --> [ )
 
 
[ $ \
import time
current_time = time.time()
time_to_sleep = 1.0 - (current_time % 1.0)
time.sleep(time_to_sleep)
\ python ] is wait ( --> )
 
[ 3 wide
60 times
[ 240 1 fly
10 1 walk
-250 1 fly
1 60 turn ]
7 wide
12 times
[ 235 1 fly
12 1 walk
-247 1 fly
1 12 turn ]
9 wide
14 times
[ 233 1 fly
14 1 walk
-247 1 fly
1 4 turn ]
1 wide
' [ 0 0 0 ] fill
[ 10 1 circle ] ] is face ( --> )
 
[ 12 wide
unpack rot dip
[ 43200 rot
720 v+ ]
12 v+
2dup turn
175 1 walk
-175 1 fly
-v turn ] is hour ( [ --> )
 
[ 8 wide
unpack rot drop
3600 rot
60 v+
2dup turn
200 1 walk
-200 1 fly
-v turn ] is minute ( [ --> )
 
[ 4 wide
2 peek
dup 60 turn
225 1 walk
-225 1 fly
negate 60 turn ] is second ( [ --> )
 
[ turtle
0 frames
[ clear 1 4 turn
face
time+1 dup dup
second minute hour
wait
frame 1 4 turn again ] ] is clock ( --> )</syntaxhighlight>
 
{{out}}
 
https://youtu.be/Z0XS9EnADGE
 
The audio, On the Teeth of Wheels by Beat Frequency, (used with permission) is a sonification of the [[Stern-Brocot sequence#Quackery]].
 
This sequence is used by clockmakers in choosing suitable gear sizes for the clockwork, and features heavily in the book "A Treatise On The Teeth of Wheels, Demonstrating The Best Form Which Can Be Given To Them For The Purposes Of Machinery; Such As Clockwork And Millwork, And The Art Of Finding Their Numbers." written by Charles-Étienne-Louis Camus, and translated from French to English by John Isaac Hawkins in 1873.
 
=={{header|Racket}}==
1,462

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.