Sunday, July 06, 2008

Bacon numbers (3)

A correction to my original post on the subject: my program uses a breadth-first search algorithm. Prolog uses by default the depth-first search algorithm, along with backtracking, which can be simulated in Pascal using recursion (and indeed, the example which I quoted of trying to calculate which bills a customer has paid uses recursion).

Breadth-first uses an explicit list, instead of implicit stacks. Delphi's TStringList type serves this purpose admirably.

I added an extra twist to the final output: instead of simply listing the steps between actors, the connecting films are also named.

No more on this subject.

No comments: