Friday, July 04, 2008

Bacon numbers (2)

I wrote before about matching Warren Beatty with Diane Keaton. If I ask the program to work that way, it can't find a match, but if I ask it to match Diane with Warren, a change which theoretically shouldn't make any difference, then it immediately answers with '2' (via Shelley Duvall). Hmmm. Why does this happen? Should I use heuristics? Maybe the second person should be the one who has fewer movies in my collection. Update: a quick debugging run with logging reveals the mistake. I had the wrong termination condition - the program should finish when there is a match or the list of candidates is empty. After changing the program slightly, it now finds the distance between Warren Beatty and Diane Keaton; slowly in one direction, quickly in the other.

No comments: