um...
if (p1Places[y][x])
note the x and y have swapped around. the reason you were going out of bounds, was because the loop using x as a variable is running quicker than the one using y. x was going up to 7 and y to 2. the x loop was causing the error.
have you started moving pieces around?