I thought I’d do another chess puzzle this month. This one is a variant on the Eight Queens problem:
Given the standard 8×8 chessboard, place an equal number of Knights and Queens such that no piece is attacked by another. What’s the maximum number of Knights and Queen’s you can place? Obviously you should use SQL to find the answer!
I’m sure you all know how a knight moves and attacks in chess, but just in case here’s a diagram:
The white circles show each possible move for the knight, i.e. it can move two squares in one direction and then 1 square perpendicular to that (or vice-versa). An “L” shape.
Have fun!If this post has helped you, consider buying me a coffee to say thanks.
2 thoughts on “SQL Puzzle 3: Knights and Queens”