I dont think that human can learn this algorithms.
You should use machine learning. I think that those are ranking algorithm. Basically create a training set of known examples that you have, and try to predict the same behavior.
I do not think that this can be done via rule based approach.