sudoku-solve
Version:
Konni's Sudoku solving library
20 lines (19 loc) • 643 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.boxFromRowCol = exports.box = exports.index = exports.col = exports.row = void 0;
const row = (i) => Math.floor(i / 9);
exports.row = row;
const col = (i) => i % 9;
exports.col = col;
const index = (row, col) => row * 9 + col;
exports.index = index;
const box = (i) => boxFromRowCol(row(i), col(i));
exports.box = box;
const boxFromRowCol = (row, col) => {
const rowBox = Math.floor(row / 3);
const colBox = Math.floor(col / 3);
return rowBox * 3 + colBox;
};
exports.boxFromRowCol = boxFromRowCol;
const indexFromBox = (box, indexInBox) => {
};