The logic requires taking different paths through the code, depending on tests along the way. Not having GOTOs in Python, I used functions to perform the tests and direct the program flow to other functions depending on the test results.
As written, the functions never return. They just point to other functions, which eventually result in an action (do nothing, turn a pump on, or turn a pump off). Before too many loops, the maximum recursion depth is exceeded.
If I could just clear the recursion cache at the end of each loop (if that's a thing), I'd have the issue resolved. Otherwise, I'm looking at a re-write using functions that all return as intended. I suppose I could do that but the little I've read about iterative vs recursive programming so far seems to me like an awfully complex work-around.
As-is, the loop simply starts at the first function. It calls one of two functions, depending. Those call other functions, etc.
Here's a link to a pdf of the logic flow diagram. The overall area is the main loop. The inner shaded area loops six times (once for each water pump) for each main loop.
https://www.dropbox.com/s/5vqyqnlap4dv8 ... w.pdf?dl=0
Here's a link to a pdf of the python code.
https://www.dropbox.com/s/ly0i46u1e6h3n ... y.pdf?dl=0
Any ideas on resolving the recursion depth error would be greatly appreciated.
Especially if they're easy.
Thanks.