Super Queen II
5 years ago I wrote about a hypothetical problem related to super queens in chess. You can see the original post here . This post starts with a traditional CS algorithmic problem: the 8-queens problem . The idea is to place 8 queens in a chess board with no two queens threatening each other. I wanted to go a little beyond and redo this problem but now with super queens. To recap, a super queen contains all the powers of a regular queen, but it also has the knight powers. Can it be done then? Can we have an 8-super queens problem solved? Let's see. The idea is to use backtracking with tree pruning. But here is an interesting idea: all you need to solve this problem is actually 5 hash tables that will tell you which queens are dominating the following positions: - The rows - The columns - The first diagonal - The second diagonal - And finally the fifth one, which is the tricky one, marks any square that it being attacked by any queen in a knight-like ...