Changes

Jump to: navigation, search

Algo holics

218 bytes added, 04:32, 22 February 2019
Assignment 1
<h5>LOGIC</h5>
In this program the Bruteforce algorithm first put 1 in the first cell and then check if it is violating any rules. If yes, then it increment the value to 2 and check again (The value can vary from 1-9) until it finds the appropriate value. After finding a suitable value for the first cell, it moves to the second cell and put 1 in there and again check again if it violating any rules. If it is discovers that 1 is not allowed in that cell, then the algorithm will increment it to 2 and check again and if no not even a single value from the range of 0-9 satisfies the cell, then the algorithm will iterate back to the previous cell and increment the value and try the whole process again. By following the same logic it will solve the whole puzzle.
<h5>Compiling the program</h5>
The output will be:
 
9 8 7 6 5 4 3 2 1
2 4 6 1 7 3 9 8 5
3 5 1 9 2 8 7 4 6
1 2 8 5 3 7 6 9 4
6 3 4 8 9 2 1 5 7
7 9 5 4 6 1 8 3 2
5 1 9 2 8 6 4 7 3
4 7 2 3 1 9 5 6 8
8 6 3 7 4 5 2 1 9
85
edits

Navigation menu