rf-web/vendor/bundle/gems/rouge-3.12.0/lib/rouge/demos/lutin

19 lines
497 B
Plaintext
Raw Normal View History

2019-10-21 08:18:17 +00:00
node gen_x_v1() returns (x:real) = loop 0.0<x and x<42.0
node gen_x_v2() returns (x:real) =
loop { 0.0<x and x<42.0 fby loop [20] x = pre x }
node gen_x_v3() returns (target:real; x:real=0.0) =
run target := gen_x_v2() in
loop { x = (pre x + target) / 2.0 }
let inertia=0.6
node gen_x_v4() returns (target:real; x:real=0.0) =
run target := gen_x_v2() in
exist px,ppx : real = 0.0 in
loop {
px = pre x and ppx = pre px and
x = (px+target) / 2.0+inertia*(px-ppx)
}