C Help chess program

FratBro23
Category:
Programming
Price: $25 USD

Question description

For the next step of this program, insert into your next program the Chess.h found in 

the following link: (You can ignore the Chess class in this file because we will 

be focusing on the ChessPiece class)

 chess.html

Implement Chess.cpp to provide implementation for the ChessPiece class.  Then 

run the following program: (Note the expected output shows up in the comment of this program)

******************************************

#include <iostream>

#include <string>

using namespace std;

#include "Chess.h"

void testOtherPieces()

{

    // This part is optional, but you could add some code here to test out 

    // the other ChessPiece class types (Rook, Knight, etc.)

    // Write some code to create the other pieces (Rook, Knight, Queen, and King)

    // and call the move routine.  Test to make sure they worked by calling the isAt() routine. 

}

int main()

{

    ChessPiece arr[8] ; // This will use the default constructor

    ChessPiece  blackBishop(Bishop, Black,    0, 2);

    blackBishop.move(4, 6);

    if (blackBishop.isAt(4,6))

        cout << blackBishop.getId() << " " << blackBishop.getFullName() << " 4:6" << endl;

    if (!blackBishop.isCaptured())

        cout << "black Bishop is not captured yet"<<endl;

    Color color = blackBishop.getColor();

    cout << "Color of black Bishop is " << color << endl;

    ChessPiece whitePawn(Pawn, White, 6,7);

    whitePawn.move(5,7);

    whitePawn.captureMove(4,6);

    blackBishop.setCaptured();

    if (blackBishop.isCaptured())

        cout << "black bishop is now captured" << endl;

    /*

    The output of your program for the above should be something like:

BB BlackBishop 4:6

black Bishop is not captured yet

Color of black Bishop is 1

black bishop is now captured

Press any key to continue . . .

    */

    // Add your own code to test the move routine for Rook, Knight, Queen, and King

    // This part is optional, but it can give you a mechanism to try out the moves for 

    // your other chess piece types (Rook, Knight, etc.)

    testOtherPieces();

   

    return 0;

}


Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR
Studypool has helped 1,244,100 students
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1824 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors