Personal Project - Sudoku

Personal project - Sudoku first post a Github address: https://github.com/SeewoLT/Seewo_Project and then attach a PSP table:


Personal Software Process Stages Estimated time (minutes) Actual time (minutes)
plan 30 40
Needs analysis (including learning new technologies) 0 0
Generate design documentation 0 0
Design Review 0 0
code specification 0 0
specific design 300 360
specific code 600 530
code review 50 30
test 200 230
testing report 60 50
Summarize improvements 60 50
total 1300 1290
 

Problem- solving ideas: I am ashamed to say that, in fact, the editor has no ideas. All of them are based on the experience sharing of online friends to reluctantly plan a replacement path. This personal project has two requirements, one is to generate the end of Sudoku, and the other is to solve the Sudoku and save the solved Sudoku to the program root directory. The first requirement: It can be known that for any full permutation of 1 to 9, a new ending can be obtained by moving a fixed number of columns to the left or right. So there are 9! kinds of endgames. In fact, it can also be seen that for any Sudoku end 1~3 lines, arbitrarily switching the order of these three lines is also a Sudoku end, the same is true for 4~6 lines and 7~9 lines, and the same for columns. Through this discovery, it can be increased on the basis of the previous one, and finally it can exceed 1E6. The second requirement: In order to prevent too many brain cells from dying, I solved this problem directly by using the DFS violent search method...










DFS part of the code
int Hang = count / 9;
int Lie = count % 9;
if (Plate[Hang][Lie] == 0)
{
for(int i = 1; i <= 9; i++)
if (CHECK(i, Hang, Lie))
{
Plate[Hang][Lie] = i;
SOLVE(count + 1);
} Plate[Hang][Lie] = 0; } else SOLVE(count + 1);



-------------------



Summary
这里还是要惭愧地说一下,我到现在还不太会弄VS性能分析工具,所以也就没有再贴代码的性能图示了……

然后再说说我不足的地方,首先我对文档、模块的建立概念完全不清晰,我所有的功能函数都写在一个文件里,其实这与懒脱不了干系……

接着我也了解到一些网友在第二个要求:解数独运用了效率更高的函数功能DLX,将解数独转化成了一个精确覆盖问题,并用Dancing Links X即DLX算法来解决精确覆盖问题,但从来没有仔细揣摩揣摩去实现这项功能。

其实总结起来就是这两个问题,还是有很多遗憾的地方和提升空间。

心路历程和收获
说实话,刚开始写个人项目的时候,那真是摸不着头脑。没办法,最后都是需要朋友们的帮助才有思绪,把一个个“难题”给弄通了。其实与其说是朋友们的帮助,还不如说我网上收资料一个个翻出来呢……
说真心话,我一开始就被系统输入变量参数如何操作给弄懵了,还有如何运用getopt函数也是弄得我焦头烂额。

最后的最后我想总结三点收获:
1.不要拖。
2.不畏难。
3.不停学。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324874096&siteId=291194637