5/5 – (1 vote)
1 Goals To use derivation to create a variation of the Sudoku game board. To show you can use UML class diagrams. To experience the interaction between the constructors of the base and derived classes.2 Variation: A Board with two more clusters.Several variations of Sudoku have been invented. Some are easy to implement, others quite difficult.In this assignment you will implement the easiest variation. Almost everything is the same as in a traditional Sudoku board: the Squares, Clusters, and user interface. The new Board class has one difference: it has two more clusters, which go diagonally on the board from one upper corner to the opposite lower corner. The format of the input le will change slightly: now the rst line will have a code for the type of puzzle, t for traditional or d for diagonal. The next 9 lines will contain the puzzle, as before. In the game class, read the rst line of the le and use the input char to create either a new Board or a new DiagBoard. You should not need any other changes in Game. Change your cluster-type enumeration and its parallel array to include DIAG for diagonal. Change your Board constructor to take a parameter, which will be the number of clusters to allocate. The default is 27, for traditional boards, as before. The other possible value is 29. Derive a DiagBoard class from Board. In the DiagBoard constructor, initialize the base class, Board, with a parameter 29 for the number of clusters. In the body of the DiagBoard constructor, create the two diagonal clusters and add them to the Boards array.Note that the result will be to add one more cluster to each Square on the diagonals, and two more clusters to the center Square. This should all work automatically because the Squares use vector to store the Cluster*s and a Square shoops all of its Clusters each time a mark is made. This is where the combination of OO and careful design pays o.3 Overall Project RequirementsI want you to use all the techniques below. In some cases, you must choose where and how to use them.1. Use a static class variable.2. Use ctors in the required places and also in some of the optional places.3. Use default parameters somewhere.4. Use const wherever you can in your program. (Const parameters, const this, const local variables, const return type, const global information.)
Reviews
There are no reviews yet.