Building a Hamiltonian path puzzle

Number Trail is a Hamiltonian-path puzzle: draw one continuous line that visits every cell exactly once, passing through numbered clues in order. This post goes over the implementation from puzzle file format to board rendering, drag controls, and Warnsdorff's random generator.