Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 Nonogram is a 2-D puzzle in which cells are filled by the player to reveal a hidden picture. We will only deal with black
2 Nonogram is a 2-D puzzle in which cells are filled by the player to reveal a hidden picture. We will only deal with black and white pictures which will be represented by 1s and Os, respectively. This assignment is the start of a semester-long project so the program you produce here will not quite play an entire game yet. We will add to this incrementally over time. In this assignment, you are to create the following: 1. A class NonogramPuzzle that has the attribute: 1. solution - an n-by-n (or square) array of integers that represents a hidden picture and methods 1. NonogramPuzzle (int size) - constructs a size X size Nonogram puzzle filled with randomly generated Os and 1s, note that the array content will be replaced with a more meaningful hidden picture in another assignment 2. NonogramPuzzle () - constructs a 5x5 Nonogram puzzle filled with randomly generated Os and 1s [hint: save code by calling the other constructor] 3. tostring() - returns a string representation of the hidden puzzle in a grid format (rows and columns) that might be printed elsewhere 4. getrowclues () - returns a one-dimensional array of String objects, the size of this array is the size of the square, and each element of the string array corresponds to the clue for that row (example: {"4", "1 1", "1", "1", "5"}) 5.getColumnClues () - returns a one-dimensional array of String objects, the size of this array is the size of the square, and each element of the string array corresponds to the clue for that column (example:{"1", "22" "1 1", "1 1 1", "2 1"}) 6. Any other private helper method you might need 2. A main method in a another class that constructs a NonogramPuzzle object; displays the contents of the hidden puzzle, all the row clues, and all the column clues, each labeled accordingly. Comments: Add Javadoc to each class, and for each method
Step 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