Question
Using C++ use vectors, that can more easily revise the ToggleGrid class to allow different dimensions and implement the Rullo game (https://www.coolmath-games.com/0-rullo ) More information
Using C++ use vectors, that can more easily revise the ToggleGrid class to allow different dimensions and implement the Rullo game
(https://www.coolmath-games.com/0-rullo )
More information below:
First, the revisions you need to make:
1.)The ToggleInt class
Because of how you will probably insert values into the ToggleGrid class, you will probably want to add a constructor that takes the value (m_int in the sample solution) as a parameter.
2.)The ToggleGrid class
ROWS and COLS (or whatever you called them) are no longer constants. Remove the const, make them fields of ToggleGrid if you have not already done so, and rename them using lowercase. One best practice that really does carry over from college to work is that constants get named with all-uppercase while regular variables mostly use lowercase. The main possible exception is the first letter of a word within the name (as in sameRank).
The grid of values should now be a vector of vectors of ToggleInts: vector>. If you find it more convenient, you are free to make this a pointer to a vector of vectors of ToggleInts, but you must use ToggleInts as the type of the elements.
The constructor should still take a list of values, but it should also take int parameters for the dimensions of the gird, number of rows firsts, then number of columns. Remember that when inserting values, you have to insert a ToggleInt, not just an int (the constructor suggested above should help)
3.)The Rullo class (in rullo.h)This is the class that implements the game. The game does not have to absolutely follow the version on the coolmath site, and there is additional tracking of overall performance there, but the program must:
Support letting the user choose different dimensions for the game and have a range of valid values.
Support solutions that have squares that are toggled off
Correctly detect when the player has found the solution
Give guidance on whether the player is correct for a given row or column. You can simply list which rows and columns are correct, or you can list the sums for the current state of the players grid vs. the sums for the solution, or perhaps some other approach.
It is ok to have the user input the values and indicate either the sums for the rows/columns or which values are toggled on/off for the solution, but you may find it more interesting to randomly generate the values.
You must also use the ToggleGrid to store the values and manage the user interactions (specifically, toggling). Rewriting everything to use arrays of ints (even if you separately declare a vector) will not receive any credit for this section.
You must define a constructor that takes the dimensions of the board and the minimum and maximum for a value on the board.
There also must be a void function called play() which does not take any parameters. This will play one puzzle.
Include instructions on how to play
Allow the user to quit in the middle
4.)The driver (Driver.cpp)
In your main, describe what the program does
Using a local variable of type Rullo, play the game by calling its play() method
If you like you can put this call inside a loop that asks the player after each game whether they have had enough or want to play another game.
Therefore, you should have the following:
ToggleInt.h (Header file)
Driver.cpp
ToggleGrid.h (Header file)
Rullo.h (Header file) (must also use ToggleGrid)
constructor and the field declarations
instructions
accurate display of status of grid for what the player has toggled off or on
giving information on whether the player is currently correct for each row and for each column
correctly stopping if the player has won
allowing the player to quit in the middle
Comments for each file/class, something for each method/function, other comments to explain parts of the code when it's not clear
Choosing appropriate names for variables, functions, constants, and classes counts
Hw4 Due: February 5, end of day (extended from the syllabus) Now that we have vectors, we can more easily revise the ToggleGrid class to allow different dimensions and implement the Rullo game Chttps://www.coolmath-games.com 0-rullo). First, the revisions you need to make: The ToggleInt class a. Because of how you will probably insert values into the ToggleGrid class, you will probably want to add a constructor that takes the value" (m int in the sample solution) as a parameter. a. ROWS and COLS or whatever you called them) are no longer constants. Remove the "const". make them fields of ToggleGrid if you have not already done so, and rename them using lowercase. One "best 2. The ToggleGrid class practice that really does carry over from college to work is that constants get named with all-uppercase while regular variables mostly use lowercase. The main possible exception is the first letter of a word b. The grid of values should now be a vector of vectors of ToggleInt's: vectorStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started