Create algorithm for victory