The algorithm code of the Javascript Sudoku Automatic Filling Algorithm

Source: Internet
Author: User
Tags id3

A piece of code of the sudoku game forgot to use a search algorithm with the depth-first or breadth-first, and used some probability algorithms for improvement. In this case, I was afraid that I would accidentally delete it in a few years, g. JS seems to be included in another blog post, so I will not post it here.

At the beginning, this code had some reasons. The ancients said: the mountains are not famous for being high, and the water is not famous for being deep. There is no programming language class. Do not complain about how some languages are. The key issue is people. This code is faster than many native codes. If you don't believe it, you can verify it on your own.

I didn't want to write any more. I 'd like to take some notes, so that I don't forget it for a long time. I 'd like to comment on the tips for using this Code:


1. The JS Code uses clonenode (true) to clone DOM nodes (including subnodes) and create multiple nine cells, and render them with CSS to different effects;

2. object-oriented design structure; MVC Hierarchical Design


3. use the possible value exclusion method during inference. When it cannot be clearly inferred, start by finding the node with the least number of possible values (this is the key point), first press the stack to save the status, and then try to fill it, continue to deduce or guess until you get the answer, or roll back to eliminate the error value and continue to the other direction


<! -- Copy all right, barenx@163.com -->


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.