for x1 in range(1, 10):
for x2 in range(1, 10):
if x2 in [x1]:
continue
for x3 in range(1, 10):
if x3 in [x1, x2]:
continue
looks like backtracking to me. Specifically, the "continue" statement is that "jump back" that prunes invalid search sub-tree. Though, the constrains are expressed as predicates here.
But even in a code where constrains are built into the loop, it also can be called backtracking, since we have our target predicate "is_valid(square)". The search tree is trivial in this case, though. It's just a root and leaves.
In other words, I didn't quite understand the distinction that you were talking about.
But even in a code where constrains are built into the loop, it also can be called backtracking, since we have our target predicate "is_valid(square)". The search tree is trivial in this case, though. It's just a root and leaves.
In other words, I didn't quite understand the distinction that you were talking about.