How to build the perfect sandcastle