Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given a regular 8 X 8 chessboard in initial state and a set ofmoves, show the resulting board after making the listed moves,using Lex. Each

Given a regular 8 X 8 chessboard in initial state and a set ofmoves, show the resulting board after making the listed moves,using Lex. Each tile of the chess board is represented by acoordinate pair consisting of a letter and a number. Columns areidentified with letters from a through h starting from White’s leftto right. Rows are identified with numbers from 1 to 8 from White’sside of the board. (Source: Wikipedia) A variation of Algebraicnotation called, Long Algebraic Notation would be used to describethe set of moves. Following are the symbols used in this notationto denote the appropriate pieces in a chess board. Symbol Name KKing Q Queen R Rook B Bishop N Knight Pawns are identified bythe absence of upper-case letter. Moves are represented by thepiece’s uppercase letter followed by the current position and thedestination. For example: e2-e3 denotes that a pawn moves from e2to e3; Ra8-a6 denotes the move of a Rook from a8 to a6. When a moveresults in capture, instead of -, an x symbol is used. For example:Ra6xa5 denotes capture of a piece in a5 when Rook moves from a6 toa5. Pawn promotes to Queen / Bishop / Knight / Rook when it movesto the last rank in the enemy line. It is represented by an =symbol followed by the symbol of promotion. For example: a2-a1=Qindicates promotion of a Pawn to Queen after making a move from a2to a1. Input and Output notation: Input is the sequence of numberedturns, where each turn contains a space separated information onmoves made by White followed by Black in that turn. Output is theresulting chess board in the following format: a b c d e f g h1

2

3

4

5

6

7

8

Where

denotes the symbol for each piece. Use R, N, B, K, Q, P forRook, Knight, Bishop, King, Queen and Pawn respectively.

slot may be empty if there are no pieces in that slot. Thereshould be a tab space between each literal in the output and onenew line space (i.e. two ‘’) between adjacent lines. Note thatthe white pieces start from a1 as described earlier. It would begood to assume that the inputs would have moves only in the saidformat - No checks/checkmates shall be encountered, no castling,etc. Sample: Input: 1. e2-e4 e7-e5 2. Ng1-f3 Nb8-c6 3. Bf1-b5Ng8-f6 4. Bb5xc6 b7xc6 Output: a b c d e f g h 1 R N B Q K R 2 P PP P P P P 3 N 4 P 5 P 6 P N 7 P P P P P P 8 R B Q K B R

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Give the numerical coefficient and the degree of each term. 2

Answered: 1 week ago