编程设计帮助 - 如何构建数独解算程序? [英] Programming Design Help - How to Structure a Sudoku Solver program?

查看:135
本文介绍了编程设计帮助 - 如何构建数独解算程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试用Java(也许是Python)创建一个数独解算器程序。
我只是想知道我应该如何构造这个...



我创建一个类,并使每个框成为该类的对象(9x9 = 81个对象)?如果是的话,我如何控制所有的对象 - 换句话说,我如何让它们都在类中调用某种方法?



我只是创建函数实际上,即使我可以创建多个函数,我如何控制所有的数据,而不是仅仅使用多D数组来控制所有的数字?



如果我要让每个盒子成为一个对象,那么对象?



谢谢。

解决方案>

如果您对解决方案的演练感兴趣,Peter Norvig写了一篇关于 Sudoku求解器在Python中实现。


I'm trying to create a sudoku solver program in Java (maybe Python). I'm just wondering how I should go about structuring this...

Do I create a class and make each box a object of that class (9x9=81 objects)? If yes, how do I control all the objects - in other words, how do I make them all call a certain method in the class?

Do I just create functions to calculate and just control all the numbers in there with something like an multi-D array?

And actually, even if I could just create multiple functions, how would I control all the objects if I were to make each box an object?

Thanks.

解决方案

If you're stuck and are interested in a walkthrough of a solution, Peter Norvig wrote an article on a Sudoku solver implemented in Python.

这篇关于编程设计帮助 - 如何构建数独解算程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆