-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestcase.txt
61 lines (46 loc) · 1.19 KB
/
testcase.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
5 3 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 6 3 5
3 4 5 2 8 6 1 7 9
5 5 4 6 7 8 9 1 2
6 7 2 1 9 5 3 4 8
1 9 8 3 4 2 5 6 7
8 5 9 7 6 1 4 2 3
4 2 6 8 5 3 7 9 1
7 1 3 9 2 4 8 5 6
9 6 1 5 3 7 2 8 4
2 8 7 4 1 9 3 3 5
3 4 5 2 8 6 1 7 9
% Example 9x9 Sudoku Grid
grid = [
5 3 4 6 7 8 9 1 2;
6 7 2 1 9 5 3 4 8;
1 9 8 3 4 2 5 6 7;
8 5 9 7 6 1 4 2 3;
4 2 6 8 5 3 7 9 1;
7 1 3 9 2 4 8 5 6;
9 6 1 5 3 7 2 8 4;
2 8 7 4 1 9 6 3 5;
3 4 5 2 8 6 1 7 9
];
grid2 = [
8 8 7 1 5 4 3 9 6; % change 2 to 8 at loc at (1,2)
9 6 5 3 2 7 1 4 8;
3 4 1 6 8 9 7 5 2;
5 9 3 4 6 8 2 7 1;
4 7 2 5 1 3 6 8 9;
6 1 8 9 7 2 4 3 5;
7 8 6 2 3 5 9 1 4;
1 5 4 7 9 6 8 2 3;
2 3 9 8 4 1 5 6 7];
fprintf('Enter your 9x9 Sudoku grid row by row (use space between numbers):\n');
grid = zeros(9, 9);
for i = 1:9
rowInput = input(sprintf(''), 's'); % Take row as a string
grid(i, :) = str2num(rowInput); % Convert string to numeric row
end