Please ignore secret bonuses. Secret tests do NOT award bonus. Max hw grade is 30+2 bonus efficiency

Do you need help?

suggestions for pattern diff?

z
zoe_matrullo (2090 points)
4 8 12
in HW8 by (2.1k points)
edited by
Hi everyone!

I currently pass all the tests except the ones with pattern_diff_ since I can't manage to remove the images that don't check the conditions. I know that the consecutive lines of pixels have to be different and that I should make sure every pixel with index x in a line is different from the pixels with index x-1, x and x+1 of the following line. I wrote a function that checks that condition but apparently it doesn't work. Since I work with trees I even try to build it while checking the condition to avoid making not valid images but it still returns all the possible combinations.

Can someone maybe give me some other ideas to approach the problem so that I can try to rethink it in a different way?

Thanks!!!
293 views
closed

2 Answers

Best answer
gabrimat (5630 points)
2 4 25
by (5.6k points)
selected by
While building the tree you should try to build the image already in perfect state. When the image is built in this way there are some cases where it will be incomplete, because not enough colors will be available. In that case the branch should stop there, and that "cut" branch should not be considered as a valid image.
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
ok thanks, I’ll work on that
Simone Russolillo (5790 points)
7 10 22
by (5.8k points)
I did the same!!!
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
I managed!! thanks a lot, your suggestion was very helpful!!!
gabrimat (5630 points)
2 4 25
by (5.6k points)
Happy to help.
KilianS (3590 points)
7 10 27
by (3.6k points)
Maybe try other ideas to approach the problem or rethinking it in a different way
z
zoe_matrullo (2090 points)
4 8 12
by (2.1k points)
very useful Kilian, thanks