University of Calgary

darts

Darts
source: CCSC programming contest
You have a dart board on the wall defined by 2 points (the lower-left and upper-right corners defined as [x,y] coordinates) with a smaller square defined in the center of it (also defined by 2 [x,y] coordinates). Write a program that throws random darts at the dart board such that the probabilities of a hit anywhere within the larger space are all the same. Continue throwing darts and stop when one lands inside the smaller square. Print out all throws.



Updated: August 30, 2005 05:27 PM