Skip to content

Commit

Permalink
bugfix: king position not updating properly after long castle
Browse files Browse the repository at this point in the history
- This causes valid move generation to fail and allow illegal king moves like capturing a defended piece or moving next to the enemy king
  • Loading branch information
dechristopher committed Mar 3, 2021
1 parent 4de4072 commit 45d3763
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions board.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,14 @@ func (b *Board) calcConvenienceBBs(m *Move) {
}
} else if m.s1 == b.whiteKingSq {
b.whiteKingSq = m.s2
if m.HasTag(FarPawnCastle) {
b.whiteKingSq = C1
}
} else if m.s1 == b.blackKingSq {
b.blackKingSq = m.s2
if m.HasTag(FarPawnCastle) {
b.blackKingSq = B4
}
}
}

Expand Down

0 comments on commit 45d3763

Please sign in to comment.