Corrected twoValPlaces check.
This commit is contained in:
@ -56,14 +56,14 @@ class @SudokuChecks
|
|||||||
p = (1 << i) | (1 << j)
|
p = (1 << i) | (1 << j)
|
||||||
console.log('Now checking (%o, %o) mask: %o', i+1, j+1, p)
|
console.log('Now checking (%o, %o) mask: %o', i+1, j+1, p)
|
||||||
for k of cells
|
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++
|
n++
|
||||||
console.log('%d: %d, %d (%o, %o)', n, p, cells[k].getMask(), (p & cells[k].getMask()), ((p & cells[k].getMask()) is p))
|
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
|
console.info('Have %d matches.', n) if n > 0
|
||||||
if n is 2
|
if n is 2
|
||||||
console.warn('Two matches!')
|
console.warn('Two matches!')
|
||||||
for k of cells
|
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)
|
cells[k].setMask(p)
|
||||||
else if cells[k].getValue() is '.'
|
else if cells[k].getValue() is '.'
|
||||||
curMask = cells[k].getMask()
|
curMask = cells[k].getMask()
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
p = (1 << i) | (1 << j);
|
p = (1 << i) | (1 << j);
|
||||||
console.log('Now checking (%o, %o) mask: %o', i + 1, j + 1, p);
|
console.log('Now checking (%o, %o) mask: %o', i + 1, j + 1, p);
|
||||||
for (k in cells) {
|
for (k in cells) {
|
||||||
if (cells[k].getValue() === '.' && (cells[k].getMask() & p) === p) {
|
if (cells[k].getValue() === '.' && cells[k].getMask() === p) {
|
||||||
n++;
|
n++;
|
||||||
console.log('%d: %d, %d (%o, %o)', n, p, cells[k].getMask(), p & cells[k].getMask(), (p & cells[k].getMask()) === p);
|
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) {
|
if (n === 2) {
|
||||||
console.warn('Two matches!');
|
console.warn('Two matches!');
|
||||||
for (k in cells) {
|
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);
|
cells[k].setMask(p);
|
||||||
} else if (cells[k].getValue() === '.') {
|
} else if (cells[k].getValue() === '.') {
|
||||||
curMask = cells[k].getMask();
|
curMask = cells[k].getMask();
|
||||||
|
Reference in New Issue
Block a user