Rain Water trapping

Need some more clarification and understanding of the code.