-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
25 lines (20 loc) · 799 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Import functions, file lib
const { displayPossibilitiesList } = require('./compute')
const { solveNonogram } = require('./solve')
const fs = require('fs');
// Load Nonograms example and parse it
const jsonData = fs.readFileSync('./src/15x15.json', 'utf8');
const gridData = JSON.parse(jsonData);
// Access the arrays from the loaded data
const horizontalGrid = gridData.horizontalGrid;
const verticalGrid = gridData.verticalGrid;
// Functions
// for Debugging - lists all possibilities
// Compute.js
console.log('Horizontal Possibilities List:');
displayPossibilitiesList(horizontalGrid);
console.log('Vertical Possibilities List:');
displayPossibilitiesList(verticalGrid);
// Solves nonogram - returns true if solvable
// Solve.js
console.log(solveNonogram(horizontalGrid, verticalGrid));