Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ programing for Rullo game Example of how Rullo Game works can be found https://www.youtube.com/watch?v=ex6SaWUse2E Rules of Rullo Game: Your goal is to remove numbers

C++ programing for Rullo game

Example of how Rullo Game works can be found https://www.youtube.com/watch?v=ex6SaWUse2E

Rules of Rullo Game:

Your goal is to remove numbers from the grid so that the remaining numbers in each row or column add up to the numbers next to that row or column. Click to remove or turn off a number, or click a removed number to add it back in. You can also click and hold a number to "lock" it on.

Program consists of four parts: 1. The ToggleInt class or ToggleIn.h

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 or ToggleGrid.h

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 or 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 or driver.cpp is a bit more simple than the previous drivers.

In your main, describe what the program does

Using a local variable of type Rullo, play the game by calling its play() method

<>c.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.

Comment each function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions