Skip to content

Commit

Permalink
Fixes bug with Pawn threat detection.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mariano Gappa committed Jan 6, 2020
1 parent 92a0776 commit e816a9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions api/chess.go
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ func (g game) xyThreatenedBy(sq xy, owner color, checkAllThreats bool) []piece {
}

// Pawns
pawnXYs := []xy{sq.add(xy{-1, -1}), sq.add(xy{1, -1})}
pawnXYs := []xy{sq.add(xy{-1, 1}), sq.add(xy{1, 1})}
if owner == colorWhite {
pawnXYs = []xy{sq.add(xy{-1, 1}), sq.add(xy{1, 1})}
pawnXYs = []xy{sq.add(xy{-1, -1}), sq.add(xy{1, -1})}
}
if piece, ok := g.pieces[opponent][pawnXYs[0]]; ok && piece.pieceType == piecePawn {
pieces = append(pieces, piece)
Expand Down

0 comments on commit e816a9d

Please sign in to comment.