Sabtu, 05 Juni 2010

sudoku matlab

Hi,another week another task,huh -_-
This time,we’d like to present, our group’s task about learning Matlab. As Mr Priyatmadi said,he’d like to see some presentation about matlab,not only about PID thing but also something more than it ^^
My group wanted to show everyone that matlab is not only about PID,but it also can be used to solve something funnier than PID. That is SUDOKU.
Anyone knew what Sudoku is? Well,Sudoku is a game originated from America (if im not mistaken) its purpose is to fill blank spot in its region. There are many types of Sudoku,like:2x2; 3x3,9x9,and 81x81. Our group’s idea is simple,if matlab is said could be used to solve every engineering’s task,why don’t we used it to solve Sudoku @-@
Here it goes
Solving Sudoku is one of my hobby,so when asked for matlab presentation I’d like to perform Sudoku solver (and happily my friends agree with that). There were some algorithm that commonly used in sudoku solver:
1. Scanning
We scan entirely grid 9x9,and find which row is scannable, lets say there were some row composed by number like this:
1 4 5 6 7 8 9 0 3

It is obvious that blank spot must be filled with 2

2. Quad scanning
Aside with scanning,quad scanning offer reliable and faster solving process,we scan small grid (3x3) first and then another sub grid
Here is the example:
0 3 4
1 2 5
7 0 9

Well,there are 2 possibilities, 6 and 8, which number is correct later discussed,in combining step from other 3x3 grid.

3. Recursive tracker
Let's get back to solving the hard sudokus, the ones which require an analytical/guessing approach. First, how do we distinguish such a problem from one which can be scan-solved? This may be a hard question to answer theoretically (is it the halting problem?) but in practice it's easy - if the Quad Scan / Matrix Scan combo runs its course in a loop until it produces no further improvement, and if at this point the matrix still contains blank slots indicated by 0s, we know it's time for the harder stuff.
sounds cool,isn’t it? Wait,we haven’t introduce a cooler one yet; :p
4. Brute force
Think that you are lucky enough? Then try brute force,no brain just brawn :p. and it is solved.LOL

5. Smart force ^^

Development of brute force,still guessing but row scanning and quad scanning were added. Way to go Sudoku master :p

That was the step that is used to solve Sudoku,the final one must be combining all that step into matlab program. You can download the syntax and our presentation here and here.

Here are some screenshot from the Sudoku solver program













And this is the result,voila 9x9 solved :p

Tidak ada komentar:

Posting Komentar