Wrote the code for the FSM used to score a layout