Algorithm for Solving Easy Sudoku Puzzles: Pick an empty cell to begin. List the numbers (1 through 9) that the cell could still be, by eliminating all the numbers in this cell's 3x3 section, and all...


MATLAB Language


Algorithm for Solving Easy Sudoku Puzzles:<br>Pick an empty cell to begin.<br>List the numbers (1 through 9) that the cell could still be, by eliminating all the numbers in this cell's 3x3 section, and all the numbers in this cell's row, and all the numbers in this cell's<br>column.<br>Repeat that process for every empty cell on the board.<br>Hint: you will need a different kind of variable (not a matrix) to store these possibilities for each location.<br>At the end of this process, the value of a few cells will be completely known, i.e., all other eight numbers have been eliminated as possibilities.<br>So now yo ca<br>go back and re-process all the unknown cells on the board with this new information.<br>At the end of that re-processing, if there are any cells that are now completely known, that weren't completely known before, then you can re-process again.<br>That re-processing can continue again and again until there are no longer any new completely known values.<br>If the all of the values on the board are completely determined, congratulations! You're solved an easy Sudoku puzzle!<br>For more difficult Sudoko puzzles, some guessing and checking would be needed, which is beyond the scope of this lab. Your program only needs to work for easy sudoku puzzles, for<br>which no guesses are needed.<br>Housekeeping Commands:<br>2<br>clear<br>3<br>clc<br>Test Cases:<br>% Test Case 1 (where a Ø represents an unknown value)<br>M= [5 3 0 6 7 8 9 1 2;<br>0 0 2 1 9 5 3 0 8;<br>1 9 8 3 4 2 0 6 7;<br>8 0 9 7 6 1 4 2 3;<br>4 2 6 8 0 379 0;<br>0 0 3 9 2 4 8 0 6;<br>0 6 1 5 3 7 2 8 4;<br>2 8 7 4 1 9 6 0 5;<br>3 4 5 2 8 6 1 7 0]<br>% Test Case 1 solution:<br>% M= [534 6 7 8 9 1 2;<br>6 7 2 19 5 3 4 8;<br>1 9 8 3 4 2 5 6 7;<br>5<br>7<br>8<br>9<br>10<br>11<br>12<br>13<br>14<br>15<br>16<br>17<br>UTF-8<br>

Extracted text: Algorithm for Solving Easy Sudoku Puzzles: Pick an empty cell to begin. List the numbers (1 through 9) that the cell could still be, by eliminating all the numbers in this cell's 3x3 section, and all the numbers in this cell's row, and all the numbers in this cell's column. Repeat that process for every empty cell on the board. Hint: you will need a different kind of variable (not a matrix) to store these possibilities for each location. At the end of this process, the value of a few cells will be completely known, i.e., all other eight numbers have been eliminated as possibilities. So now yo ca go back and re-process all the unknown cells on the board with this new information. At the end of that re-processing, if there are any cells that are now completely known, that weren't completely known before, then you can re-process again. That re-processing can continue again and again until there are no longer any new completely known values. If the all of the values on the board are completely determined, congratulations! You're solved an easy Sudoku puzzle! For more difficult Sudoko puzzles, some guessing and checking would be needed, which is beyond the scope of this lab. Your program only needs to work for easy sudoku puzzles, for which no guesses are needed. Housekeeping Commands: 2 clear 3 clc Test Cases: % Test Case 1 (where a Ø represents an unknown value) M= [5 3 0 6 7 8 9 1 2; 0 0 2 1 9 5 3 0 8; 1 9 8 3 4 2 0 6 7; 8 0 9 7 6 1 4 2 3; 4 2 6 8 0 379 0; 0 0 3 9 2 4 8 0 6; 0 6 1 5 3 7 2 8 4; 2 8 7 4 1 9 6 0 5; 3 4 5 2 8 6 1 7 0] % Test Case 1 solution: % M= [534 6 7 8 9 1 2; 6 7 2 19 5 3 4 8; 1 9 8 3 4 2 5 6 7; 5 7 8 9 10 11 12 13 14 15 16 17 UTF-8
% Test Case 1 (where a 0 represents an unknown value)<br>M= [5 3 0 6 7 8 9 1 2;<br>0 0 2 1 9 5 3 0 8;<br>19 8 3 4 2 0 6 7;<br>8 0 9 7 6 1 4 2 3;<br>4 2 6 8 0 3 7 9 0;<br>0 0 3 9 2 4 8 0 6;<br>0 6 1 5 3 7 2 8 4;<br>2 8 7 4 1 9 6 0 5;<br>4<br>5<br>7<br>8<br>10<br>11<br>12<br>3 4 5 2 8 6 1 7 0]<br>% Test Case 1 solution:<br>% M= [5 3 4 6 7 8 9 1 2;<br>6 7 2 19 5 3 4 8;<br>1 9 8 3 4 2 5 6 7;<br>8 5 9 76 1 4 2 3;<br>4 2 6 85 37 9 1;<br>7 1 3 9 2 4 8 5 6;<br>9 6 1 5 3 7 2 8 4;<br>9 6 3 5;<br>3 4 5 2 8 6 1 7 9]<br>13<br>14<br>15<br>16<br>17<br>19<br>20<br>21<br>22<br>2 8 7 4 1<br>23<br>24<br>% Test Case 2 (where a 0 represents an unknown<br>% M= [0 0 5 269 7 8 1;<br>6 8 0 0 7 1 4 9 3;<br>1 9 7 8 0 0 5 6 2;<br>25<br>value)<br>26<br>27<br>28<br>29<br>8 26 19 5 0 0 7;<br>3 7 4 6 8 2 9 0 0;<br>9 5 17 4 3 0 0 8;<br>5 19 3 0 0 8 7 4;<br>1 3 6;<br>0 0 3 4 1 8 2 5 9]<br>% Test Case 2 solution:<br>% M= [4 3 5 2 6 9 7 8 1;<br>6 8 2 5 7 1 4 9 3;<br>1 9 7 8 3 4 5 6 2;<br>8 2 6 19 5 3 4 7;<br>3 7 4 6 8 2 9 1 5;<br>9 5 1 7 4 3 6 2 8;<br>5 1 9 3 2 6 8 7 4;<br>30<br>31<br>32<br>33<br>2 4 0 0 5<br>34<br>35<br>36<br>37<br>38<br>39<br>40<br>41<br>42<br>2 4 8 9 5 7 1 3 6;<br>7 6 3 4 1 8 2 59]<br>43<br>44<br>UTF-8<br>O N00<br>

Extracted text: % Test Case 1 (where a 0 represents an unknown value) M= [5 3 0 6 7 8 9 1 2; 0 0 2 1 9 5 3 0 8; 19 8 3 4 2 0 6 7; 8 0 9 7 6 1 4 2 3; 4 2 6 8 0 3 7 9 0; 0 0 3 9 2 4 8 0 6; 0 6 1 5 3 7 2 8 4; 2 8 7 4 1 9 6 0 5; 4 5 7 8 10 11 12 3 4 5 2 8 6 1 7 0] % Test Case 1 solution: % M= [5 3 4 6 7 8 9 1 2; 6 7 2 19 5 3 4 8; 1 9 8 3 4 2 5 6 7; 8 5 9 76 1 4 2 3; 4 2 6 85 37 9 1; 7 1 3 9 2 4 8 5 6; 9 6 1 5 3 7 2 8 4; 9 6 3 5; 3 4 5 2 8 6 1 7 9] 13 14 15 16 17 19 20 21 22 2 8 7 4 1 23 24 % Test Case 2 (where a 0 represents an unknown % M= [0 0 5 269 7 8 1; 6 8 0 0 7 1 4 9 3; 1 9 7 8 0 0 5 6 2; 25 value) 26 27 28 29 8 26 19 5 0 0 7; 3 7 4 6 8 2 9 0 0; 9 5 17 4 3 0 0 8; 5 19 3 0 0 8 7 4; 1 3 6; 0 0 3 4 1 8 2 5 9] % Test Case 2 solution: % M= [4 3 5 2 6 9 7 8 1; 6 8 2 5 7 1 4 9 3; 1 9 7 8 3 4 5 6 2; 8 2 6 19 5 3 4 7; 3 7 4 6 8 2 9 1 5; 9 5 1 7 4 3 6 2 8; 5 1 9 3 2 6 8 7 4; 30 31 32 33 2 4 0 0 5 34 35 36 37 38 39 40 41 42 2 4 8 9 5 7 1 3 6; 7 6 3 4 1 8 2 59] 43 44 UTF-8 O N00
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here