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
I’m still ashamed to say that I still don’t know how to use VS performance analysis tools, so I don’t have any performance charts for pasting code... Then I’ll talk about my shortcomings. The concept of establishment is completely unclear. All my functions are written in one file. In fact, this has nothing to do with laziness... Then I also learned that some netizens are asking for the second: Solving Sudoku uses more efficient functions DLX converts the solution of Sudoku into an exact coverage problem, and uses Dancing Links X, the DLX algorithm, to solve the exact coverage problem, but has never carefully figured out to realize this function. In fact, to sum up these two problems, there are still many regrets and room for improvement.







To be honest , when I first started writing a personal project, it was really confusing. There is no way, in the end, I need the help of my friends to get my thoughts and solve the "difficulties" one by one. In fact, it's not so much the help of my friends, it's better to say that I have collected information on the Internet and turned it out one by one... To be honest, I was confused by how the system input variable parameters and how to use the getopt function. Makes me battered. In the end, I would like to summarize three gains: 1. Don't delay. 2. Not afraid of difficulties. 3. Keep learning.







Guess you like

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