Talk:N-queens minimum and knights and bishops: Difference between revisions

(→‎Performance note: added summary of Phix algorithm.)
Line 32:
::Actually that cheat I mentioned isn't needed or particularly helpful (when paired off with a prove chaser that is), but glad I tried it as it lead to a quite helpful and probably obvious optimisation: if you can't solve a 7x7 board with 6 bishops, no point trying to solve an 8x8 with only 6. There's also "first bishop must be on the main diagonal", and again obviously if there is no answer up to the mid-point, there will not be one after. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 09:36, 24 April 2022 (UTC)
:::I am thinking about to use a good strategy of finding the next possible place for a token like [[Spiral_matrix#Phix]].<br> Starting in the middle at the highest number and checking next possible places along the spiral backwards.This should place the next token Q,B,K in a way, that they maximize the attacked places.<br>Hopefully an optimal solution with the lowest count of tokens is found this way faster, to stop search as soon as possible, if number of token exceeds this number. --[[User:Horsth|Horsth]] ([[User talk:Horsth|talk]]) 16:46, 26 April 2022 (UTC)
::::I suppose I should summarise my approach. Within an as above mentioned while m++ loop, find all moves which either occupy or attack {1,1}. Then, for each of those moves, keeping within m total moves, scan [from {1,2} forward] for the first unoccupied and unattacked square, again find all suitable moves, and obviously mark solved/save answer/stop if no such squares found, and abandoning m once all moves for {1,1} have been tried. Basically recursive, but I use an explicit stack (or 30) to make it iterative/re-entrant/GUI compatible. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 14:40, 11 May 2022 (UTC)
 
== Simple solution for bishops ==
7,803

edits