simulation of a Galton board

Stellaferox

Active Member
Licensed User
Hi all,

I've added a simulation of a Galton board. This is basically a pyramid of nails down which a set of marbles tumbles down every time a chance of 0.5 to fall to the left or right. In this simulation the number of rows, marbles and chances can be reset to other values. The red curve show the probability distribution and the black columns the actual count.
I am looking for a way to actually do the simulation using a sprite or something like that to see it tumbling down.
Suggestions are more then welcome as I have had very much trouble developing a loop for the input of numbers to be between limits. Cableguy did a tremendous job in suggestion the LostFocus Sub but I am not yet quite happy with the result because after giving <ENTER> after a wrong input the program doesn't show a messagebox which it does if you move the focus to the next textbox.
Thanx to all your kind input.
Marc
 

Attachments

  • Galton.sbp
    8.6 KB · Views: 425

Cableguy

Expert
Licensed User
Longtime User
Thanks for the reference, all i tryed todo was help....

BTW, why not try to catch the "enter" key and call lost focus with it?
 

Stellaferox

Active Member
Licensed User
NP, you do good work all over the board I noticed. Deserves a compliment.
Now, how would I do that, catch the Enter key? With keypress?
Marc
 

Stellaferox

Active Member
Licensed User
Managed to put in a picture
 

Attachments

  • Galton.jpg
    Galton.jpg
    14.9 KB · Views: 338

Cableguy

Expert
Licensed User
Longtime User
Hi Stellaferox

Yes with the keypress, the hardware(keybord) enter key is chr13 but as noted by @Work in is thread (http://www.b4x.com/forum/showthread.php?t=69) there are diferences between the HW keyboard and the SIPs...
 
Top