2. Complete the following function to validate the move of a given chess piece and return True (boolean) if the move is valid or False(boolean) if the move is invalid. The chessboard is given below for your reference.
The function takes 3 arguments
Piece can be a "Knight" or "Bishop"
Current Position(a string) is a combination of row and column it be anything between "a1" to "h8". Current Position represents the cell on the chessboard where the piece is currently located
Next position(a string) is also a combination of row and column and can also be between from "a1" to "h8". Nextposition represents the cell to which the piece is intended to be moved
Answers
Answered by
0
Explanation:
The program is supposed to print True or False depending on whether an arbitrary dictionary stored in a variable meets the criteria for a chess board. The criteria is as follows : A valid board will have exactly one black king and exactly one white king. Each player can only have at most 16 pieces, at most 8 pawns, and all pieces must be on a valid space from '1a' to '8h'; that is, a piece can’t be on space '9z'. The piece names begin with either a 'w' or 'b' to represent white or black, followed by 'pawn', 'knight', 'bishop', 'rook', 'queen', or 'king'. This function should detect when a bug has resulted in an improper chess board.
Similar questions