Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Fixed per Dr. Hansen's Request
Browse files Browse the repository at this point in the history
  • Loading branch information
hearnadam committed Apr 6, 2021
1 parent 02452b8 commit 4fe54af
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/chess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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[]) {
Expand Down

0 comments on commit 4fe54af

Please sign in to comment.