My original intuition was to place the queens on unique rows and columns to cover as much as possible but it turns out there are solutions with three of them on the same row.
0. precompute the attack patterns of each possible queen/bishop location as a bitmask, stored as an integer
1. generate candidate solutions, allowing attack rays to pass through other pieces, by brute forcing the positions of the 5 pieces and taking the bitwise OR of their attacks
2. out of the candidate solutions, check which ones are actually valid taking into account occlusion. Actually, you only need to check if the queen's horizontal attack is blocked by the bishop, as queens cannot block each other (the blocking queen herself has the same attacks so they effectively pass through each other).
> The task is to place four black queens and one black bishop on the chessboard so that there is no square not under their attack. In other words, after arranging the five black pieces, it must be impossible to place the white king anywhere without it being in checkmate.
That last word should be "check". not "checkmate". A king next to an unprotected queen will be in check but not checkmate as it can capture the queen.
That assumes you can place the king on the board and move immediately. I think the puzzle assumes you can’t do that; that placing your king on the board is your move, thus ending your turn.
The wording is very unambiguous, it means something very specific in chess. In every legal chess position either White is checkmated or Black is checkmated or (by far the most common except in film and TV!) neither side is checkmated. So the wording is crystal clear, you should be able to freely place the White king on any of the unoccupied 59 squares and the position will be one of those in which White is checkmated.
A real shame, this totally ruined the puzzle for me as it seemed so unlikely that all five Black pieces would be mutually protected. I should have forced myself to ignore the faulty clause and try to solve without it. The bad clause is also completely unnecessary - one of those cases where deleting text (or code!) is an improvement with no downside!
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.
> In other words, after arranging the five black pieces, it must be impossible to place the white king anywhere without it being in checkmate.
I think this is a bit ambiguous and, strictly speaking, wrong for the solution as given.
In particular, this asks for the king to be in check _mate_. Does this require all black pieces to defend each other? Otherwise, white king on the board would not be in checkmate if you place it next to a queen and can immediately capture.
From the solution, you can see it's not a checkmate requirement, just a check requirement.
Please don’t use red and green for the colors in the “check” mode, it’s hard to tell apart for colorblind people (especially against the partially shaded black squares).
In fact, there isn’t really a need for two colors. Just color the squares that are threatened by the pieces and leave the rest blank. The meaning will be obvious.
I started with 4 queens placed symmetrically on c7,g6,f2,b3, which covers everything except corners. Then I shifted all of them diagonally, i.e. to d6,h5,g1,c2. And it turns out, then only a8 and b7 are not covered, which can be easily solved by placing bishop anywhere at diagonal, e.g. h1.
I found this solution (actually, it's 4 solutions, each B is a different Bishop placement and at the same time it's the only 4 spots on the board not covered by queens):
I've been playing a lot of Go lately and it's lowkey ruined chess for me. I ended up uninstalling Lichess because I simple don't use it anymore. Nothing against chess, just my personal taste.
My friend code on BadukPop is EGVNY if anyone wants to play together!
It's a black bishop, but not necessarily a dark-squared bishop. Both the black side and white side in a normal chess game get a dark-squared and a light-squared bishop, and I don't see anywhere that specifies which type this one is. It can be either one depending on where you place it.
that's exactly what happened to me. I ended up spending so much time thinking black bishop can only go to black squares. and agreed this is a bit ambiguous.
fun demo. could be a daily puzzle combining various commenter suggestions. There are (didn't verify personally) 388 solutions. The daily puzzle could remove 1+ pieces and ask for a 1+ move guess.
Also a click on a square could auto place a queen and a second click would swap to the bishop. Every click could auto-check.
A separate discovery mode could start blocking out the squares visually as you place pieces. For a lot of people, that would be easier than the mental representation.
> The task is to place four black queens and one black bishop on the chessboard so that there is no square not under their attack
> In other words, after arranging the five black pieces, it must be impossible to place the white king anywhere without it being in checkmate.
These two sentences mean very different things in the normal rules of chess. And if you replace the word “checkmate” with the word “check” in the second sentence it still doesn’t mean the same thing as the first sentence.
The first sentence implies that all the pieces must be defended.
Edit: Eh, I guess it depends on how you view the word “attack” since all the pieces are the same colour.
Python script: https://gist.github.com/dllu/698d5f71b2b9735c5c462ddf4a2f6fc...
Here's how it works:
0. precompute the attack patterns of each possible queen/bishop location as a bitmask, stored as an integer
1. generate candidate solutions, allowing attack rays to pass through other pieces, by brute forcing the positions of the 5 pieces and taking the bitwise OR of their attacks
2. out of the candidate solutions, check which ones are actually valid taking into account occlusion. Actually, you only need to check if the queen's horizontal attack is blocked by the bishop, as queens cannot block each other (the blocking queen herself has the same attacks so they effectively pass through each other).
That last word should be "check". not "checkmate". A king next to an unprotected queen will be in check but not checkmate as it can capture the queen.
A real shame, this totally ruined the puzzle for me as it seemed so unlikely that all five Black pieces would be mutually protected. I should have forced myself to ignore the faulty clause and try to solve without it. The bad clause is also completely unnecessary - one of those cases where deleting text (or code!) is an improvement with no downside!
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.
I think this is a bit ambiguous and, strictly speaking, wrong for the solution as given.
In particular, this asks for the king to be in check _mate_. Does this require all black pieces to defend each other? Otherwise, white king on the board would not be in checkmate if you place it next to a queen and can immediately capture.
From the solution, you can see it's not a checkmate requirement, just a check requirement.
In fact, there isn’t really a need for two colors. Just color the squares that are threatened by the pieces and leave the rest blank. The meaning will be obvious.
My friend code on BadukPop is EGVNY if anyone wants to play together!
Should maybe update the instructions to clarify that the dark-squared bishop is not constrained to dark squares.
sorry, "The task is to place four black queens and one black bishop on the chessboard" is not at all ambiguous.
where did you read "dark-squared"?
Also a click on a square could auto place a queen and a second click would swap to the bishop. Every click could auto-check.
A separate discovery mode could start blocking out the squares visually as you place pieces. For a lot of people, that would be easier than the mental representation.
> In other words, after arranging the five black pieces, it must be impossible to place the white king anywhere without it being in checkmate.
These two sentences mean very different things in the normal rules of chess. And if you replace the word “checkmate” with the word “check” in the second sentence it still doesn’t mean the same thing as the first sentence.
The first sentence implies that all the pieces must be defended.
Edit: Eh, I guess it depends on how you view the word “attack” since all the pieces are the same colour.
https://knight-queen-game.netlify.app/