Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It was a long time ago, but I think I randomly filled in numbers, save if numbers were already used in each row or column, then when it reached an impossible solution, it would work backwards one level, trying new numbers. If it ran out of numbers, it would go back two columns, and try a new number.

I doubt it was anything fancy. At the time, it bent my mind into knots. Programming is a wonderful mind trainer.



For those who want to see how a backtracking algorithm would work. Computerphile walked through a python approach (11 lines) a few months ago: https://www.youtube.com/watch?v=G_UYXzGuqvM


That brought back some memories...that was pretty much what I did.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: