Sudoku Programming with C (Paperback)
暫譯: 使用 C 語言的數獨程式設計 (平裝本)

Giulio Zambon

  • 出版商: Apress
  • 出版日期: 2015-03-11
  • 售價: $2,470
  • 貴賓價: 9.5$2,347
  • 語言: 英文
  • 頁數: 300
  • 裝訂: Paperback
  • ISBN: 1484209966
  • ISBN-13: 9781484209967
  • 相關分類: C 程式語言
  • 海外代購書籍(需單獨結帳)

相關主題

商品描述

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.

What you’ll learn

  • How to model a Sudoku puzzle in C
  • What are the strategies in the main program as well as in the utilities needed
  • How to implement numerous strategies and techniques for Sudoku generating and solving
  • How to solve puzzles
  • How to generate Sudokus
  • What are Samurai Sudokus and how to solve them

Who this book is for

This book is for readers with limited knowledge of programming techniques. The C code is significant and so it is best to have some prior knowledge of C.

Table of Contents

1. Modelling a Sudoku Puzzle in C

2. The Strategies

3. Main Program and Utilities

4. Implementing 'unique'

5. Implementing 'naked' Strategies

6. Implementing 'hidden' Strategies

7. Implementing 'box-line'

8. Implementing 'pointing-line'

9. Implementing 'lines' Strategies

10. Implementing 'Y-wing'

11. Implementing 'XY-chain'

12. Implementing 'rectangle'

13. Implementing 'backtrack'

14. Solving Thousands of Puzzles

15. Generating Sudokus

16. Puzzle Statistics

17. Puzzles

18. Samurai Sudokus

A. Eclipse CDT

B. Puzzle Solutions

C. Abbreviations and Acronyms

D. Strategy Index

商品描述(中文翻譯)

使用 C 語言的數獨程式設計》教你如何編寫電腦程式來解決和生成數獨謎題。這是一本實用的書籍,將提供你所需的一切,以編寫自己的數獨經典和武士數獨書籍。但要注意:在閱讀完這本書後,你會發現當地報紙上的謎題其實並沒有那麼具挑戰性!

我們喜歡數獨,因為它們測試我們識別和解釋模式的能力。但這些線索是如何生成的?那些準對稱的配置又是從哪裡來的?當作者在網路上探索以找出答案時,他發現有許多網站解釋如何解決數獨,但沒有任何網站告訴他如何創建它們。他還看到許多網站和應用程式可以玩數獨,但或許不意外的是,沒有任何指示它們是如何運作的。

因此,他不得不開發自己的應用程式來找出答案。從一開始,他就決定將代碼公開,讓其他人可以使用並進行修改,但作者以一種方式編寫代碼,使得對程式設計技術知識有限的讀者也能理解。事實上,你幾乎可以立即開始生成數以千計的謎題,然後再逐步了解算法和技術的解釋。作者選擇使用「傳統的 C 語言」來編寫應用程式,因為他希望讓代碼對盡可能多的人可及。

在這本書中,你將找到所有解決策略的解釋,以及實現它們的代碼。編寫解決器應用程式比編寫生成器更困難,因為這需要單獨設計和實現每個策略。然而,作者希望包含一個能夠列出解決任何特定謎題所需策略的解決程式。他還希望檢查一個謎題是否可以在不進行任何猜測的情況下進行解析。

這本書包括生成器和解決器的完整代碼清單,以及所有 C 模組的解釋,並附有逐步說明和範例。

你將學到什麼



  • 如何在 C 語言中建模數獨謎題

  • 主要程式和所需工具中的策略是什麼

  • 如何實現多種數獨生成和解決的策略和技術

  • 如何解決謎題

  • 如何生成數獨

  • 什麼是武士數獨以及如何解決它們

本書適合誰


本書適合對程式設計技術知識有限的讀者。C 語言的代碼相對重要,因此最好具備一些 C 語言的先前知識。

目錄


1. 在 C 語言中建模數獨謎題


2. 策略


3. 主要程式和工具


4. 實現「唯一」


5. 實現「裸」策略


6. 實現「隱藏」策略


7. 實現「盒子-行」


8. 實現「指向-行」


9. 實現「行」策略


10. 實現「Y-翼」


11. 實現「XY-鏈」


12. 實現「矩形」


13. 實現「回溯」


14. 解決數以千計的謎題


15. 生成數獨


16. 謎題統計


17. 謎題


18. 武士數獨


A. Eclipse CDT


B. 謎題解答


C. 縮寫和首字母縮略詞


D. 策略索引