Feel free to share
The eight queens problem is a puzzle in which you have to put 8 queens on a regular chess board in such a way that none of the queens can threaten one another. It can be played on bigger or larger grids as well, the only rule you have to follow as far as sizes go is that the measurements of the board are n x n, in which n is the number of queens that need to be placed on a board. So a 4x4 board would need 4 queens, a 16x16 board would need 16 queens, and so on. Note that 2x2 and 3x3 boards will never work.
For those unfamiliar with how chess works, in chess the queen can move as far as she can in any direction (horizontal, vertical, and diagonal) until she either reaches the edge or a spot of a different piece, which she could defeat if desired.
So in this puzzle you have to make sure you place 8 queens in a such a way none of them will bump into each other no matter which direction they'd go.
Note that there is more than one solution. If you need pieces to be in a specific spot within your campaign, making sure some are in a fixed position will help make sure only one solution is possible. This does make the puzzle itself easier of course, and it's usually best to allow for multiple answers anyway, but it's something to keep in mind.
Since this puzzle is a grid based one, converting it to an RPG setting is really easy. The chess element itself allows for tons of fun too, ranging from puzzles posed by a non-player character (NPC) to traps involving having to lure pieces into a specific position.
To give you some more detailed examples, here are three ways to adapt this puzzle in fun ways:
First, the trap and puzzle adaptation. Consider the following: A party steps into a large chamber cut out of the rocks of a mountain. Scattered across a checkered floor are 8 statues, all of them have been toppled over onto their sides. The room itself seems otherwise normal, but there isn't an exit or anything in sight.
A party member will probably try to lift up a statue and put it in its upright position. Congrats, you've just triggered the trap part. All the other statues will swing into their upright position with a burst of magic, and all those breaking the puzzle's rules, as in they threaten each other, will start attacking each other in some form. This could be pulses of magic, this could be actual moving pieces, that part is up to you.
This then triggers the puzzle element of this encounter. Now, this can be done all sorts of ways, but I'll stick to one for this example. The party could try attacking the statues, but it won't help them. The only way to stop the pulsing magic effects is by pushing the statues into the right positions according to the rules of the puzzle. Try not to get caught by the pulses and you'll be fine. Fortunately it's easy to time these pulses, as long as you don't get too close to multiple of them of course.
The puzzle can also be turned into a more role play oriented encounter. Let's take a smaller version of this puzzle, say a 5x5 one. The party will have to deal with 5 sister queens/princesses (have fun keeping them all apart), each of whom want a share of the kingdom left by their late father. Of course, their palaces can't be placed diagonally, vertically, or horizontally from each other on a map, because reasons. Yes, these queens are spoiled, overly demanding, and unwilling to compromise. You could use this to see how your party will deal with these queens. Some will probably end up just robbing them from their kingdoms, or just walking away. Others might even try to go a step further, potentialy forgetting queens usually have guards and armies to protect them.
Like all puzzles, this adaptation can be done all sorts of ways as well. But the point of this one isn't so much figuring the puzzle out, but more about dealing with the queens. To solve the puzzle the map will have to be divided into kingdoms (or queendoms?), but it's impossible to do so fairly in most cases. Even if you divide the kingdom into 5 lines of 5, natural resources will likely be scattered throughout the main kingdom. So, whichever queen is favored by the party will probably reward them better, while those ending up with the shortest straws might want revenge. In other words: more quest and story options!
You could even have the party talk to each queen in private to see who deserves what. Add in a sprinkle of betrayal, a teaspoon of plotting and scheming, and a single puzzle just became an entire story.
Time for a purely trap based version. The party comes across a room with an 8x8 checkered floor. There are 7 (or fewer) statues in the room, all motionless and seemingly harmless. There's a door at the end of the room, and the party can walk around the checkered field if they wish to inspect the door. It won't open. The statues won't move either, but all the checkered floor pieces are pressure plates. All the party has to do is make sure there are 8 figures on the board, so one (or more) of them will have to get on the board. However, should they take position in the wrong spot, one of the statues will be threatened according to the puzzle's rules, and retaliate by immediately shooting a dart/magic spell in the direction of the threat.
Once the right position has been taken, the door opens, and the statues all become harmless.