Skip to content
Advertisement

Tag: backtracking

Sudoku backtracking solver bug

Ok, I’ve been scratching my head over this for a few hours now.. My goal was to code a sudoku solver that uses the backtracking method and to show the progress of the algorithm using pygame. For this I have to keep track of the events, I did it by appending them to a list named registre as is shown

knight tour iteration dead end

I am trying to implement knight tour using iteration method. I have already wrote a program using recursion and its working fine, now instead of recursion I am using iteration method with stack to implement knight tour, I have wrote the below code. and here I can not backtrack when I reached to a dead end, could you please check

Python Recursive Knight Tour

I’m trying to solve the knight tour algorithms with recursive backtracking method in python. The solution should be a matrix with 24 documented steps, but it only count up-to 5 steps. It doesn’t enter the recursive if statement. Answer The problem I see is that you set yNeu = x + pos[1] when you probably meant yNeu = y +

Knight’s tour backtracking

I am working on knight’s tour problem, and using backtracking algorithm. My code doesn’t produce the right output in the end it just repeats the last two entries over and over until n^2 -1 is not reached. This is my code. I am following this pseudocode http://www.wou.edu/~broegb/Cs345/KnightTour.pdf Answer You are settings visited[x][y]=True to true at the end of your algorithm.

Advertisement