Natural Pi - The Front Nine W.I.P.
## Meta ##
The big things are:
- 3 more ways to calculate pi with nature
- related pi theme/idea for back nine
Introduction
These challenges are simulations of algorithms that only require nature and your brain (and maybe some re-usable resources) to approximate Pi. If you really need Pi during the zombie apocalypse, these methods don't waste ammo!
Each challenge will give an algorithm for approximating Pi with nature. Then it will walk through how the computer simulation should work. Next comes the Specification to clear up details and finally there are some test cases.
Natural Pi #0 - Rock
Natural Pi #1 - Rain
Goal
Create a program/function that takes an input L,N
, make an L
xL
grid, plop in some random values, take a sum and repeat N
times.
TL;DR
Copy of the first paragraph of intro from meta
Simulation
What are we simulating?
How are we simulating this?
Specification
- Input
- Flexible, take input in any of the standard ways (eg function parameter,STDIN) and in any standard format (eg String, Binary)
- Output
- Flexible, give output in any of the standard ways (eg return, print)
- White space, trailing and leading white space is acceptable
- Accuracy, please provide at least 4 decimal places of accuracy (ie
3.1416
) - Scoring
- Shortest code wins!
Test Cases
Your output may not line up with these, because of random chance. But on average, you should get about this much accuracy for the given value of L
and N
.
Input -> Output
----- ------
100, 100 -> ?
100, 10000 -> ?
10, 1000000 -> ?