GOOOOOAAAAAAALLLL!

chaoticset on 2002-08-22T07:38:48

It works. The function get_chain($start_url, $target_url); will return an array of URLs if nothing fails in the function. It stops at a depth of fifty links, currently. (I'll be able to fine tune that later, and I've already been thinking about making the depth switchable on the function call, like get_chain($start_url, $target_url, $search_depth); .)

It's also with the caveat that -- roughly nine times out of ten -- my current method for choosing which link to traverse next (pseudorandom selection) will result in bad links or hitting the maximum depth of searches instead of successfully locating the target. Other than the fact that it fails 90% of the time, it WORKS!

Maybe I shouldn't be this enthused.

Anyway, I hope to work on it a little bit tomorrow. Everything's in place to help make that random traversal a little smarter, I just have to write some rules. Should be easy as pie.

Of course, I thought I'd have this thing written and working by now, too...hm. :\

Anyway, here's the output from my test script the first time it ran without failure and lots of unit tests everywhere.

The first link is http://use.perl.org/user/chaoticset/
which then links to http://5050.blogspot.com/
which, lastly, links to http://use.perl.org/.