Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
20
Task/Draw-a-clock/J/draw-a-clock-1.j
Normal file
20
Task/Draw-a-clock/J/draw-a-clock-1.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-2.j
Normal file
7
Task/Draw-a-clock/J/draw-a-clock-2.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