rules-based algorithm

rules-based algorithm