Skip to content

Commit 505c94b

Browse files
committed
a few diagnostics around line 50
1 parent 26e497d commit 505c94b

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

sudoku.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,13 @@ var databuilder = require('./arraybuilder.js')
1313
var printer = require('./boardprinter.js')
1414
var checkBlock = require('./checkBlock.js');
1515
var printer = require('./boardprinter.js');
16-
16+
17+
//NOT YET SOLVED
1718
var boardString = " 2 1 8 1 8 6 7 2 1 8 1 9 7 2 3 6 4 2 1 6 5 3 1 9 5 9 4 ";
1819

20+
//SOLVABLE
1921
//var boardString = "7 4 2 9 416 6 11 7 8 8 74132 9 9 8 56 2 413 8 2 8 6";
22+
//var boardString = " 8 3 42 6 9 332 4 9 75 9 6 6 185 7 8 4 93 3 4 515 7 2 26 9 1 "
2023

2124

2225
var boardArray = boardString.split('');
@@ -44,8 +47,17 @@ function findOptions(fullArray){
4447

4548
return }
4649
for (row=0; row<9; row++) {
47-
for (col=0; col<9; col++) {
50+
for (col=0; col<9; col++) {
51+
52+
//diagnostic
53+
//console.log ("line 51 fullArray[row][col].value " + fullArray[row][col].value + " at row: " + row + " col: " + col );
54+
4855
if (fullArray[row][col].value === null) {
56+
57+
//diagnostic
58+
//console.log ("line 55 fullArray[row][col].value " + fullArray[row][col].value + " at row: " + row + " col: " + col );
59+
60+
4961
solvedSquares = 1;
5062
checkRow(row,col,fullArray); //assemble and return possible values
5163
checkCol(row,col,fullArray); //assemble and return possible values
@@ -127,7 +139,6 @@ function insertDupleValues(fullArray){
127139
}
128140

129141
// the NEW VERSION of buildPrinterString
130-
131142
function buildPrinterString(fullArray){
132143
var printableArray = [];
133144
var set;
@@ -136,7 +147,7 @@ function buildPrinterString(fullArray){
136147
if (fullArray[row][col].value === null){
137148
//console.log("fullarray row col has null and length is " + fullArray[row][col].possibles.length)
138149
var set = ' ';
139-
//if null pass in negative number describing length of possibles array for diagnostics
150+
//if null pass in negative number describing length of possibles array for diagnostics - Number will be negative and in brackets in printout
140151
switch( fullArray[row][col].possibles.length ){
141152
case 1: set=-1; break;
142153
case 2: set=-2; break;
@@ -163,7 +174,7 @@ function buildPrinterString(fullArray){
163174
printer(printableArray);
164175
};// close final
165176

166-
177+
// PREVIOUS VERSION OF BUILD PRINTER STRING - DELETE
167178
// function buildPrinterString(fullArray) {
168179
// var printableArray = [];
169180
// fullArray.forEach(function(record) {
@@ -211,9 +222,13 @@ function deletePossibles(toCheck, possiblesList){
211222
for (var i = 0; i < possiblesList.length; i++) {
212223
if (possiblesList[i] === toCheck) {
213224
if (possiblesList.length < 2) {
214-
console.log('ERROR CHECKER WORKED ___________________________ ON SQUARE ')
215-
console.log(arrayDepot[0][0]['possibles'])
225+
console.log('ERROR CHECKER WORKED ___________________ ON SQUARE ');
226+
227+
228+
//console.log(arrayDepot[0][0]['possibles']);
216229

230+
231+
217232
/// Temp comment out - go to first in
218233
//findOptions(arrayDepot.shift());
219234

0 commit comments

Comments
 (0)