i've been searching for an answer, but i get more and more confused.
i have these 2 for loops
for (int i = 1; (i < 5) && move.from[i - 1]; i++) {
int const departurePoint = move.from[i - 1];
int arrivalPoint = move.to[i - 1];
if (arrivalPoint < 0) { // A blot was hit
arrivalPoint = -arrivalPoint;
board[1 - turn][BAR - arrivalPoint]--; // Remove the blot
board[1 - turn][BAR]++; // and place it on the bar */
}
board[turn][departurePoint]--; // Move our own checker
board[turn][arrivalPoint]++; // to it's landing spot.
}
and
for (int i = 1; (i < 5) && move.from[i - 1]; ++i) {
int const departurePoint = move.from[i - 1];
int arrivalPoint = move.to[i - 1];
if (arrivalPoint < 0) { // We hit a blot
arrivalPoint = -arrivalPoint;
board[1 - turn][BAR - arrivalPoint]++; // Replace the blot
board[1 - turn][BAR]--; // remove it from the bar
}
board[turn][departurePoint]++; // Replace our own checker
board[turn][arrivalPoint]--; // to it's original spot.
}
my questions are:
- In the for loop statement with pre-increment, has i been incremented when the "move.from[i - 1] is evaluated?
- Has i been incremented in the body of the statement?