当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

3513:King’s Case

题目描述
As you maybe know, Chess is a board game played between two players. It is played on a chessboard, which is a square-checkered board with 64 squares arranged in an eight-by-eight grid. At the start, each player controls sixteen pieces: one king, one queen, two rooks, two knights, two bishops, and eight pawns. The object of the game is to checkmate the opponent's king, whereby the king is under immediate attack (in "check") and there is no way to remove or defend it from attack on the next move.

The board has eight rows (called ranks and denoted with numbers 1 to 8) and eight columns (called files and denoted with letters a to h).
White always moves first. After the initial move, the players alternately move one piece at a time (with the exception of castling, when two pieces are moved). Pieces are moved to either an unoccupied square, or one occupied by an opponent's piece, capturing it and removing it from play. With the sole exception of en passant, all pieces capture opponent's pieces by moving to the square that the opponent's piece occupies. (In this problem, there will not be ‘en passant’, ‘Castling’ or ‘Promotion’. This simplifies the problem a little.)

Each chess piece has its own style of moving.

●  The king moves one square in any direction. The king has also a special move which is called castling and also involves a rook, but not in this problem!
●  The rook can move any number of squares along any rank or file, but may not leap over other pieces. Along with the king, the rook is also involved during the king's castling move, but not in this problem!
●  The bishop can move any number of squares diagonally, but may not leap over other pieces.
●  The queen combines the power of the rook and bishop and can move any number of squares along rank, file, or diagonal, but it may not leap over other pieces.
●  The knight moves to any of the closest squares which are not on the same rank, file or diagonal, thus the move forms an "L"-shape two squares long and one square wide. The knight is the only piece which can leap over other pieces.
●  The pawn may move forward to the unoccupied square immediately in front of it on the same file, or on its first move it may advance two squares along the same file provided both squares are unoccupied, or it may move to a square occupied by an opponent’s piece, which is diagonally in front of it on an adjacent file, capturing that piece. The pawn has two special moves, the en passant capture, and pawn promotion, but not in this problem! Just as you see, the white pawn move upward and the black pawn move downward.


A player may not make any move which allows the King to be captured. If such a move is not possible, the game ends. The result will be a checkmate, if king is under immediate attack or stalemate, if it is not. -----Wikipedia.
The question your program should answer is when a player makes a move, determine the result of the move. The result can be one of these,

Checkmate! -----------------This move result a win.
Draw -------------------------This move result a stalemate
Check! -----------------------The game has not finished yet, but this move is a check
Just a normal move --------The game has not finished yet, and this move is not a check
This is not a legal move --This is happened when move a piece not belongs to it, want to eat a piece belongs to it, want to move a piece not under the style of that kind of piece, when you under check that move is not a right response or after that move you king will be capture.

输入解释
The input will consist of one or more test cases.
The first line of the input will be a single integer T, indicates the number of the cases.
Each test case adheres to the following format:
● On the first line there will be “White makes a move” or “Black makes a move”.
● On the second line have two positions indicate the move from and to. The position is such is “e4”, in a lowercase character ‘a’ to ‘h’ and a number from 1 to 8. So the positions are always in the board.
● On the next 8 lines will represent the board before the move.
● The Black pieces will be represented by uppercase characters. K for King, Q for Queen, R for Rook, B for Bishop, N for Knight, P for Pawn. The White pieces will be represented by lowercase characters, just like the Blacks. You may assume the board before move is legal and the game have not finished yet. Squares has no piece in is represented by ‘.’.
There is not white line between cases.
输出解释
Output “Checkmate!”, “Draw”, “Check!”, “Just a normal move” or “This is not a legal move” in a line.
输入样例
2
White makes a move
e2 e4
RNBQKBNR
PPPPPPPP
........
........
........
........
pppppppp
rnbqkbnr
Black makes a move
b8 b1
.R....K.
.....PPP
........
......r.
........
........
.....ppp
......k.
输出样例
Just a normal move
Checkmate!
来自杭电HDUOJ的附加信息
Recommend zhouzeyong

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-3513

最后修改于 2020-10-25T23:04:18+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 65536/32768K(Java/Others)