/ Published in: Perl
My PERL isn't strong enough to get this yet, but I plan on porting to C#.
Read this: http://en.wikipedia.org/wiki/Markov_chain
Read this: http://en.wikipedia.org/wiki/Markov_chain
URL: http://www.beetleinabox.com/markov.html