Homework8 timeout test 7 and 8

a
angelaob (1190 points)
2 4 7
asked Dec 15, 2021 in HW8 by angelaob (1,190 points)
Guys, does anyone have any tips on how to avoid timeout on tests 7 and 8 when doing Homework8? I don't make all possible combinations of matrices at once, I use rules to allow combinations for rows and then for whole matrices, but still it takes quite a bit of time to finish these two tests.
161 views

2 Answers

gabriel.bustamante (2540 points)
3 5 20
answered Dec 15, 2021 by gabriel.bustamante (2,540 points)
If you aren't generating invalid images/nodes, then you may be calling other functions or methods more than needed. I realized that by profiling my code and it was simply a matter of storing the adjacent colors (which couldn't be picked for the next pixel) in a variable, instead of finding them for each child node
Nilats (3750 points)
7 14 29
answered Dec 15, 2021 by Nilats (3,750 points)
I think you did a lot of IF statements while checking for every combination of pixels between 2 rows without actually saving it.