Watch that tango!

Wife: Dancing lynx? That would be really cute. Of course, they’d have to get fitted for special little shoes, if they were going to be, like, tap-dancing or anything. Still…

Me: It’s links. With an “i”.

Wife: Yes, I know that, but it would be much cuter if it was a bobcat.

Me: And less useful.


Yesterday I implemented the Dancing Links algorithm. I first heard about it a few years ago after I wrote a simple Sudoku game. I didn’t write a version back then because I had tired of writing Yet Another Sudoku Game, and my game languished and was forgotten. This time, however, my current project could benefit from it.

It is a surprisingly easy algorithm to write. With the way people talk about it — and with some of the implementations I have seen — I was expecting it to be a long, drawn out battle to get it done. Not so! It was the work of maybe a few hours to read about it and get it completed. Now I just need to see if it will work for my purposes. 😛

3 Responses to Watch that tango!

  1. Angel says:

    If possible obtain the code for Sudoku with Dancing Link algoritm?.

    Thanks a lot

  2. Graeme says:

    I implemented the dancing links algorithm for a different project, not for a Sudoku game. The source of my implementation is available here, along with some sample code that recreates Donald Knuth’s example matrix and solution.

    However, writing another Sudoku game does sound like a nice break from my current project, so I might just do that.

  3. angel says:

    Thanks a lot.