PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Created by tamaslud
'''
Galton Board Challenge
.
. .
. . .
. . . .
. . . . .
o
o o
o o o
o o o o o o
The Galton Board is triangular shaped with pegs on the board and slots at the bottom. Balls are placed in at the very top and hit the first peg causing them to either bounce left or right where they will meet another peg with the same choice. They continue to do this until they reach the bottom and enter a slot. The more balls and slots there are, the more we can see the natural bell-shaped curve that forms of normal and binomial distribution.
'''
from random import randint as ri
balls = 40 #number of balls
slots = 8 #number of base slots
#you can edit the values for different size of board, and different number of balls
res = []
[res.append(0) for i in range (slots)]
# initializing the result list with zeros
for i in range (balls):
subres =[1]
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run