Added a function to validate input and support for loading puzzles from a file