import { getXYW } from "./util"; export function visualizeValues(values: number[]): void { const sudoku: (number | null)[][] = Array.from({ length: 9 }, () => Array.from({ length: 9 }, () => null)); for (const value of values) { const { x, y, w } = getXYW(value); sudoku[y - 1]![x - 1] = w; } for (let y = 9; y > 0; y--) { if (y % 3 === 0) { console.log("+---------+---------+---------+"); } for (let x = 0; x < 9; x++) { if (x % 3 === 0) { process.stdout.write("|"); } process.stdout.write(sudoku[y - 1]![x] === null ? " " : " " + sudoku[y - 1]![x]!.toString() + " "); } console.log("|"); } console.log("+---------+---------+---------+"); }