https://gist.github.com/pencilcheck/7252934
A lot of solutions here doesn’t seem to take account of multiple puddles, my solution does take that into account.