That would be my puzzle solution to:
1. Assign each piece type it's end offset and next piece connection angle
2. Start at 0,0 coordinate and iterate through pieces, advancing last piece position
3. Check the offset between the start and end pieces
And the result would look like images in the answer.
Updating the track to minimize offset is harder, though.