Question: I don't know how to fix this code for it to print a sudoku puzzle with it corresponding solution. public class Sudoku { int [
I don't know how to fix this code for it to print a sudoku puzzle with it corresponding solution.
public class Sudoku
int mat;
int N; number of columnsrows
int SRN; square root of N
int K; No Of missing digits
Constructor
Sudokuint N int K
this.N N;
this.K K;
Compute square root of N
Double SRNd Math.sqrtN;
SRN SRNdintValue;
mat new intNN;
Sudoku Generator
public void fillValues
Fill the diagonal of SRN x SRN matrices
fillDiagonal;
Fill remaining blocks
fillRemaining SRN;
Remove Randomly K digits to make game
removeKDigits;
Fill the diagonal SRN number of SRN x SRN matrices
void fillDiagonal
for int i ; iij
fillBoxi i;
Returns false if given x block contains num.
boolean unUsedInBoxint rowStart, int colStart, int num
for int i ; iN && iN && jN
return true;
if i SRN
if j SRN
j SRN;
else if i NSRN
if jintiSRNSRN
j j SRN;
else
if j NSRN
i i ;
j ;
if iN
return true;
for int num ; numN; num
if CheckIfSafei j num
matij num;
if fillRemainingi j
return true;
matij;
return false;
Remove the K no of digits to
complete game
public void removeKDigits
int count K;
while count
int cellId randomGeneratorNN;
System.out.printlncellId;
extract coordinates i and j
int i cellIdN;
int j cellIdN;
System.out.printlnij;
if matij
count;
matij;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
