I really like this problem, but I don't understand why 'h6' has 'Kg7' in check in Problem 2, but 'e1' does not have 'Kf2' in check in Problem 6. Aren't these two situations the same?
the opponent's pawn can never be in row-1. they can only move/check forward.
Thanks, but my point is that the pawn is in row-1 in *both* cases, so they should both be in check or neither should be in check. Since you described 'x' as being the 'opponent King', I think that both should be in check.
i might not have understood u totally.
what i meant to say is that -- there are some invalid position/moves. for example, the pawn can jump from a2 to a4 but not from a3 to a5-thats an invalid move. similarly a white pawn can never be at the location a1-- their position starts from a2-so placing a pawn in row-1 is an invalid move.
in test-6, the pawn in e1 could check the king - but its own position is invalid.it could not be in that position in the 1st place. thats why 0.
in test-2,3; the pawn is in h6. a pawn can be in the column-h or row-6.so thats a valid position.
Aha! Tricky, and very clever. Thanks for posting this interesting problem!
Most nonzero elements in row
Back to basics 14 - Keywords
Flip the main diagonal of a matrix
How to add?
The Dark Side of the Die
Fault in our Stars - 02
How lucky r u ?
Summing Rows and Columns
Queen's move - 02
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office