Follow

A neat puzzle I just saw: You can place a black king anywhere you like on a chessboard of a given size m×n. Where do you place it such that you can place also the maximal number of white queens that do not attack the king? And how many of those queens can you place?

@Rosemary

Here's my first guess: put the king in one corner, then put queens in every single other square of the board that isn't in the same row, column, or diagonal as the one with the king. There will be (m-1)+(n-1)+(min(m,n)-1)+1 of those squares, so you get mn-m-n-min(m,n)+2 queens total. On an 8x8 board, that'd be 64-8-8-8+2 or 42.

I'm assuming it doesn't matter if the queens can attack one another; you didn't say it mattered.

@dodec
I think that would make the most sense. Placing the King anywhere other than a corner would provide a 4th attack axis that would add Qveens, but not eliminate any existing ones.
@Rosemary

@JulieSqveakaroo @dodec It seemed like a more interesting problem at first, but yeah, this sounds right.

@Rosemary @JulieSqveakaroo @dodec I think you can place it anywhere along the short edges, actually

each diagonal square you add by moving it away from the corner is going to correspond to a diagonal square removed on the other side

@Rosemary In a corner, I guess, because you rule out one row and one column no matter what, and as far as I can tell you can't do any better than ruling out only one diagonal... So that would leave mn - m - (n - 1) - (min(m, n) - 1) queens

@Trinket @Rosemary Unless it's a trick question and it's like "well it doesn't say those are the *only* pieces you can place", in which case you get mn - 4 by putting the king in a corner surrounded by three other black pieces

@Trinket It seems to be a less interesting problem than I'd initially thought.

Sign in to participate in the conversation
Awoo Space

Awoo.space is a Mastodon instance where members can rely on a team of moderators to help resolve conflict, and limits federation with other instances using a specific access list to minimize abuse.

While mature content is allowed here, we strongly believe in being able to choose to engage with content on your own terms, so please make sure to put mature and potentially sensitive content behind the CW feature with enough description that people know what it's about.

Before signing up, please read our community guidelines. While it's a very broad swath of topics it covers, please do your best! We believe that as long as you're putting forth genuine effort to limit harm you might cause – even if you haven't read the document – you'll be okay!