224k views
2 votes
Create an interactive program to use class a LightsOut class to allow a user to play a game. Each step in the game will require the state of the game to be displayed as ##'s and spaces in a grid, obviously get() will be used. Prompt and read input the row and column as shown below. If (0,0) is entered, exit the program. Use toggle() to update the state of the game.

If no command line parameter is given, use rand() to create the initial pattern. However, if a parameter is provided it should be interpreted as an integer and the lowest bit should determine the top-left (1,1) light. The next lowest bit represents the light to the right (1,2) and so on, wrapping to the next row, and ending in the bottom-right (5,5) with the 25th bit.

If all the lights are "out", instead of printing an empty grid, display the message "Congratulations!" and end the program.

User Vis
by
4.3k points

1 Answer

4 votes

Answer:

9+10=21

Step-by-step explanation:

wyd boy

User Warwick Masson
by
4.8k points