Expand description
§Pipe Maze
This solution uses the Shoelace formula and Pick’s theorem.
Starting at S we trace out the path followed by the pipes. Each corner piece
(7, F, J, L and finally S) is considered a vertex and added to the running total
for the area using the Shoelace formula. Additionally we keep track of the perimeter length.
As the path is a loop the answer for part one is half the perimeter length.
The answer for part two is the number of interior points. Rearranging Pick’s theorem:
A = i + b / 2 - 1 => i = A - b / 2 + 1
Functions§
Type Aliases§
- Input 🔒