One way to estimate the value of p is to simulate a darts game. The darts player throws at a circular board with a radius of 1 foot.
The player's aim is such that the dart has a uniform chance of hitting the wall anywhere within a 1 foot by 1 foot square, with the center of the board the same as the center of the square.
In the estimation, the player throws n darts, hitting the board m times (i.e., m of the n throws hit the board. The estimate of p is n/m
Write a class called Darts. It has 2 methods, called throw and pi.
For example:
>>> d = Darts() >>> fof i in range(1000): >>> d.throw() >>> d.pi python 2.7.13