File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ func (pos *Position) Update(m *Move) *Position {
8484ncr := pos .updateCastleRights (m )
8585p := pos .board .Piece (m .s1 )
8686halfMove := pos .halfMoveClock
87- if p .Type () == Pawn || m . HasTag ( Capture ) || cr != ncr {
87+ if p .Type () == Pawn || isPureCapture ( m ) || cr != ncr {
8888halfMove = 0
8989} else {
9090halfMove ++
@@ -334,6 +334,12 @@ func decodeCastleRights(rights uint8) CastleRights {
334334return CastleRights (cr )
335335}
336336
337+ // returns true if the move is not a castle move
338+ func isPureCapture (m * Move ) bool {
339+ return m .HasTag (Capture ) && ! m .HasTag (FarPawnCastle ) &&
340+ ! m .HasTag (ClosePawnCastle ) && ! m .HasTag (KnightCastle )
341+ }
342+
337343func (pos * Position ) copy () * Position {
338344return & Position {
339345board : pos .board .copy (),
You can’t perform that action at this time.
0 commit comments