Programming Sudoku - Wei-Meng Lee
ISBN: 1-59059-662-5
I’ve been a fan of sudoku for some time now, and have, since playing it the first time, been very interested in writing my own version for the .NETCF. I’ve been looking for a good reference on the subject for some time now. While at the South Carolina Code Camp 2.0 (I was a speaker on .NETCF game development), I saw this book (Apress sent it as giveaway…thanks for that), and flipped through a few pages. I was very impressed, so much in fact that I came home and ordered a copy via Amazon.
I was overall very pleased with this book. The first chapter was about sudoku, and the rules. The next ones were on building an interface on which to play and build. Later, it adds chapters on solving and puzzle generation. He included some excellent techniques I had never thought of using, like the Stack data type for tracking moves for redo/undo. His code, on a pure basis, is very clean and concise. I’ve adopted some of his basic approaches myself.
However, once I started reviewing it, I was a bit disappointed because the author really didn’t explain some key parts. For example, he uses a calculation to determine which sub-grid on the main grid a particular control exists (he uses label controls on his playing surface), but doesn’t give any explanation on why it works. It would have been an added bonus if he had. He also uses a string pattern to determine which numbers still exist in a row, column, or sub-grid. This approach was pretty slick, but he didn’t explain it. A beginner would likely be lost, and most definitely frustrated. Being completely honest, for the first half of the book, I could have just downloaded the source code and learned as much as the book taught me…other than the rules, of course.
Once I got into the puzzle-solving and game generation stuff, I was much happier because he goes into much more detail. The second half of this book is exactly what I wanted it for, and what anyone who wants to write a version of this wants to see. This book provides great examples and succinct explanations on how to generate a sudoku game yourself. Perhaps his thought was to rush through the hardcore coding part (the interface) and get to the true sudoku portion of the game. I couldn’t say, but it would have been a little nicer if he hadn’t rushed.
Ultimately, this is a good book from which you can learn a lot about sudoku. However, don’t expect to get the most out of it that you could if you are beginner.