I want N number of nested for loops, the last for loop should have number += 1
while everything else should have push(move)
and should end with a undo()
I saw a way to solve in another language that said something about recursion.
The following example if for 5 for loops:
number = 0
for move in all_legal_moves():
push(move)
for move2 in all_legal_moves():
push(move2)
for move3 in all_legal_moves():
push(move3)
for move4 in all_legal_moves():
push(move4)
for move5 in all_legal_moves():
number += 1
undo()
undo()
undo()
undo()
I want a function that takes the depth (the number of nested for loops (N)) and return number
. I would prefer an answer that doesn't imports any libraries