See how SOLIDWORKS Motion solves this puzzle:
Computer solves two marbles two holes puzzle - YouTube