A higher resolution is required to access the IDE
- 240
Learning Opportunities
This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
Statement
Goal
8 x 8 space-separated character rows of a chessboard with only two pieces on the board. Your King and some enemy piece. Print "Check" or "No Check" depending on whether the enemy piece is able to attack your king on the next turn.The King will be a
Bishops (
Rooks (
Queens (
Knights (
Diagram for the squares a Knight can attack (NB: x is used here to indicate these squares, will never be in the game input):
_ _ _ _ _ _ _ _
_ _ x _ x _ _ _
_ x _ _ _ x _ _
_ _ _ N _ _ _ _
_ x _ _ _ x _ _
_ _ x _ x _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
If a King is in any of those x positions relative to the Knight on the input diagram, then the answer is "Check", otherwise "No Check".
Input
8 lines of : 8 space-separated characters, mostly underscores with exactly one K and one of B /N /R /Q .
Output
1 line : "Check" if the King is in check or "No Check" if not.
Constraints
Only two pieces on the board. Only non-space characters in input are _ , one K and one of B /N /R /Q . Always an 8x8 size board, always two pieces.
Example
Input
_ _ R _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ K _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Output
Check
A higher resolution is required to access the IDE