diff --git a/coffee/SudokuChecks.class.coffee b/coffee/SudokuChecks.class.coffee index 0536b67..0bdd27a 100644 --- a/coffee/SudokuChecks.class.coffee +++ b/coffee/SudokuChecks.class.coffee @@ -56,14 +56,14 @@ class @SudokuChecks p = (1 << i) | (1 << j) console.log('Now checking (%o, %o) mask: %o', i+1, j+1, p) for k of cells - if cells[k].getValue() is '.' and (cells[k].getMask() & p) is p + if cells[k].getValue() is '.' and cells[k].getMask() is p n++ console.log('%d: %d, %d (%o, %o)', n, p, cells[k].getMask(), (p & cells[k].getMask()), ((p & cells[k].getMask()) is p)) console.info('Have %d matches.', n) if n > 0 if n is 2 console.warn('Two matches!') for k of cells - if cells[k].getValue() is '.' and (cells[k].getMask() & p) is p + if cells[k].getValue() is '.' and cells[k].getMask() is p cells[k].setMask(p) else if cells[k].getValue() is '.' curMask = cells[k].getMask() diff --git a/js/SudokuChecks.class.js b/js/SudokuChecks.class.js index 3a139d0..90574f2 100644 --- a/js/SudokuChecks.class.js +++ b/js/SudokuChecks.class.js @@ -82,7 +82,7 @@ p = (1 << i) | (1 << j); console.log('Now checking (%o, %o) mask: %o', i + 1, j + 1, p); for (k in cells) { - if (cells[k].getValue() === '.' && (cells[k].getMask() & p) === p) { + if (cells[k].getValue() === '.' && cells[k].getMask() === p) { n++; console.log('%d: %d, %d (%o, %o)', n, p, cells[k].getMask(), p & cells[k].getMask(), (p & cells[k].getMask()) === p); } @@ -93,7 +93,7 @@ if (n === 2) { console.warn('Two matches!'); for (k in cells) { - if (cells[k].getValue() === '.' && (cells[k].getMask() & p) === p) { + if (cells[k].getValue() === '.' && cells[k].getMask() === p) { cells[k].setMask(p); } else if (cells[k].getValue() === '.') { curMask = cells[k].getMask();