I coded my thought process of a specific example if it helps clarify what I'm talking about:
https://gist.github.com/TheUltDev/fc8386e42205504c55d1cf2127...
(as this is a state of mind and logic thing, a program of state and logic is a better way to describe it vs words)