In this lab and in the subsequent labs, you are encouraged to re-use and modify code from your previous lab solutions - if you choose do this, please put a completely new copy of any header and source files from your previous lab(s) in the new lab project directory you create. This can avoid some potential for error or confusion within Visual Studio, and also ensures you have a backup copy that you could go back to if a modification you try doesn't pan out.
In the next lab assignment you will use these features to allow a user to play a text-based solitaire version of the game "scrabble", with a board on which interlocking words are played.
Please also review and follow the additional guidelines that may be relevant to this lab: A.7-A.8 (exceptions), A.12-A.15 (pointers and arrays), A.16 (debugging), B.1-B.6 (dynamic memory allocation), B.10-B.12 (constructors), B.18 (copy constructor and assignment operator), B.22 first part (inclusion guards), and C.5 (pointer arithmetic).
Note: the details of this assignment are again intentionally somewhat under-specified, leaving you some room to choose what you think is the best way to implement them, as long as what you do is reasonable and you explain your design decisions in comments in the code and in your Readme.txt file.
Dictionary) with a private
member variable that is an STL-supplied container of C++ style strings
(e.g., of type vector<string> or
list<string>). The public interface for
this class should be:
bool value indicating whether (true) or not (false) the
passed string was found in the dictionary (hint: the STL find algorithm can
help you implement this, though you are also free to implement your own
approach such as keeping the strings sorted in the container member variable
and then doing iterative or binary search over the strings depending on the
type of container you chose to use).
LetterTileCollection) to
represent a collection of letter tiles. This class should have
a private
member variable that is an STL-supplied container of letter tiles
(e.g., of type vector<LetterTile> or
list<LetterTile>). The public interface for
this class should be:
WordCollection) to
represent the possible valid rearrangements of a collection of letter tiles that
make up words that are found in a dictionary.
This class should have
a private member variable that is an STL-supplied container of letter tile collections
(e.g., of type vector<LetterTileCollection> or
list<LetterTileCollection>). The public interface for
this class should be:
Word collection objects should print out the permutations they contain in order by ascending score. How you implement this is up to you, but establishing the ordering in the constructor as an invariant is one nice way to do this.
Please decide whether or not you want to implement (by declaring and defining
a copy constructor and assignment operator for the class) or prevent (see programming
guideline B.18) copying of Dictionary and
WordCollection objects. In your ReadMe.txt file,
please state and justify your decisions about this and please also describe how you
tested whether or not your approach to this worked for both of those types.
Hint: If successful make sure to close the files before proceeding, since otherwise the program may fail.
Dictionary
object in your main function.
LetterTileCollection object in your main function. This object will
serve as a pool of tiles from which other collections can be drawn.
LetterTileCollection objects in your
main function. Then, for each of these objects (1) shuffle the pool
object described above and move seven tiles from the pool into
the object you just default constructed.
LetterTileCollection objects into which you moved
tiles (also passing in the Dictionary object), construct a
WordCollection object.
Send the zip file containing your lab 3 solution as an e-mail attachment to the course e-mail account (cse332@cec.wustl.edu) by the submission deadline for this assignment. If you need to make changes to your lab solution you are welcome to send a new zip file, and we will grade the latest one received prior to the deadline (according to the time stamp the server puts on the e-mail).