Multisize Nonogram Solver
Description:
If you haven't already done so, you should do the 5x5 and 15x15 Nonogram solvers first.
In this kata, you have to solve nonograms from any size up to one with an average side length of 50. The nonograms are not all square. However, they all will be valid and should only have one solution.
I highly recommend not to try and use a brute force solution as some of the grids are very big. Also, you may not be able to solve all the grids by deduction alone so may have to guess one or two squares. :P
You will be given three arguments: The clues, the width, and the height:
# clues is given in the same format as the previous two nonogram katas:
clues = (tuple((column_clues,) for column_clues in column),
tuple((row_clues,) for row_clues in row))
# width is the width of the puzzle (distance from left to right)
width = width_of_puzzle
# height is the height of the puzzle (distance from top to bottom)
height = height_of_puzzle
and you will have to finish the function:
def solve(clues, width, height):
pass
You should return either a tuple of tuples for Python or an array of array for JS of the solved grid.
For example, the second example test case looks like:
Therefore, you would be given the arguments:
clues = (((3,), (4,), (2, 2, 2), (2, 4, 2), (6,), (3,)),
((4,), (6,), (2, 2), (2, 2), (2,), (2,), (2,), (2,), (), (2,), (2,)))
width = 6
height = 11
Zero will be given as an empty tuple in python, or empty array in JS.
Test sizes:
You will be given 60 random tests in total. There will be:
- 35 small tests: 3 < the average of the side lengths <= 25
- 15 medium tests: 25 < the average of the side lengths <= 35
- 10 big tests: 40 <= the average of the side lengths <= 50
Good luck :)
Similar Kata:
Stats:
Created | Jan 9, 2018 |
Published | Jan 10, 2018 |
Warriors Trained | 2048 |
Total Skips | 220 |
Total Code Submissions | 3794 |
Total Times Completed | 164 |
Python Completions | 87 |
JavaScript Completions | 78 |
Total Stars | 124 |
% of votes with a positive feedback rating | 95% of 31 |
Total "Very Satisfied" Votes | 28 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 3 |
Average Assessed Rank | 1 kyu |
Highest Assessed Rank | 1 kyu |
Lowest Assessed Rank | 1 kyu |