function place_queen(queens = [], depth = 0) {
if (queens.length == 8) {
let result = { solution: queens, length: queens.length };
return result;
}
let possible_placements = setdiff(d3.range(1, 8+1), queens);
let diag_offsets = d3.range(queens.length, 0, -1);
let diags = [].concat(addel(queens, diag_offsets)).concat(addel(queens, diag_offsets, -1));
diags = diags.filter(diag => diag > 0 && diag < 9)
possible_placements = possible_placements.filter(x => !diags.includes(x))
return possible_placements
.map(placement => place_queen([].concat(queens).concat([placement]), depth + 1))
.filter(_ => _.length)
.flat();
}