Tideman lock_pairs

Those pictures provided by mwk0408 are great, they're the ones that helped me figure it out as well.

Also, I noticed your checkcycle function is checking whether there is already an edge from the loser to the winner. You don't need to check for that, as the add_pair function already made sure of that!

Instead, start to check whether the loser wins from any other candidates, and after that use recursion or iteration to keep checking every possibility.

>!(if the loser never wins, then your function is done. If he/she does win from any other candidates, check whether one of these candidates won from the winner. If so, there's a cycle. If not, check whether one of these candidates won from any other candidates. If so, check whether one of these candidates won from the winner. If not, check whether one of these candidates wins from any other candidates. And so on, and so on.... Notice the repetitiveness of these last sentences?!<

/r/cs50 Thread