Upcoming SlideShare
×

# Intelligent Sudoku Solver

4,549 views

Published on

Intelligent Sudoku Solver:
 Area: Intelligent Algorithm
 Duration: June 2012- June 2013
 Abstract: Sudoku solving algorithm which is more efficient and faster than the common Sudoku algorithms, based on the pattern identification.
 Application: Its major application would be in Steganography, when difficult Sudoku puzzles can be solved quickly.

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
4,549
On SlideShare
0
From Embeds
0
Number of Embeds
16
Actions
Shares
0
211
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Intelligent Sudoku Solver

1. 1. INTELLIGENT SUDOKU SOLVER Under the Guidance of Dr. SUNIL PATEKAR Group Members: 1. Amrish Jhaveri 2. Rohit Iyer 3. Krutika Parab UNIVERSITY OF MUMBAI 2012-2013
2. 2. CONTENTS I. INTRODUCTION II. AIMS & OBJECTIVES III. PROBLEM STATEMENT IV. SCOPE V. PROPOSED SYSTEM VI. METHODOLOGY – Expert System VII. BACKTRACKING ALGORITHM VIII. PATTERNS IX. DESIGN – Flow Chart 2 INTELLIGENT SUDOKU SOLVER X. FEATURES XI. CODE SNIPPETS
3. 3. I. INTRODUCTION  Rule: Fill a given grid(9x9) with the numbers 1 to 9, so that every column, row, and 3x3 box the numbers 1 to 9, keeping in mind that the same number doesn’t repeat in that particular row, column or the 3x3 box. 3 INTELLIGENT SUDOKU SOLVER
4. 4. II. AIMS & OBJECTIVES  To successfully implement a novel approach to solve computationally intensive problems like Sudoku.  To solve the classical Sudoku puzzle in a much more efficient way than a conventional Brute Force and Backtracking approach. 4 INTELLIGENT SUDOKU SOLVER
5. 5. III. PROBLEM STATEMENT  Our job is to place a number into every empty box so that each row across, each column down, and each small 9-box square within the large square (there are 9 of these) will contain each number from 1 through 9. Remember that no number may appear more than once in any row across, any column down, or within any small 9-box square. The numbers will be filled with the help of pattern matching. 5 INTELLIGENT SUDOKU SOLVER
6. 6. IV. SCOPE  Our project aims at solving Sudoku using pattern matching.  Assumptions: • Fixed Grid Size: 9 x 9 • Fixed Symbols: 1-9 • Limitations on the number of patterns implemented. 6 INTELLIGENT SUDOKU SOLVER
7. 7. V. PROPOSED SYSTEM  Our project uses five main modules: 1. Reading the input from file. 2. Search for patterns. 3. Provide solution. 4. Solve by Backtracking. 5. Compare the run-time. 7 INTELLIGENT SUDOKU SOLVER
8. 8. VI. EXPERT SYSTEM  In Artificial Intelligence, an Expert System is a computer system that emulates the decision-making ability of a human expert.  It consists of a rule-base (permanent data), an inference engine (process), and a workspace or working memory (temporary data). Not part of the basic reasoning process, but essential to applications, is the user interface. 8 INTELLIGENT SUDOKU SOLVER
9. 9. VI. EXPERT SYSTEM 9 INTELLIGENT SUDOKU SOLVER
10. 10. VI. EXPERT SYSTEM  In our approach the components of expert system are as follows: • Client interface is a command line interface or GUI. • Knowledge base are set of data structures stored which contain prior information needed to proceed. • Rule translator is a function which translates the rule from human understandable form to machine understandable form. For e.g. A function called HiddenSingles() may translate the rule in such a way that the Rule Engine (in our case – our main program)understands. • Knowledge base editor would be a simple text editor which can change/add the built-in rules in the code. • Rule Engine is another function which checks every pattern if it matches a rule or not. 10 INTELLIGENT SUDOKU SOLVER
11. 11. VII. BACKTRACKING ALGORITHM  We basically check that the same number is not present in current row, current column and current 3X3 sub grid. After checking for safety, we assign the number, and recursively check whether this assignment leads to a solution or not. If the assignment doesn’t lead to a solution, then we try next number for current empty cell. And if none of number (1 to 9) lead to solution, we return false. 11 INTELLIGENT SUDOKU SOLVER
12. 12. VIII. PATTERNS  NAKED SINGLE  Any cells which have only one candidate can safely be assigned that value.  It is very important whenever a value is assigned to a cell, that this value is also excluded as a candidate from all other blank cells sharing the same row, column and box 12 INTELLIGENT SUDOKU SOLVER
13. 13.  NAKED SINGLE 13 INTELLIGENT SUDOKU SOLVER VIII. PATTERNS
14. 14.  NAKED PAIR  A Naked Pair (also known as a Conjugate Pair) is a set of two candidate numbers sited in two cells that belong to at least one unit in common. That is they reside in the same row, box or column. 14 INTELLIGENT SUDOKU SOLVER VIII. PATTERNS
15. 15. IX. PATTERNS  NAKED PAIR 15 INTELLIGENT SUDOKU SOLVER
16. 16.  HIDDEN SINGLE  Very frequently, there is only one candidate for a given row, column or box, but it is hidden among other candidates.  In the example on the right, the candidate 6 is only found in the middle right cell of the 3x3 box. Since every box must have a 6, this cell must be that 6. 16 INTELLIGENT SUDOKU SOLVER VIII. PATTERNS
17. 17.  Locked Candidates -I  Sometimes a candidate within a box is restricted to one row or column. Since one of these cells must contain that specific candidate, the candidate can safely be excluded from the remaining cells in that row or column outside of the box. VIII. PATTERNS INTELLIGENT SUDOKU SOLVER
18. 18.  Locked Candidates – I Example In the example above, the right box only has candidate 2's in its bottom row. Since, one of those cells must be a 2, no cells in that row outside that box can be a 2. Therefore 2 can be excluded as a candidate from the highlighted cells. VIII. PATTERNS INTELLIGENT SUDOKU SOLVER
19. 19.  Locked Candidates – II  Sometimes a candidate within a row or column is restricted to one box. Since one of these cells must contain that specific candidate, the candidate can safely be excluded from the remaining cells in the box. VIII. PATTERNS INTELLIGENT SUDOKU SOLVER
20. 20.  Locked Candidates – II Example In the example on the right, the left column has candidate 9's only in the middle box. Therefore, since one of these cells must be a 9 (otherwise the column would be without a 9), 9's can safely be excluded from all cells in this middle box except those in the left column. VIII. PATTERNS INTELLIGENT SUDOKU SOLVER
21. 21. IX. DESIGN (FLOW CHART) 21 INTELLIGENT SUDOKU SOLVER Yes No Yes No Reading Sudoku from a file Search patterns Take necessary action Solved? Print Solution Stop Start Make a smart guess Found
22. 22. X. FEATURES  A Java based Sudoku Solver  Benchmarked at solving 49151 random puzzles within 16159 milliseconds.  Used optimized pattern detection strategies like Naked Singles, Hidden  Singles and Locked Candidates to aid solving.  Reviewed the performance of our solver with existing Sudoku Solvers in the world.  Comprehensive statistical and graphical results to record the solver's performance using JFreeChart API. INTELLIGENT SUDOKU SOLVER
23. 23. We conducted a test on some of the world’s popular and fastest Sudoku solvers. The test consisted of solving 1000 very hard puzzles. We fed the same set of 1000 puzzles to all solvers and result is here…. INTELLIGENT SUDOKU SOLVER
24. 24. OUR OPPONENT…. … a puzzle took 15.5 billion nanoseconds!!! INTELLIGENT SUDOKU SOLVER
25. 25. OUR INTELLIGENT SOLVER…. … a puzzle took 25 million nanoseconds!!! INTELLIGENT SUDOKU SOLVER
26. 26. NO COMPARISON!!! … can’t compare millions with billions!!! INTELLIGENT SUDOKU SOLVER
27. 27. NO COMPARISON!!! … can’t compare millions with billions!!! INTELLIGENT SUDOKU SOLVER
28. 28. XI. CODE SNIPPETS INTELLIGENT SUDOKU SOLVER 28
29. 29. INTELLIGENT SUDOKU SOLVER
30. 30. XI. CODE SNIPPETS INTELLIGENT SUDOKU SOLVER 30
31. 31. XI. CODE SNIPPETS INTELLIGENT SUDOKU SOLVER 32
32. 32. Our paper titled - has been reviewed and accepted by International Journal of Scientific Research and Publications and will be published in Volume 3, Issue 5, May 2013. INTELLIGENT SUDOKU SOLVER
33. 33. THANK YOU  We would like to thank our project guide Dr. Sunil Patekar & Prof Mahesh Bhave for helping us identify the flaws and correcting them. We would also like to thank Assistant Professors Rugved Deolekar and Aman Mahadeshwar for their inputs. 35 INTELLIGENT SUDOKU SOLVER