Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Galton-box-animation/PicoLisp/galton-box-animation-1.l
Normal file
25
Task/Galton-box-animation/PicoLisp/galton-box-animation-1.l
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
(de galtonBox (Pins Height)
|
||||
(let (Bins (need (inc (* 2 Pins)) 0) X 0 Y 0)
|
||||
(until (= Height (apply max Bins))
|
||||
(call 'clear)
|
||||
(cond
|
||||
((=0 Y) (setq X (inc Pins) Y 1))
|
||||
((> (inc 'Y) Pins)
|
||||
(inc (nth Bins X))
|
||||
(zero Y) ) )
|
||||
((if (rand T) inc dec) 'X)
|
||||
(for Row Pins
|
||||
(for Col (+ Pins Row 1)
|
||||
(let D (dec (- Col (- Pins Row)))
|
||||
(prin
|
||||
(cond
|
||||
((and (= X Col) (= Y Row)) "o")
|
||||
((and (gt0 D) (bit? 1 D)) ".")
|
||||
(T " ") ) ) ) )
|
||||
(prinl) )
|
||||
(prinl)
|
||||
(for H (range Height 1)
|
||||
(for B Bins
|
||||
(prin (if (>= B H) "o" " ")) )
|
||||
(prinl) )
|
||||
(wait 200) ) ) )
|
||||
|
|
@ -0,0 +1 @@
|
|||
(galtonBox 9 11)
|
||||
Loading…
Add table
Add a link
Reference in a new issue