- isAttackedByPawn([x, y], colors) {
- const pawnShift = 1;
- if (x + pawnShift < V.size.x) {
- for (let c of colors) {
+ isAttackedByPawn([x, y], color) {
+ // Pawns can capture forward and backward:
+ for (let pawnShift of [-1, 1]) {
+ if (0 < x + pawnShift && x + pawnShift < V.size.x) {