Implementation Some of Game Theory Algorithms Top Trading Cycle Gets preferences of the agents and outputs a stable permutation. Stable Marriage Gets the preference matrix of boys and girls and find a boy-optimal and a girl-optimal stable marriage.