Tag: SPL code example
Eight Queens
The Eight Queens problem is a classic and well-known problem. Specifically, place eight queens on an 8×8 chessboard so that no two queens can attack each other, which means no two queens can be on the same row, the same column, or the same diagonal. The question is: how many solutions are there? A B C D 1 8 =[0]*A1 >i=1 2 for i>0 >B1(i)+=1 3 if B1(i)>A1 >B1(i)=0,i-=1 next 4 if i==1 && A1>1 >i=2 next 5 =B1(i) =B1.to(i-1) 6 if C5.pselect(~==B5|| i-# ==abs(B5-~)) next 7 if (i+=1)>A1 =@|B1.concat@c() >i-=1 8 =C7.len() http://try.scudata.com.cn/splx?4nr Consider each row of an N*N
...







