In the diagram below, north has just moved c000 and attacks pit A with both e and d. A counter attack by moving pit D doesn't fix the problem because north would take 5 points from south's cup, while south would capture the last gem in play, worth 1 point.

1D0-e0Capturing 5 from south's cup.
2E0Capturing 1 from north's b-pit.

See next diagram.

1A0Attacking pit e.
2B0000Capturing 1 from north's b-pit.

See next to next diagram.

tempoFrom south's point of view the problem is that he has 13 points and that he will lose if north succeeds in leaving him without a move.
This danger however is not immediate: tempo conditions are heavily in south's favour. But he faces the task of feeding north in such a way that the latter cannot avoid a capture, tipping the scales, and making sure north cannot recapture, and making sure he can next leave north without a move.
This might prove problematic.

tempoThe alternative to the above is moving pit A, simultaneously attacking pit e.
From north's point of view this attack is no big deal: a one point gem doesn't tip the scales, so he must make an indirect capture anyway. He might decide to allow it, to prepare a little trap with d00. If south now captures with B0000, we're in the diagram shown.
Tempoconditions now are in north's favour so eventually south will have to move pit A and allow a capture that will tip the scales.

Endgames can be very complicated, but a writing a good program may be a matter of routine nowadays.