Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/Draw-a-clock/J/draw-a-clock-1.j
Normal file
34
Task/Draw-a-clock/J/draw-a-clock-1.j
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{{
|
||||
require'gl2'
|
||||
coinsert 'jgl2'
|
||||
clock_face_paint=: {{
|
||||
try.
|
||||
'H M S'=. _3{.6!:0''
|
||||
glclear''
|
||||
center=. 2-~<.-:glqwh''
|
||||
glpen 2: glrgb 0 0 0 255
|
||||
glellipse 1+,0 2*/center
|
||||
center {{ gllines <.2+(m,m)+,0.97 1*/m*+.j.y}}"0^j.2r12p1*i.12
|
||||
center {{ gllines <.2+(m,m)+,0.92 0.99*/m*+.j.y}}"0^j.2r4p1*i.4
|
||||
hand=: center {{
|
||||
glpen 2: glbrush glrgb<.4{.255*x,4#1
|
||||
gllines<.2+m,m*1++.j.n*^j.1p1+y
|
||||
EMPTY
|
||||
}}
|
||||
1 0 0 (0.8) hand 2r60p1*S
|
||||
0 1 0 (0.7) hand 2r60p1*M+60%~S
|
||||
0 0 1 (0.4) hand 2r12p1*H+60%~M+60%~S
|
||||
catch.
|
||||
echo 13!:12''
|
||||
end.
|
||||
EMPTY
|
||||
}}
|
||||
clock_timer=: glpaint
|
||||
wd {{)n
|
||||
pc clock closeok;
|
||||
cc face isigraph;
|
||||
set face wh 200 200;
|
||||
ptimer 100;
|
||||
pshow;
|
||||
}}
|
||||
}}1
|
||||
20
Task/Draw-a-clock/J/draw-a-clock-2.j
Normal file
20
Task/Draw-a-clock/J/draw-a-clock-2.j
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Note'rudimentary 4 second clock'
|
||||
advances an arrow at roughly 1 second intervals,
|
||||
accurate to the nearest half second.
|
||||
Please replace draw with a verb demonstrating one of
|
||||
j's fantastic graphical capabilities.
|
||||
x draw y
|
||||
x are session seconds
|
||||
y is the initial value, session seconds at tic start in the example
|
||||
tic^:8 seconds''
|
||||
)
|
||||
|
||||
delay=:6!:3 NB. "sleep"
|
||||
seconds=:6!:1 NB. session time in seconds
|
||||
Pass_y =: (]`[`)(`:6) NB. adverb that evaluates the verb and returns y
|
||||
|
||||
round =: [: <. 0.5&+ NB. round to nearest integer
|
||||
PICTURES=: u:16b2190+i.4 NB. whoot arrows
|
||||
draw=: [: smoutput PICTURES ((|~ #)~ { [) [: round -
|
||||
|
||||
tic=: (>. draw Pass_y <.) ([: seconds 0 $ delay@1:)
|
||||
7
Task/Draw-a-clock/J/draw-a-clock-3.j
Normal file
7
Task/Draw-a-clock/J/draw-a-clock-3.j
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
require'plot'
|
||||
N=:0.01*i.629
|
||||
O=: [: j./ 1 2 o./ ]
|
||||
|
||||
delay=:6!:3 NB. "sleep"
|
||||
clock=: [: plot (O N),N*/~0.07 0.11 0.15(*O) 2r24p1 2r60p1 2r60p1*_3{.6!:0 bind ''
|
||||
delay@1:@clock^:9e99''
|
||||
Loading…
Add table
Add a link
Reference in a new issue