News for hackers. Stuff that matters.
Re:Chess puzzle I found in my dad's old book by hammock on Wednesday May 13, 2026 @10:44PM (#48130516)
The trick for me was to place a queen (most anywhere, but start with a corner it’s easier), then check and look for the spot with the most reds around it (eg 9, or 8, or 7), place the next queen there, repeat. Then place the bishop as needed.

The key was realizing the proximal spaces next to the placed queen are the most important to cover. Forget about trying to have a long reach, it comes naturally.

Re:Chess puzzle I found in my dad's old book by CamelCaseName on Thursday May 14, 2026 @12:13AM (#48131027)
Wow!! That was awesome, great explanation too!
Re:Chess puzzle I found in my dad's old book by r3trohack3r on Wednesday May 13, 2026 @11:00PM (#48130595)
I was skeptical but, this not only worked the first time I tried it, this strategy has worked every time.
Re:Chess puzzle I found in my dad's old book by oguzhaneksi on Thursday May 14, 2026 @07:28AM (#48133934)
Wow, this is really the cheatsheet of this game! It worked like a charm! Appreciate it
Re:Chess puzzle I found in my dad's old book by HarHarVeryFunny on Thursday May 14, 2026 @08:37AM (#48134521)
What's the logic for putting the initial queen in a corner rather than using the same heuristic as for the remaining places?
Re:Chess puzzle I found in my dad's old book by gw32 on Thursday May 14, 2026 @11:01AM (#48136415)
I was wondering that too. One would think that with a greedy approach, 1 square diagonally from the corner would be better. (But that doesn't work as well.)
Re:Chess puzzle I found in my dad's old book by hammock on Thursday May 14, 2026 @11:46AM (#48137129)
Re:Chess puzzle I found in my dad's old book by HarHarVeryFunny on Thursday May 14, 2026 @12:18PM (#48137532)
The only ones of these I've tried before (on an old 8-bit computer, where the challenge was to keep runtime acceptable) are the knight's tour and the 8-queens "independence" (no co-attacking) problems.

For the knight's tour all you need is a simple heuristic, consistently applied, of doing the hardest bits first - visiting the next square that has fewest remaining squares that lead to it, meaning that you start in a corner. This is what has me wondering about the puzzle/heuristic being discussed where the first placement is using a different heuristic.

On a slow computer the trick to a fast 8-queens solution is to recognize that a minimal constraint is that the queens need to all be on different rows and columns, so you can start by using an efficient permutation algorithm to generate permutations of {1, 2, .. 8} (corresponding to column placement of queen on n'th row), then just check the diagonals of this reasonable number of candidates.

Re:Chess puzzle I found in my dad's old book by iv4122 on Sunday May 17, 2026 @12:44PM (#48170569)
Yes! This is the strategy that worked for me as well.