Anonymous user
Galton box animation: Difference between revisions
m
→{{header|REXX}}: implemented a better method to abvoid collisions.
m (→{{header|REXX}}: changes "peg" to "pins", changed the (comment) title of the REXX program.) |
m (→{{header|REXX}}: implemented a better method to abvoid collisions.) |
||
Line 2,882:
if rows==0 then rows= (sw - 2 ) % 3 /*pins are on the first third of screen*/
clearScreen= 'CLS' /*the (OS) command to clear the screen.*/
pin = '·'; ball =
ball = '☼' /* " " " " ball (bead).*/▼
call gen /*gen a triangle of pins with some rows*/
call run /*simulate a Galton box with some balls*/
Line 2,919 ⟶ 2,918:
end
end /*forever*/
end /*c*/ /* [↓] step//2 is used to avoid collisions. */
if #<balls & step//2 then do; @.1= center(ball, sw+1); # = # + 1;
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
|