Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need it in c++. Mostly everything needs to be in functions not main, please use basic c++ syntax. Overview You will create a problem
I need it in c++.
Mostly everything needs to be in functions not main, please use basic c++ syntax.
Overview You will create a problem that takes in a board with chess pieces rom file. For this exercise, the board will only contain pawns and rooks. The dimensions ofthe board will b some M N dimensions where both M and N are greater han 1 Given a board, you will mark all pawns that can be attacked by a rook. Recall, a rook can move horizontally or vertically through empty spaces until it reaches an end of the board or another piece. You job is to read in the file, find all the pawns that can be attacked, and print an updated board to the screen. Piece and Board Representations Rooks: R .Pawns: P Empty spaces:" . When you find a pawn that can be attacked, change it from a 'P' to a T Sample file The files will contain the dimensions on the first line of the file then contain a board with a mix of empty spaces, pawns, and rooks. Command-line argument: s>./labe8 sample.txt Contents of sample.tt input file 4 5 P*P Output to terminal Rx Notes .The pawn at position (3,0) cannot be attacked because there is no rook in its row or column . The pawn at position (3,4) cannot be attacked because there is a piece between it and the rook in its columnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started