University of Toronto CSC148s, 1996 Solution to Assignment 2 The programs required for this assignment were written in modular pieces, to facilitate sharing of code between the maze checker program and the maze builder program. Both programs need some subprograms that can take care of the data structure that keeps track of a maze (in our case, a 2D array). So these subprograms were packaged up and put into a separate file called supt.t. Only one copy of the subprograms is needed, and both the maze.t and edit.t programs can use them. The maze builder program also needed a bunch of subprograms that would take care of the graphical user interface. These have nothing to do with other aspects of maze.t, so again it makes sense to separate them in another file. We went one step further: we made an OOT "module" to formalize the packaging. See lecture slides 329-345 for a quick summary of how modules work, or chapter 4 of the text for more details. We will cover modules, and a related concept called a class, later in the term. Note that one key advantage of the module is that, in order to use the module, you only have to look at the list of "exported" items, and the definition of each of them. Everything else is just an implementation detail that you don't need to know about. And in fact, you cannot touch anything that is not exported. This protects the internal (secret) parts from accidental damage. Using this code for Assignment 4 -------------------------------- For assignment 4, you will be permitted to use any of this code. So it may well be worthwhile to learn about modules now. If you do use any of our code, make sure that you acknowledge the parts that you have used, and that you take particular pains to explain any modifications or extensions you made.