code: func (pos *Position) Update(m *Move) *Position {
  	moveCount := pos.moveCount
  	if pos.turn == Black {
  		moveCount++
  	}
  	cr := pos.CastleRights()
  	ncr := pos.updateCastleRights(m)
  	p := pos.board.Piece(m.s1)
  	halfMove := pos.halfMoveClock
  	if p.Type() == Pawn || m.HasTag(Capture) || cr != ncr {
  		halfMove = 0
  	} else {
  		halfMove++
  	}
  	b := pos.board.copy()
  	b.update(m)
  	return &Position{
  		board:           b,
  		turn:            pos.turn.Other(),
  		castleRights:    ncr,
  		enPassantSquare: pos.updateEnPassantSquare(m),
  		halfMoveClock:   halfMove,
  		moveCount:       moveCount,
  		inCheck:         m.HasTag(Check),
  	}
  }
docs: // Update returns a new position resulting from the given move.
  // The move itself isn't validated, if validation is needed use
  // Game's Move method.  This method is more performant for bots that
  // rely on the ValidMoves because it skips redundant validation.