Borrar filtros
Borrar filtros

Sudoku Update and Solve Files

5 visualizaciones (últimos 30 días)
Katrina
Katrina el 12 de Nov. de 2015
Respondida: Madhu Govindarajan el 12 de Nov. de 2015
I am creating a program that solves Sudoku puzzles and I need help creating two functions. I have a function that creates a "cantbe" matrix that shows what can't go in each square based off what is already in the rows, columns, and subsquares so for example (i,j)=[1 2 3 5 0 7 8 9] means that the number that belongs in that square is 6. First, I need an update function that updates the puzzle for each of the rows and columns with only one zero with the number that belongs. I'm struggling with how to start that function. I assume I'd use some kind of loop to flag and then fill in the puzzle but no idea what exactly to use. Second, for the solve file I need it to as the tile suggests solve the puzzle by calling all the different function files I have so far. So it would read the original puzzle, calls my cantbe function, calls my update function, compares the state of the Sudoku puzzle before the update function is called and after it is called, if they are the same it exits, but if they are different it calls cantbe and update again and finally prints the final state of the puzzle. This I know would use a while loop for when the puzzles before and after are different to call the cantbe and update function, but I'm not 100% sure how to format that.
Any tips for either would be greatly appreciated. Thank you!

Respuestas (1)

Madhu Govindarajan
Madhu Govindarajan el 12 de Nov. de 2015

Categorías

Más información sobre Sudoku en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by