syamsul_bachri87 wrote: > my teacher gave me a task to make sudoku game with C or pascal. > i don't understand the algorithm. > please help me!! >
Sudoku is a fun problem to solve using computer science. I have written a few programs both for generating and solving these puzzles, and am never quite satisfied. While there are some good techniques it is a very complex problem that has no easy solution. I recommend googling for sudoku programs. I cannot find it now but I did find a site that had a JavaScript solver. I converted it to C++ and used it, but it was incomplete. Regardless, it had enough algorithms that it could solve most medium difficulty puzzles. The core difficulty I saw was that unlike most problems I have encountered, sudoku is really a collection of problems and multiple algorithms that feed into each other. Programs look for specific patterns in the solution space and prune out impossibilities. The thing that really twists your brain is that to write a program that is provably correct you will need to combine these algorithms to look for even more complex patterns, and after a while it consumes so much memory and time it is ridiculous. Writing a sudoku generator is still on my todo list. Maybe I am a perfectionist but I am never happy with whatever solution I derive so I keep starting over. -- John Gaughan
