@@ -13,10 +13,13 @@ var databuilder = require('./arraybuilder.js')
13
13
var printer = require ( './boardprinter.js' )
14
14
var checkBlock = require ( './checkBlock.js' ) ;
15
15
var printer = require ( './boardprinter.js' ) ;
16
-
16
+
17
+ //NOT YET SOLVED
17
18
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 " ;
18
19
20
+ //SOLVABLE
19
21
//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 "
20
23
21
24
22
25
var boardArray = boardString . split ( '' ) ;
@@ -44,8 +47,17 @@ function findOptions(fullArray){
44
47
45
48
return }
46
49
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
+
48
55
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
+
49
61
solvedSquares = 1 ;
50
62
checkRow ( row , col , fullArray ) ; //assemble and return possible values
51
63
checkCol ( row , col , fullArray ) ; //assemble and return possible values
@@ -127,7 +139,6 @@ function insertDupleValues(fullArray){
127
139
}
128
140
129
141
// the NEW VERSION of buildPrinterString
130
-
131
142
function buildPrinterString ( fullArray ) {
132
143
var printableArray = [ ] ;
133
144
var set ;
@@ -136,7 +147,7 @@ function buildPrinterString(fullArray){
136
147
if ( fullArray [ row ] [ col ] . value === null ) {
137
148
//console.log("fullarray row col has null and length is " + fullArray[row][col].possibles.length)
138
149
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
140
151
switch ( fullArray [ row ] [ col ] . possibles . length ) {
141
152
case 1 : set = - 1 ; break ;
142
153
case 2 : set = - 2 ; break ;
@@ -163,7 +174,7 @@ function buildPrinterString(fullArray){
163
174
printer ( printableArray ) ;
164
175
} ; // close final
165
176
166
-
177
+ // PREVIOUS VERSION OF BUILD PRINTER STRING - DELETE
167
178
// function buildPrinterString(fullArray) {
168
179
// var printableArray = [];
169
180
// fullArray.forEach(function(record) {
@@ -211,9 +222,13 @@ function deletePossibles(toCheck, possiblesList){
211
222
for ( var i = 0 ; i < possiblesList . length ; i ++ ) {
212
223
if ( possiblesList [ i ] === toCheck ) {
213
224
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']);
216
229
230
+
231
+
217
232
/// Temp comment out - go to first in
218
233
//findOptions(arrayDepot.shift());
219
234
0 commit comments