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 = '☼' /*define characterchars for a pin and (pin)a 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. */
ball = '☼' /* " " " " /* [↓] drop a new ball ? (bead).*/
 
if #<balls & step//2 then do; @.1= center(ball, sw+1); # = # + 1; end /*drop a new ball ? */end
else if static then exit 2 else if static then exit 2 /*insure balls are static. balls*/
return
/*──────────────────────────────────────────────────────────────────────────────────────*/