Write a program, which, upon gazing at a chess table, can say whether there is a check or a checkmate.
Input: a chess table in text form, the last line of the input being the first rank (the starting line of White)
The starting position in this input would look like this (space is an empty square, capital letters are White): why aren't the spaces displayed here?
rnbqkbnr pppppppp PPPPPPPP RNBQKBNR
The program should print one or more of the following (without quotes, of course), depending on the situation:
- "The White King is in check!" (if already in checkmate, don't display this!)
- "The Black King is in check!" (if already in checkmate, don't display this!)
- "The White King is in checkmate!"
- "The Black King is in checkmate!"
- "White is in stalemate!" (There would be a stalemate if White moved - optional)
- "Black is in stalemate!" (There would be a stalemate if Black moved - optional)
- "Both kings are safe for now." (if none of the above apply)
The input is guaranteed to be correct and be a legal chess position (no two kings of the same color, no two kings in check, etc.).
The score is the character count, lowest wins, not sooner than 10 days after the first valid answer. If the optional stalemate evaluation is implemented, the size will be decreased by 20% (for this situation, assume en-passant cannot be performed).