Click here to Skip to main content
Licence 
First Posted 23 Apr 2007
Views 13,359
Downloads 292
Bookmarked 17 times

OO, Patterns and Sudoku Solver: Part 1

By | 23 Apr 2007 | Article
Sudoku solver using OO and patterns

Introduction

Primary focus of this blog entry is to demonstrate some of the power and flexibility offered by object orientated programming and design patterns. I will try to demonstrate these techniques and how to use them to solve complex problems like Sudoku.

I chose Sudoku rather than "Hello world" because it's fun, complex and seems like all the rage at the moment.

I have divided this entry in to multiple parts for the benefit of all.

Part 1 is for people who are only interested in acquiring a free Sudoku solver but don't necessarily give a damn about any of the programming techniques mentioned above.

Part 2 is for those who are interested in knowing the different techniques and logic used to solve the problem and some statistics and pros and cons of each method.

Part 3 will be for developers who are interested into the actual code walkthrough.

Well without any further babble I will describe the usage of the Sudoku solver.

The main screen of Sudoku Solver

Starting a new sudoku.

  1. Click on New menu item and it will pop up the following dialog box

  1. Choose the required grid size (9 X 9 is the standard size).
  2. Choose the solving strategy (quick solver possible vals is the fastest one).
  3. Tick the populate sample data check box if you want to populate a sample sudoku.
  4. Click OK button.

Now you will have a sudoku on the main screen as shown before.

Click on any blank cell you want to put a value in and it will show you a drop down box with values as shown below

Select a value and it will be placed in that cell.

Solving sudoku

Once you have finished placing all the values click on the Solve menu item to solve the sudoku.

The tool will solve any sudoku with a valid solution.

Restarting a Sudoku.

If you want to start a new sudoku based on the same grid and solving strategy then click on Reset menu else start over a new sudoku based on new options by clicking on New menu item again.

More...

You can also use this tool as a sudoku generator by placing just a couple of random values and clicking solve button.

Any grid bigger than 25 X 25 will be pure academic and with no fun value to the sudoku fans. So I have restricted it to that size through UI but for the benefit of the geeks the underlying code is made capable of solving sudoku of any grid size and is only restricted by the memory and processing power.

You can download the zip file for this sudoku solver at the end of this post. Please note that you will need .NET 2 runtime on your machine in order to run this programme. If you dont have it then you can download it from Microsoft website.

You can find the original article here

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

manojo



United Kingdom United Kingdom

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionUsefull? PinmemberWebtijn4:55 19 Jul '07  
Generalyou forgot the code =\ Pinmembersharpiesharpie7:20 23 Apr '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120517.1 | Last Updated 23 Apr 2007
Article Copyright 2007 by manojo
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid