From 4fe54af5e6a830170bd0cfd690eb86241462418b Mon Sep 17 00:00:00 2001 From: Adam <22334119+Akinventor@users.noreply.github.com> Date: Tue, 6 Apr 2021 14:52:56 -0700 Subject: [PATCH] Fixed per Dr. Hansen's Request --- src/chess.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/chess.cpp b/src/chess.cpp index 934a980..875d26d 100644 --- a/src/chess.cpp +++ b/src/chess.cpp @@ -37,6 +37,14 @@ void setupBoard(Board& board) { board.squareAt(i,1).setOccupier(new Pawn(WHITE)); } + // Set White Piece Locations + for (int i = 0; i < 2; i++) { + for (int j = 0; j < 8; j++) { + Square& aSquare = board.squareAt(j,i); + aSquare.occupiedBy().setLocation(&aSquare); + } + } + // Setup Black Pieces board.squareAt(0,7).setOccupier(new Rook(BLACK)); @@ -51,6 +59,14 @@ void setupBoard(Board& board) { for (int i = 0; i < 8; i++) { board.squareAt(i,6).setOccupier(new Pawn(BLACK)); } + + // Set White Piece Locations + for (int i = 6; i < 8; i++) { + for (int j = 0; j < 8; j++) { + Square& aSquare = board.squareAt(j,i); + aSquare.occupiedBy().setLocation(&aSquare); + } + } } int main(int argc, char* argv[]) {