Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; enum piece_t {EMPTY, PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING}; enum side_t {WHITE, BLACK}; int main() { //Set up the board

#include #include using namespace std;

enum piece_t {EMPTY, PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING}; enum side_t {WHITE, BLACK};

int main() { //Set up the board //Get # of moves //Read in and perform moves //Print out the board return 0; }

**PLEASE USE THE FORMAT ABOVE**

image text in transcribed image text in transcribed

Write a program that is capable of replaying the moves in a chess match. The user will first enter the number of moves, then they will type in moves of the form: where [a] can be any letter a-h (representing a column on the board), the piece at the first position and moves it to the second can be 1-8 (representing a row on the board), and the move takes For example, the common opening move c2-c4 would take the chess piece at c2 (initially a pawn) and move it to space c4. Note that every move will leave its initial space (c2) empty afterwards, and when a piece moves to a space occupied by another piece, the existing piece is taken away and the 'capturing" piece occupies that space The game of chess is played between two opposing players, white and black, where each player starts 16 pieces of 6 different types: pawn, rook, knight, bishop, queen, and king. Initially, white's pieces occupy rows 1 and 2, while black's pieces occupy rows 7 and 8. All of the pieces on rows 2 and 7 are pawns, though the pieces on rows 1 and 8 differ. Columns a and h on these rows have rooks, b and g have knights, c and f have bishops, d has the two queens, and e has the two kings Using P R, N (knight), B, Q, and K to represent the chess pieces (capital for white and lowercase for black) and. to represent an empty space, we can draw this initial board as

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

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago