Once we have written the code, we can test it by compiling. We must compile all three .c files, which include the appropriate .h files with the macro definitions and prototypes they need:
We use the cc command as:
ee150:wiliki:5> cc guess.c sequence.c test.c
guess.c:
sequence.c:
test.c:
ee150:wiliki:6> ls
Improve1/ guess.c guess.o sequence.c test.c tfdef.h@
a.out* guess.h play.h sequence.o test.o
Though we might be able to think of several improvements to this program, one that comes to mind is to keep score of how many wins and losses the player has if they play more thank one round. The "spec" does not call for this, but it does not forbid it either.
In the test module, sequence module, or the driver module? Let's look at all the modules individually.
The Sequence Module: This module is responsible for sequencing the steps of play for one round of the game.
The Driver Module: This module is responsible for overseeing the entire program; invoking the other modules as appropriate. It is the module allowing the user to play the game repeatedly.
The Driver Module takes care of playing the game repeatedly, so this seems like an appropriate place to update the program for our new feature. The new driver is guess.c improved.
We can now compile with out update. It is inefficient to have to recompile all of our modules just because we only changed one piece. Makefiles can be a better way to do this.