Sep-17-2019, 05:13 PM
Hello everyone!
I'm a beginning programmer trying to write a program that solves sudoku grids using a recursive function (no, I don't want you to tell me how it's done).
I'm absolutely baffled by the way it behaves. I'm sure I must be missing something, but superficially it looks like the values of variables are getting fed back to the calling instance of the recursive function instead of being "forgotten" when the function returns.
When the program terminates, the grid at recursion depth = 2 is full of values generated by the program.
This is not normal. At depth= 2 the grid should contain at most 2 guesses/deductions by the program. All those values were generated at depths >> 2. So how the hell does the function "know" about them at depth=2. I just don't get it
I assume I must have done something really stupid...
I'm a beginning programmer trying to write a program that solves sudoku grids using a recursive function (no, I don't want you to tell me how it's done).
I'm absolutely baffled by the way it behaves. I'm sure I must be missing something, but superficially it looks like the values of variables are getting fed back to the calling instance of the recursive function instead of being "forgotten" when the function returns.
When the program terminates, the grid at recursion depth = 2 is full of values generated by the program.
This is not normal. At depth= 2 the grid should contain at most 2 guesses/deductions by the program. All those values were generated at depths >> 2. So how the hell does the function "know" about them at depth=2. I just don't get it
