A lake sits on a square map, and its shape has no formula. Darts were thrown at random, evenly over the whole map, and for each one you know whether it landed in the lake. Write estimate_area(darts, square, lake): the lake’s estimated area, in the map’s units squared (km² for a map measured in km).
A lake on a 2 km by 2 km map, with no formula for its shape. Darts land at random all over the map, and some land in the water. Counting them isn’t the area: the count can be bigger than the whole map. The goal is the lake’s area in km², from the darts alone. Your estimate_area() works it out.
estimate_area(darts, square, lake)| darts | where each dart landed, [x, y] on the map (a list of pairs) | e.g. [[0.131, 0.31], [0.942, 0.755], [0.615, 0.… |
| square | the map's side length, e.g. 2 for a 2 km by 2 km map | e.g. 1 |
| lake | 1 if that dart landed in the lake, else 0 (a list, one per dart) | e.g. [1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 1, 1,… |
| returns | the lake's estimated area, e.g. 2.5 (km² on a map measured in km) | |