This just doesn't sound like programming! The whole vibe of this conversation was that of a really smart person flailing around trying to coax a thing with semi-random behaviour to do an important task, and then blaming himself for getting stressed about the thing not doing what you asked it to.
It just reminded me of getting a young kid to do something.
And that usually ended in both of us crying.