Skip to main content
  • Book
  • © 2015

Sudoku Programming with C

Apress

Authors:

  • Sudoku Programming with C teaches you how to write computer programs to solve and generate Sudoku puzzles.

  • In this book, you will also find an explanation of all solving strategies, and the code to implement them.

  • This is a practical book that will provide you with everything you need to write your own books of Sudoku Classic and Samurai puzzles.

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access

This is a preview of subscription content, log in via an institution to check for access.

Table of contents (20 chapters)

  1. Front Matter

    Pages i-xvi
  2. Modeling a Sudoku Puzzle in C

    • Giulio Zambon
    Pages 1-8
  3. The Strategies

    • Giulio Zambon
    Pages 9-25
  4. The Solver Program

    • Giulio Zambon
    Pages 27-50
  5. Implementing “Unique”

    • Giulio Zambon
    Pages 51-55
  6. Implementing “Naked” Strategies

    • Giulio Zambon
    Pages 57-72
  7. Implementing “Hidden” Strategies

    • Giulio Zambon
    Pages 73-82
  8. Implementing “Box-Line”

    • Giulio Zambon
    Pages 83-87
  9. Implementing “Pointing Line”

    • Giulio Zambon
    Pages 89-93
  10. Implementing “Lines” Strategies

    • Giulio Zambon
    Pages 95-103
  11. Implementing “Y-wing”

    • Giulio Zambon
    Pages 105-119
  12. Implementing “XY-chain”

    • Giulio Zambon
    Pages 121-131
  13. Implementing “Rectangle”

    • Giulio Zambon
    Pages 133-148
  14. Implementing “Backtrack”

    • Giulio Zambon
    Pages 149-163
  15. Solving Thousands of Puzzles

    • Giulio Zambon
    Pages 165-169
  16. Generating Sudokus

    • Giulio Zambon
    Pages 171-210
  17. Puzzle Statistics and More Puzzles

    • Giulio Zambon
    Pages 211-226
  18. Special Sudokus

    • Giulio Zambon
    Pages 227-235
  19. Multi-Grid Sudokus

    • Giulio Zambon
    Pages 237-266
  20. Development Environment

    • Giulio Zambon
    Pages 267-275

About this book

Sudoku Programming with C teaches you how to write computer programs to solve and generate Sudoku puzzles. This is a practical book that will provide you with everything you need to write your own books of Sudoku Classic and Samurai puzzles. But be warned: after reading it, you'll discover that the puzzles in your local paper are not so challenging after all!

We like Sudokus because they test our capacity to recognize and interpret patterns. But how are the clues generated? Where do those quasi-symmetrical configurations come from? When the author explored the Web to find out, he discovered that there were many sites that explained how to solve Sudokus, but none that told him how create them. He also saw many sites and apps to play Sudoku, but, perhaps not surprising, no indication of how they worked.

So, he had to develop his own applications in order to find out. And, from the very start, he decided that he would publish the code for anyone else to use and perhaps tinker with, but the author wrote it in such a way that also lets readers with limited knowledge of programming techniques understand it. In fact, you could decide to start generating thousands of puzzles almost immediately, and go through the explanations of algorithms and techniques later, a bit at a time. The author chose to write the application in ‘plain old C’ because he wanted to make the code accessible to as many people as possible.

In this book, you will find an explanation of all solving strategies, and the code to implement them. Writing the Solver application was more difficult than writing the Generator, because it required designing and implementing each strategy separately. However, the author wanted to include a solving program capable of listing the strategies necessary to solve any particular puzzle. He also wanted to check whether a puzzle was solvable analytically, without any guessing.

This book includes the full listings of both the Generator and the Solver, and explanations of all C modules, with walk-throughs and examples.

About the author

Giulio Zambon s first love was physics, but he decided to dedicate himself to software development more than 30 years ago: back when computers were still made of transistors and core memories, programs were punched on cards, and Fortran only had arithmetic IFs. Over the years, he learned a dozen computer languages and worked with all sorts of operating systems. His specific interests were in telecom and real-time systems, and he managed several projects to their successful completion. In 2001 Giulio founded his own company offering computer telephony integration (CTI) services, and he used JSP and Tomcat exclusively to develop the web side of the service platform. Back in Australia after many years in Europe, he now dedicates himself to writing software to generate and solve numeric puzzles. His web site, http://zambon.com.au/, is written in JSP on his dedicated server, which, unsurprisingly, runs Tomcat!

Bibliographic Information

Buy it now

Buying options

eBook USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Other ways to access