Although for this assignment, you will eventually use your ADT definition as the basis for some OOT code, the ADT definition itself is much more general than that. It expresses a concept or idea for how objects of its kind can be manipulated. That idea may be made real by building a computer program, or a physical object. Or it may never be made real at all -- an ADT can merely exist in your head.
Your specifications definitely should not say anything about grooves in wood, or pictures of plumbing pipes. This is true even if you expect the designers will choose wood with pictures of plumbing pipes. They are simply separate issues. Neither should your specifications say anything about pointers, modules, subprograms, or anything at all to do with a program, whether or not you plan later to write a program based on your ADT.
Game Data (or whatever your choose to call your ADT) consists of the following objects: - [ List the objects here, and specify any properties - that they must have. Include only essential properties -- - you don't want to tie things down unnecessarily. Don't - talk about what the objects can do, just what they are. ] The operations that one can perform on Game Data are: - [ List the operations here. Specify exactly what each one should - do. You will have to refer to information that flows to and - from the operation. - For example, when we defined the Retrieve operation for ordered - sets, we said "Given an integer i ... returns the element of rank i in the ordered set. ]Your definition must be specific (and clear and unambiguous) enough that, from only your definition, one could implement the ADT. That is, one could:
This is not correct. Your ADT should defined only the objects involved in Labyrinth, and how they can be manipulated. Specifying how the game is played, using these objects and operations, is the not the job of the ADT. (After all, those same objects and operations could be used to create a game with different rules, perhaps a cooperative game in which the two players work together rather than against eacy other.) So your ADT should not include an operation for playing a game. And your corresponding module should not include a subprogram for playing a game. Playing a game is the job of the main program.
By the way, when I talk about the "main program" I mean the code outside of the module. It will be big enough that you will want to break it down into subprograms.
As an adjective, it can mean "considered apart from concrete existence". This certainly applies to the notion of an Abstract Data Type; it is a concept quite separate from any concrete existence that we might create, say, with a program.
As a noun, it can mean "A statement summarizing the important points of a given text"; "the concentrated essence of a larger whole." In other words, an "abstract" ignores the small details. Modules certainly allow us to ignore the small details to do with how things are implemented. Subprograms do the same thing, on a smaller scale. For example, in the assignment hints we suggest that you include this function in your module:
% tileTypeAt %---------------------------------------------------------------- % Return the type of the tile at location (row, col). function tileTypeAt (row : int, col : int) : tileTypeOnce you've written it, you "abstract away from" the details of the data structure and act as if it's accessible directly by row and column number. You can probably come up with a number of subprograms that provide convenient abstractions like this for you.
Abstraction is one of the most important concepts in computer science. Abstraction makes it possible to manage the complexity of large programs.