BenjaDiaz / Nonogramy

Typescript library for solving nonogram puzzles
1 stars 0 forks source link

Result is wrong #1

Closed GDdark closed 3 years ago

GDdark commented 4 years ago

const nonogram = new Nonogram(6); nonogram.rowConstraints = [[1, 1], [4], [5], [1], [1, 1], [3, 1]]; nonogram.colConstraints = [[1, 1], [2, 1], [3, 2], [2], [3, 2], [1]]; const solver = new NonogramSolver(); solver.solve(nonogram);

I get the wrong result: nonogram.matrix is 0: (6) [0, 1, 0, 1, 1, 1] 1: (6) [1, 0, 0, 0, 0, 1] 2: (6) [1, 0, 0, 0, 0, 0] 3: (6) [1, 1, 1, 1, 0, 1] 4: (6) [1, 1, 0, 1, 1, 1] 5: (6) [0, 0, 0, 1, 1, 1]

The right answer is image

BenjaDiaz commented 3 years ago

Thanks for the issue, @GDdark ! I made this project years ago to learn Typescript. Never thought someone would use it someday. Anyhow, I have made a quick patch that should solve the issue.

Cheers!