1.0.1 • Published 5 years ago
n-queens v1.0.1
n-queens
The classic N-Queens problem solved using backtracking.
How to use
import { NQueen } from 'n-queen';
const instance = new NQueen(8);
instance.solveNQ();
instance.printSolution();
Example output
Using N = 8, you'll see the next output:
instance.printSolution();
// 1 0 0 0 0 0 0 0
// 0 0 0 0 0 0 1 0
// 0 0 0 0 1 0 0 0
// 0 0 0 0 0 0 0 1
// 0 1 0 0 0 0 0 0
// 0 0 0 1 0 0 0 0
// 0 0 0 0 0 1 0 0
// 0 0 1 0 0 0 0 0