If you look at the code it does that by restricting each pot to the range of 10 - 1020.
No it doesn't. You always look at both pots. You must not look at two pots in the same iteration of the loop. You need to do what I said, what you are doing is not what I said.