Introduce class Puzzle, isValid and refactor

DemoCtrl separated from MainCtrl. Refactor MainCtrl to maintain
a consistent Puzzle data model. Allows validity to be determined and
world and program to be saved as a Puzzle unit.