The assignment is this:
dartboard program
Write a program that simulates throwing a dart at a dartboard that contains a circle
circumscribed within a square. Show that the ratio of of hits (lands inside the
circle) to throws (lands somewhere within the square) times four is approximately
the value of Pi by producing the following output on the stage in Scratch
Throws: 10000; Hits: 7858; Ratio: 3.1432
Note that just the “Ratio: ” followed by the value based on the hits and misses can
be printed if using Scratch.
Any help would be appreciated, thanks!
Offline
Since this is a school assignment, I won't give you the scripts, but I'll point you on your way. So first, you'll need a dart, and a board, then you'll need the dart to go to a random spot on the board. That part should be easy. Now, you'll need to manipulate the equation of a circle to detect when the dart is in the circle. The rest you should be able to get. Anyway, good luck!
Last edited by ErnieParke (2012-11-07 15:09:27)
Offline
I am trying to create this program at the mkoment I think I need to create 2 sprites.. one square and one circle... then set a 1000 pen marks randomly inside the square, then I need to find out the rest lol...
Offline