计算机应用 ›› 2012, Vol. 32 ›› Issue (10): 2907-2910.DOI: 10.3724/SP.J.1087.2012.02907

• 人工智能 • 上一篇    下一篇

九宫数独的方程求解算法研究

肖华勇,程海礁,王月兴   

  1. 西北工业大学 理学院,西安710072
  • 收稿日期:2012-05-02 修回日期:2012-06-20 发布日期:2012-10-23 出版日期:2012-10-01
  • 通讯作者: 程海礁
  • 作者简介:肖华勇(1970-),男,重庆人,副教授,博士,主要研究方向:图像与金融时间序列;程海礁(1987-),女,辽宁本溪人,硕士研究生,主要研究方向:图像与金融时间序列;王月兴(1989-),男,河北石家庄人,主要研究方向:土木工程。

Research of equation solution algorithm about Sudoku puzzle

XIAO Hua-yong,CHENG Hai-jiao,WANG Yue-xing   

  1. School of Science, Northwestern Polytechnical University, Xi’an Shaanxi 710072, China
  • Received:2012-05-02 Revised:2012-06-20 Online:2012-10-23 Published:2012-10-01
  • Contact: CHENG Hai-jiao

摘要: 首先从数独的要求出发建立方程组,该方程组的解与原数独的解完全等价。然后由该方程组推导出一系列数学性质,包括删除候选数性质、唯一确定法性质、矛盾性质和不变性性质。并说明数独的人工推理规则包含在这些性质之中。最后由这些性质提出求解该方程组的算法,算法中用一个三维矩阵来表示待求解九宫数独的候选数矩阵,根据上述性质对候选数矩阵进行删减,直到能够解出此九宫数独。此算法能够求解出许多数独软件无法进行推理计算的数独难题,并用两个数独难题进行验证,说明了该算法的有效性。

关键词: 数独, 智力游戏, 推理性质, 唯一解, 算法性质

Abstract: It began with the requirement of Sudoku to establish the system of equations. The solution of equation system was equivalent to the original Sudoku. And many mathematical properties were derived from equation system, including candidates elimination techniques, unique determination property, contradiction property and invariance property. It also illustrated that the artificial deductive rules included these properties. Finally this paper proposed a algorithm which calculated the solution of equation system from these properties. The algorithm used a three-dimensional matrix to express the candidate matrix of an unsolved Sudoku, and according to the above properties the candidate matrix could be deleted until Sudoku was solved. The algorithm can resolve many difficult Sudoku puzzles. Two difficult Sudoku puzzles were demonstrated and solved easily with the method in this paper, which shows the method is very effective.

Key words: Sudoku, intelligent game, deductive character, unique solution, algorithm character

中图分类号: