Zach won the rules competitions for part 2 and 3. For part 2 there are 4 heads. In phase 1 the red head looks at the nails, and the yellow head looks for the top and bottom nails. When a nail head is detected and we go into phase 2, the green and yellow heads come running and fix the wrong nails.


A little extra work for part 3. When a nail head has been detected, there’s a marker written ($) for that nail, to keep track of it.


Code
.