N-queens minimum and knights and bishops: Difference between revisions
N-queens minimum and knights and bishops (view source)
Revision as of 04:45, 26 April 2022
, 2 years ago→{{header|J}}: remove an overly aggressive optimization..
m (→{{header|J}}: oops) |
m (→{{header|J}}: remove an overly aggressive optimization..) |
||
Line 343:
r=. (n+2) {.!._ x
N=. n
todo=.
lim=. >./,(first +&{: x)+m
for_open. (#~ lim>:]) todo do.
Line 362:
task=: {{
Q=:K=:B=:i.0
for_order.1+i.10 do.
genboard order
Line 376 ⟶ 374:
<lang J> task''
┌─┬─┬─┐ Q: 1
└─┴─┴─┘ K: 1
┌──┬──┬──┐ Q: 1
└──┴──┴──┘
┌───┬───┬───┐ Q: 1
└───┴───┴───┘
┌────┬────┬────┐ Q: 3
└────┴────┴────┘
┌─────┬─────┬─────┐ Q: 3
└─────┴─────┴─────┘
┌──────┬──────┬──────┐ Q: 4
└──────┴──────┴──────┘
+-----------------------+ Q: 5
¦Q......¦.......¦KKKK.K.¦ B: 7
|