Created
February 9, 2014 23:25
-
-
Save rhettallain/8907714 to your computer and use it in GitHub Desktop.
simulation of flappy bird
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pylab import * | |
import random as rd | |
total=150 | |
p=.587 | |
np=[] | |
sp=[] | |
n=0 | |
while n<total: | |
temp=rd.random() | |
tempscore=0 | |
while temp>=p: | |
tempscore=tempscore+1 | |
temp=rd.random() | |
n=n+1 | |
np=np+[n] | |
sp=sp+[tempscore] | |
scatter(np,sp, s=40) | |
xlabel('Number of Trials') | |
ylabel('Score') | |
show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment