Prog 6: Unscrambler Undo ? ? Create a version of program 5 that implements a class to store the board and do all op
Prog 6: Unscrambler Undo
Create a version of program 5 that implements a class to store the board and do all operations on it, and also implements a linked list (that itself may be a struct or a class) to store all moves made in the game, allowing infinite undo of moves back to the beginning of the game. To earn any points on this assignment you must implement and use the Board class, and implement undoing moves specifically using a linked list. Test and submit program 6 using Zybooks section 12.12
No late submissions will be accepted for program 6! Grading will be done on only the automated tests, with no grading for programming style. We will still run the program comparison tool, to compare the parts of code that you do write vs. what is supplied to you.
If you haven’t already done so, first implement program 5 using classes to implement the Board class. Once the deadline for program 5 has passed, I will post a solution to program 6 that does not include using classes and does not have the undo feature. You can use this as a starting point for a program 5 implementation using classes, in case you did not already create one.
Once your classes version of program 5 is working also implement a Node struct or class used to store each move. Use this to implement new menu option ‘U’ for Undo of the most recent move, implementing this using a linked list. Attempting to undo at the beginning of the game generates the error message *** You cannot undo past the beginning of the game. Retry. *** and reprompts for user input, without the move number changing.
Running the program looks like the following, which can alternatively be accessed using this google doc:
Dictionary Words
This is a special case aspect to this program. The dictionary words are used to create a Board, but once that is done we don’t need to use the dictionary again unless we want to regenerate the board. You can handle the dictionary completely separately from the Board class if you want to. If you do decide to put it into the class, declare a single version of the dictionary that is available to all Board objects, but exists as a shared single data structure rather than each object having its own version of the dictionary. This is done by declaring it within the Board class as static. To implement this do the following within class Board:
1. As part of the private section declare the vector as: static vector<string> dictionaryWords;
2. As part of the public section declare member function: static void readWordsIntoDictionary();
3. Outside the class, have a declaration that allocates memory for the dictionary words: vector<string> Board::dictionaryWords; It belongs to the class, but has to be defined outside the class so that memory is allocated for it on the stack.
4. Write function void Board::readWordsIntoDictionary() to open the input file and read words into vector dictionaryWords. Because this is a static function, you can invoke it without using a class object but using the class scope specifier as follows: Board::readWordsIntoDictionary();
Use the Node class in your program as shown below, which can alternatively be opened from . These ideas are also already included in the default template code within the Zylab assignment.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.