めもめも
(number=>{
const init=width=>{
const h=i=>~~(i/width), v=i=>i%width, d=i=>h(i)+v(i), u=i=>h(i)-v(i);
const test=(grid,i,f)=>grid.filter((e,j)=>f(i)==f(j)).reduce((a,c)=>a+c,0) < 2;
let count=0;
const log=grid=>[...Array(width).keys()].map(e=>e*width).forEach(
e=>((e==0)?console.log((++count)+":"+"-".repeat(width)):false)
||console.log(grid.slice(e,e+width))
);
return solve=(grid=[...Array(width**2)].fill(0),row=0)=>
[...Array(width)].map((_,i)=>i+row*width).forEach(i=>[
grid[i]=1,
(test(grid,i,v)&&test(grid,i,d)&&test(grid,i,u))?
(row+1==width?log(grid):solve(grid, row+1)):0,
grid[i]=0
]);
};
init(number)();
})(8)