fix board.go bugs

This commit is contained in:
kyodesle 2026-08-28 10:45:08 -07:00
parent 7f22b4f4b3
commit 73aa9f8854
2 changed files with 2 additions and 2 deletions

View File

@ -71,7 +71,7 @@ func (b *Board) isSquareAttacked(pos Position, byColor int) bool {
r, c := pos.Row, pos.Col
pawnDir := 1
if byColor == Black {
pawnDir = -1
pawnDir = 1
}
for dc := -1; dc <= 1; dc += 2 {
nr, nc := r-pawnDir, c+dc
@ -199,7 +199,7 @@ func (b *Board) pawnMoves(from Position, color int) []Move {
r, c := from.Row, from.Col
dir := 1
if color == Black {
dir = -1
dir = 1
}
nr := r + dir
if b.inBounds(nr, c) && b.Grid[nr][c].Piece == Empty {

BIN
chess

Binary file not shown.