In my python programming class one of the bonus problems is this:
Suppose you are located at the exact center of a cube. If you could look all around you in every direction, each wall of the cube would occupy 1/6 of your field of vision. Suppose you move toward one of the walls so that you are now half-way between it and the center of the cube. What fraction of your field of vision is now taken up by the closest wall? Hint: use a Monte Carlo simulation that repeatedly “looks” in a random direction and counts how many times it sees the wall.
I have an idea of what the program should do thanks to the hint: 1. Define the boundaries of one wall 2. "Look" in a random direction 3. Count how many times the simulation "sees" the wall
The author states that this problem can be solved with fancy "analytical geometry," so if someone could explain to me how to solve this mathematically, I could maybe go about building the program off of that. I have some ideas but they are just ideas... Mainly, define field of vision as a sphere encompassing the cube. Then in the base case at the center, each wall takes up exactly 1/6 of your field of vision. Also, something about a "solid angle" might be part of it. http://en.wikipedia.org/wiki/Solid_angle
I could be on completely the wrong track here, so any help would greatly be appreciated by me (and my teacher). Oh, and by the way, I am in 9th grade in a pre-calculus class O_O