Settings

Theme

Show HN: How many rain drops to cover a pavement? [Simulation]

charbz.com

4 points by charbz 10 years ago · 1 comment

Reader

AstroJetson 10 years ago

Nice simulation and throwing in that you know how trees work.

The embedded me would have brute forced it and gone with setting a double variable to 0x03FFFFFFFFFFFF then turning a bit off when that section was covered. When the variable was zero, pavement covered.

In a more fancy version I'd gone with an array to match the pavement length set to zero and incremented each pavement section by 1 to count the drops in each section. Scan each time to find the first zero, if found more rain, if no zeros then done. That would give a bonus, after the simulation ran I could get a histogram of how many raindrops per section.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection