Data Abstraction Revisited

The data for this program is game states.

Recall the constructor and selector for game states:

All aspects of the game have been programmed without any idea of how the constructor and selectors are defined.

We have used the ADT game state without knowing how game states are represented.

In other words, we have successfully separated our data's use from its representation.

Now, we need to "glue together" the two numbers 4 and 5 in one data type:

We will consider four representations, any of which could be used without changing any of the procedures written so far.