-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTheGrid.pde
More file actions
712 lines (601 loc) · 23.3 KB
/
TheGrid.pde
File metadata and controls
712 lines (601 loc) · 23.3 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
import java.util.Map;
import java.util.Map.Entry;
import java.util.HashMap;
class TheGrid {
private final int NUM_CELLS_MINOR = 3;
private final int NUM_CELLS_MAJOR = NUM_CELLS_MINOR * NUM_CELLS_MINOR;
private final int CELL_TEXT_SIZE_BASE = 24;
private final int WIDTH_BASE = 250;
private final float WIDTH_SCALE = 0.08;
private final int CELL_TEXT_SIZE_MIN = 24;
private final int CELL_TEXT_SIZE_MAX = 96;
private final int CELL_VALUE_MIN = 0;
private final int CELL_VALUE_MAX = 9;
private final int NUM_CELL_VALUES = 10;
private Cell[][] theGrid;
private Cell[][][][] minorGrids;
private PVector cellSize;
private int cellTextSize;
private GridCoords activeCell;
private boolean isActiveCellEnabled = false;
// private Map<Integer, HashSet<Integer>> cellsByPossibleValue;
// private List<HashMap<Integer, HashSet<Integer>>> columnCellMaps;
// private List<HashMap<Integer, HashSet<Integer>>> rowCellMaps;
// private List<HashMap<Integer, HashSet<Integer>>> minorGridCellMaps;
public TheGrid() {
// The main array - the objects are actually stored here
theGrid = new Cell[NUM_CELLS_MAJOR][NUM_CELLS_MAJOR];
// A array that represents the minor grids (3 x 3 cells each),
// and that points to the main array
minorGrids = new Cell[NUM_CELLS_MINOR][NUM_CELLS_MINOR][NUM_CELLS_MINOR][NUM_CELLS_MINOR];
cellSize = new PVector(width / NUM_CELLS_MAJOR, height / NUM_CELLS_MAJOR);
int cellSizeHalfX = int(cellSize.x / 2);
int cellSizeHalfY = int(cellSize.y / 2);
// cellsByPossibleValue = new HashMap<Integer, HashSet<Integer>>(NUM_CELLS_MAJOR);
// columnCellMaps = new ArrayList<HashMap<Integer, HashSet<Integer>>>(NUM_CELLS_MAJOR);
// rowCellMaps = new ArrayList<HashMap<Integer, HashSet<Integer>>>(NUM_CELLS_MAJOR);
// minorGridCellMaps = new ArrayList<HashMap<Integer, HashSet<Integer>>>(NUM_CELLS_MAJOR);
cellTextSize = int(((width - WIDTH_BASE) * WIDTH_SCALE) + CELL_TEXT_SIZE_BASE);
activeCell = new GridCoords(0, 0);
int cellWidth = int(width / NUM_CELLS_MAJOR);
// Create the main array
for (int col = 0; col < theGrid.length; col++) {
// Calculate cell center x
int centerX = int(width * (float(col) / NUM_CELLS_MAJOR)) + cellSizeHalfX;
for (int row = 0; row < theGrid[col].length; row++) {
// Calculate cell center y
int centerY = int(height * (float(row) / NUM_CELLS_MAJOR)) + cellSizeHalfY;
theGrid[col][row] = new Cell(centerX, centerY, cellWidth, cellTextSize);
}
}
// Point the minorGrids array to the appropriate objects of the main array
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
minorGrids[col / NUM_CELLS_MINOR][row / NUM_CELLS_MINOR]
[col % NUM_CELLS_MINOR][row % NUM_CELLS_MINOR] = theGrid[col][row];
}
}
}
public void update() {
}
public void display() {
drawGrid();
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
theGrid[col][row].display();
}
}
// Draw Possible values
}
private void setCellValue(int value) {
// Use the active cell
setCellValue(activeCell.col, activeCell.row, value);
}
private void setCellValue(int col, int row, int value) {
// TODO - check that the active cell is enabled
if ((value >= CELL_VALUE_MIN) && (value <= CELL_VALUE_MAX)) {
if (isValidDigit(col, row, value)) {
theGrid[col][row].setValue(value);
if (value > 0) {
// If the value is anything other than 0, slear the possibla values set
theGrid[col][row].clearPossibleValues();
} else {
theGrid[col][row].initPossibleValues();
}
generatePossibleValuesSets();
}
}
}
public void reset() {
// Set the value of all cells to 0
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
setCellValue(col, row, 0);
}
}
}
private int lookForSingleOccurancePosValCols() {
// For every column, scan every cell's PossibleValues set to look for any
// cells that have the only occurance of a value in that column, whose
// PossibleValues set doesn't necessarily have only that value.
int numCellsSet = 0;
println("**** Checking columns ****");
for (int col = 0; col < theGrid.length; col++) {
Map<Integer, Set<Integer>> cellsByPossibleValue =
new HashMap<Integer, Set<Integer>>();
println("For column " + col);
for (int row = 0; row < theGrid[col].length; row++) {
println(" For row " + row);
if (theGrid[col][row].getValue() == 0) {
for (Integer possibleValue : theGrid[col][row].possibleValues) {
// Add this row to the map
if (cellsByPossibleValue.containsKey(possibleValue)) {
// A map entry for this possible value already exists, add this row to it
Set<Integer> cellNumbers = cellsByPossibleValue.get(possibleValue);
cellNumbers.add(row);
println(" Adding row " + row + " to possible values map entry for " + possibleValue);
} else {
// Create a new set (the map's value) and add it to the map
// for this possible value and row
Set<Integer> cellNumbers = new HashSet<Integer>();
cellNumbers.add(row);
cellsByPossibleValue.put(possibleValue, cellNumbers);
println(" Creating new set for possible value " + possibleValue +
" and putting row " + row + " in it");
}
// println("Value: " + iterator.next() + " ");
}
}
}
// Look for any sets (the values) with only one entry.
// that is the cell's only possible value
for (Map.Entry<Integer, Set<Integer>> entry : cellsByPossibleValue.entrySet()) {
if (entry.getValue().size() == 1) {
for (Integer value : entry.getValue()) {
setCellValue(col, value, entry.getKey());
numCellsSet++;
println("Row " + value + " has the only " + entry.getKey() + " in column " + col);
}
}
}
}
return numCellsSet;
}
private int lookForSingleOccurancePosValRows() {
// For every row, scan every cell's PossibleValues set to look for any
// cells that have the only occurance of a value in that row, whose
// PossibleValues set doesn't necessarily have only that value.
int numCellsSet = 0;
println("**** Checking rows ****");
for (int row = 0; row < theGrid[0].length; row++) {
Map<Integer, Set<Integer>> cellsByPossibleValue =
new HashMap<Integer, Set<Integer>>();
println("For row " + row);
for (int col = 0; col < theGrid.length; col++) {
println(" For col " + col);
if (theGrid[col][row].getValue() == 0) {
for (Integer possibleValue : theGrid[col][row].possibleValues) {
// Add this row to the map
if (cellsByPossibleValue.containsKey(possibleValue)) {
// A map entry for this possible value already exists, add this row to it
Set<Integer> cellNumbers = cellsByPossibleValue.get(possibleValue);
cellNumbers.add(col);
println(" Adding col " + col + " to possible values map entry for " + possibleValue);
} else {
// Create a new set (the map's value) and add it to the map
// for this possible value and col
Set<Integer> cellNumbers = new HashSet<Integer>();
cellNumbers.add(col);
cellsByPossibleValue.put(possibleValue, cellNumbers);
println(" Creating new set for possible value " + possibleValue +
" and putting col " + col + " in it");
}
// println("Value: " + iterator.next() + " ");
}
}
}
// Look for any sets (the values) with only one entry.
// that is the cell's only possible value
for (Map.Entry<Integer, Set<Integer>> entry : cellsByPossibleValue.entrySet()) {
if (entry.getValue().size() == 1) {
for (Integer value : entry.getValue()) {
setCellValue(value, row, entry.getKey());
numCellsSet++;
println("Column " + value + " has the only " + entry.getKey() + " in row " + row);
}
}
}
}
return numCellsSet;
}
private int lookForSingleOccurancePosValMinorGrids() {
// For every minor grid, scan every cell's PossibleValues set to look for any
// cells that have the only occurance of a value in that minor grid, whose
// PossibleValues set doesn't necessarily have only that value.
int numCellsSet = 0;
println("**** Checking minor grids ****");
for (int majorCol = 0; majorCol < minorGrids.length; majorCol++) {
println("For major column " + majorCol);
for (int majorRow = 0; majorRow < minorGrids[majorCol].length; majorRow++) {
println(" For major row " + majorRow);
Map<Integer, Set<Integer>> cellsByPossibleValue =
new HashMap<Integer, Set<Integer>>();
for (int col = 0; col < minorGrids[majorCol][majorRow].length; col++) {
for (int row = 0; row < minorGrids[majorCol][majorRow][col].length; row++) {
// Convert col (0 - 2) and row (0 - 2) to single digit index (0 - 8)
int cellNum = col + (row * NUM_CELLS_MINOR);
println(" For col, row, cellNum " + col + ", " + row + ", " + cellNum);
println(" value = " + minorGrids[majorCol][majorRow][col][row].getValue());
if (minorGrids[majorCol][majorRow][col][row].getValue() == 0) {
for (Integer possibleValue : minorGrids[majorCol][majorRow][col][row].possibleValues) {
// Add this cell to the map
if (cellsByPossibleValue.containsKey(possibleValue)) {
// A map entry for this possible value already exists, add this row to it
Set<Integer> cellNumbers = cellsByPossibleValue.get(possibleValue);
cellNumbers.add(cellNum);
println(" Adding cellNum " + cellNum + " to possible values map entry for " + possibleValue);
} else {
// Create a new set (the map's value) and add it to the map
// for this possible value and row
Set<Integer> cellNumbers = new HashSet<Integer>();
cellNumbers.add(cellNum);
cellsByPossibleValue.put(possibleValue, cellNumbers);
println(" Creating new set for possible value " + possibleValue +
" and putting cellNum " + cellNum + " in it");
}
// println("Value: " + iterator.next() + " ");
}
}
// print(minorGrids[majorCol][majorRow][col][row].theValue + ", ");
}
}
// Look for any sets (the values) with only one entry.
// that is the cell's only possible value
for (Map.Entry<Integer, Set<Integer>> entry : cellsByPossibleValue.entrySet()) {
if (entry.getValue().size() == 1) {
for (Integer value : entry.getValue()) {
// Convert majorCol, majorRow and cellNum to col and row
int minorCol = value % NUM_CELLS_MINOR;
int minorRow = value / NUM_CELLS_MINOR;
int col = (majorCol * NUM_CELLS_MINOR) + minorCol;
int row = (majorRow * NUM_CELLS_MINOR) + minorRow;
setCellValue(col, row, entry.getKey());
numCellsSet++;
println("Minor Grid column, row " + majorCol + ", " + majorRow + " has the only " +
entry.getKey() + " in cellNum " + value);
}
}
}
}
}
return numCellsSet;
}
private int lookForSingleOccurancePosValMajor() {
// For every column and row, scan every cell's PossibleValues set to look for any
// cells that have only one PossibleValues.
int numCellsSet = 0;
println("**** Checking Major Grid ****");
for (int col = 0; col < theGrid.length; col++) {
println("For column " + col);
for (int row = 0; row < theGrid[col].length; row++) {
println(" For row " + row);
if (theGrid[col][row].getValue() == 0) {
if (theGrid[col][row].possibleValues.size() == 1) {
for (Integer value : theGrid[col][row].possibleValues) {
setCellValue(col, row, value);
numCellsSet++;
println(" Column, row " + col + ", " + row + " has only " + value + " as a possible value");
}
}
}
}
}
return numCellsSet;
}
public void solve() {
int passes = 0;
int numCellsSet = 0;
int numLoopsNoCellsSet = 0;
// Do until all cells are filled
while (areAnyZeroValues() && (numLoopsNoCellsSet < 2)) {
numCellsSet += lookForSingleOccurancePosValCols();
numCellsSet += lookForSingleOccurancePosValRows();
numCellsSet += lookForSingleOccurancePosValMinorGrids();
numCellsSet += lookForSingleOccurancePosValMajor();
passes++;
println("numCellsSet = " + numCellsSet + ", numLoopsNoCellsSet = " + numLoopsNoCellsSet);
if (numCellsSet == 0) {
numLoopsNoCellsSet++;
} else {
numCellsSet = 0;
}
}
// println("numCellsSet = " + numCellsSet + ", numLoopsNoCellsSet = " + numLoopsNoCellsSet);
// numCellsSet = 0;
// numLoopsNoCellsSet = 0;
if (areAnyZeroValues()) {
println("No solution in " + passes + " passes!");
} else {
println("All done in " + passes + " passes!");
}
}
private boolean areAnyZeroValues() {
boolean areAnyZeros = false;
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
if (theGrid[col][row].getValue() == 0) {
areAnyZeros = true;
// break out of inner loop
break;
}
}
if (areAnyZeros) {
// break out of outer loop
break;
}
}
return areAnyZeros;
}
private void generatePossibleValuesSets() {
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
theGrid[col][row].initPossibleValues();
// Check the value of the other cells in this column
for (int i = 0; i < theGrid[col].length; i++) {
if (i != row) {
if (theGrid[col][i].getValue() > 0) {
theGrid[col][row].removeNumFromPossValues(theGrid[col][i].getValue());
}
}
}
// Check the value of the other cells int this row
for (int i = 0; i < theGrid.length; i++) {
if (i != col) {
if (theGrid[i][row].getValue() > 0) {
theGrid[col][row].removeNumFromPossValues(theGrid[i][row].getValue());
}
}
}
// Check the values of the other cells in this minor grid
int minorGridCol = col / NUM_CELLS_MINOR;
int minorGridRow = row / NUM_CELLS_MINOR;
int cellCol = col % NUM_CELLS_MINOR;
int cellRow = row % NUM_CELLS_MINOR;
for (int c = 0; c < minorGrids[minorGridCol][minorGridRow].length; c++) {
for (int r = 0; r < minorGrids[minorGridCol][minorGridRow][c].length; r++) {
if ((c == cellCol) && (r == cellRow)) {
// Don't compare the cell in question with itself
} else {
int value = minorGrids[minorGridCol][minorGridRow][c][r].getValue();
if (value > 0) {
theGrid[col][row].removeNumFromPossValues(value);
}
}
}
}
}
}
}
private boolean isValidDigit(int col, int row, int value) {
boolean isValid = true;
// Check the value of the other cells in this column
for (int i = 0; i < theGrid[col].length; i++) {
if (i != row) {
if ((theGrid[col][i].getValue() > 0) &&
(value == theGrid[col][i].getValue())) {
isValid = false;
break;
}
}
}
// Check the value of the other cells in this row
for (int i = 0; i < theGrid.length; i++) {
if (i != col) {
if ((theGrid[i][row].getValue() > 0) &&
(value == theGrid[i][row].getValue())) {
isValid = false;
break;
}
}
}
// Check the values of the other cells in this minor grid
int minorGridCol = col / NUM_CELLS_MINOR;
int minorGridRow = row / NUM_CELLS_MINOR;
int cellCol = col % NUM_CELLS_MINOR;
int cellRow = row % NUM_CELLS_MINOR;
for (int c = 0; c < minorGrids[minorGridCol][minorGridRow].length; c++) {
for (int r = 0; r < minorGrids[minorGridCol][minorGridRow][c].length; r++) {
if ((c == cellCol) && (r == cellRow)) {
// Don't compare the cell in question with itself
} else {
if ((minorGrids[minorGridCol][minorGridRow][c][r].getValue() > 0) &&
(value == minorGrids[minorGridCol][minorGridRow][c][r].getValue())) {
isValid = false;
// break out of inner for loop
break;
}
}
}
if (!isValid) {
// break out of outer for loop
break;
}
}
return isValid;
}
public void setActiveCell(int col, int row) {
theGrid[activeCell.col][activeCell.row].setActive(false);
activeCell.col = int(col / cellSize.x);
activeCell.row = int(row / cellSize.y);
theGrid[activeCell.col][activeCell.row].setActive(true);
}
public void setActiveCell(CellDirection cellDir) {
// Make the current active cell not active
theGrid[activeCell.col][activeCell.row].setActive(false);
// Find the new active cell and set it active
switch (cellDir) {
case UP:
if (activeCell.row > 0) {
activeCell.row--;
} else {
// In top row
if (activeCell.col > 0) {
activeCell.col--;
activeCell.row = NUM_CELLS_MAJOR - 1;
} else {
// In top left cell
}
}
break;
case DOWN:
if (activeCell.row < NUM_CELLS_MAJOR - 1) {
activeCell.row++;
} else {
// In bottom row
if (activeCell.col < NUM_CELLS_MAJOR - 1) {
activeCell.col++;
activeCell.row = 0;
} else {
// In bottom right cell
}
}
break;
case LEFT:
if (activeCell.col > 0) {
activeCell.col--;
} else {
// In left column
if (activeCell.row > 0) {
activeCell.row--;
activeCell.col = NUM_CELLS_MAJOR - 1;
} else {
// In top left cell
}
}
break;
case RIGHT:
if (activeCell.col < NUM_CELLS_MAJOR - 1) {
activeCell.col++;
} else {
// In right column
if (activeCell.row < NUM_CELLS_MAJOR - 1) {
activeCell.row++;
activeCell.col = 0;
} else {
// In bottom right cell
}
}
break;
}
// println("Setting cell active: " + activeCell.row + ", " + activeCell.col);
theGrid[activeCell.col][activeCell.row].setActive(true);
}
void drawGrid() {
float cellWidth = width / 9.0;
background(Colors.WHITE_GREY_SCL); //
stroke(Colors.BLACK_GREY_SCL);
for (int i = 1; i < NUM_CELLS_MAJOR; i++) {
if (i % 3 == 0) {
strokeWeight(5);
} else {
strokeWeight(1);
}
line((i * cellWidth), 0, (i * cellWidth), height);
line(0, (i * cellWidth), width, (i * cellWidth));
}
}
public void incCellTextSize() {
if (cellTextSize < CELL_TEXT_SIZE_MAX) {
cellTextSize += 2;
setCellTextSize();
println("Text size = " + cellTextSize);
}
}
public void decCellTextSize() {
if (cellTextSize > CELL_TEXT_SIZE_MIN) {
cellTextSize -= 2;
setCellTextSize();
println("Text size = " + cellTextSize);
}
}
private void setCellTextSize() {
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
theGrid[col][row].setTextSize(cellTextSize);
}
}
}
private void printGrid() {
// Fill the arrays with test data
for (int col = 0; col < theGrid.length; col++) {
for (int row = 0; row < theGrid[col].length; row++) {
theGrid[col][row].theValue = col + (row * 10);
}
}
// Print the grid as Itself
for (int col = 0; col < theGrid.length; col++) {
print("Data as theGrid: ");
for (int row = 0; row < theGrid[col].length; row++) {
print(theGrid[col][row].theValue + ", ");
}
println();
}
println();
// Print the grid by column
// for (int col = 0; col < columns.length; col++) {
// print("Data as columns: ");
// for (int row = 0; row < columns[col].length; row++) {
// print(columns[col][row].theValue + ", ");
// }
// println();
// }
// println();
// Print the grid by row
// for (int row = 0; row < rows.length; row++) {
// print("Data as rows: ");
// for (int col = 0; col < rows[row].length; col++) {
// print(rows[row][col].theValue + ", ");
// }
// println();
// }
// println();
// Print the whole grid as the grid of grids
println("Data as a grid of grids: ");
for (int majorCol = 0; majorCol < minorGrids.length; majorCol++) {
println(" Data as major cols: ");
for (int majorRow = 0; majorRow < minorGrids[majorCol].length; majorRow++) {
println(" Data as major rows: ");
for (int col = 0; col < minorGrids[majorCol][majorRow].length; col++) {
print(" Data as rows: ");
for (int row = 0; row < minorGrids[majorCol][majorRow][col].length; row++) {
print(minorGrids[majorCol][majorRow][row][col].theValue + ", ");
}
println();
}
println();
}
println();
}
println();
println("Possible values = " + theGrid[0][0].possibleValues);
if (theGrid[0][0].possibleValues.contains(8)) {
theGrid[0][0].possibleValues.remove(8);
}
println("Possible values = " + theGrid[0][0].possibleValues);
// for (int i = 0; i < theGrid.length; i++) {
// print("Data as rows: ");
// for (int j = 0; j < theGrid[i].length; j++) {
// if (theGrid[i][j].theValue == 0) {
// removeRowValuesFromPossibleValues(i, j);
// removeColumnValuesFromPossibleValues(i, j);
// }
//
//
// if (rows[0][1].possibleValues.contains(rows[i][j].theValue)) {
// print(rows[i][j].theValue + ", ");
// }
// }
// println();
// }
//for (int i = 0; i < rows[0][0].possibleValues.size(); i++) {
// print("Data as rows: ");
// println();
//}
// Iterator<Integer> iterator = theGrid[0][0].possibleValues.iterator();
// check values
// while (iterator.hasNext()) {
//if (iterator.next() == 4) {
// rows[0][0].possibleValues.remove();
//}
// println("Value: " + iterator.next() + " ");
// }
}
class GridCoords {
int col;
int row;
GridCoords(int c, int r) {
col = c;
row = r;
}
}
}