This tutorial covers two applications of the state pattern as preparation for the Hangman project.
Create a directory for this lab, and copy the files
These are the Java stub code for the design of a "smart word" given by the
following UML diagram.
In the above diagram,
AWord is an abstract class
to represent the input word in the Hangman game.
AWord can be empty or non-empty:
can be hidden or visible:
String representation is
an underscore ("_").
String representation is the
that of the character itself.
See the provided AWord.java for its definition.
The characters in a concrete non-empty
are "smart" and know how to compare themselves with other characters.
They are implemented using the state pattern.
See the provided WordChar.java for its definition.
WordChar and its derived classes.
AWord and its derived classes.
Your labbies will give you guidance, but will not help you write the code. These exercises constitute a non-trivial part of the current Hangman project.