From Infinigons, etc: Putting myself in kids’ shoes

You have a square dartboard. What is the probability that a randomly-thrown dart will land closer to the center of the dartboard than to an edge?

Superb problem.

I took the lazy route. I made a python program to run 100,000 trials, and graph those trials on a coordinate plane.

And the numerical result:

closer to center 21939 closer to edge 78061 ratio is 0.21939

After 1,000,000 trials, the ratio is:

closer to center 219148 closer to edge 780852 ratio is 0.219148

The code for the vpython simulation is found here (and pasted below).

from math import sqrt import random from visual import * #Distance Formula def distance(xa,ya,xb,yb): return sqrt((xa-xb)**2+(ya-yb)**2) totalthrows = 0 closertoedge = 0 closertocenter = 0 #Creates the White points at the boundries of the screen points(pos=[(-500,-500,0),(500,-500,0),(500,500,0),(-500,500,0)],size=5, color=color.white) while (totalthrows < 100000): #All the random point coordinates are in the range: # 0 <= (x or y coordinate) < 1 #They are multipled later for display purposes xcoord = random.random() ycoord = random.random() #The min distance to edge is simply the coordinate closest 0 or to 1 mindistancetoedge = min(xcoord,ycoord,(1-xcoord),(1-ycoord)) if (mindistancetoedge > distance(xcoord,ycoord,0.5,0.5)): #Random point is closest to center closertocenter += 1 points(pos=[(int(1000*xcoord)-500,int(1000*ycoord)-500,0)], size=1, color=color.red) else: #Random point is closest to edge closertoedge += 1 points(pos=[(int(1000*xcoord)-500,int(1000*ycoord)-500,0)], size=1, color=color.yellow) totalthrows+=1 print "closer to center " + str(closertocenter) print "closer to edge " + str(closertoedge) print "ratio is " + str(float(closertocenter)/(float(closertoedge+closertocenter)))

Update: Btw, several people have REAL solutions (bravo): @infinignons and Ms. Cookie

This is great, thanks! Here’s a screencast on how I did it in Mathematica (sorry, not very professional but I’m still in my pj’s): http://screencast.com/t/lxr5dnvKH

Pingback: favorite problems 3 – dartboard | sonata mathematique