Calvin, Monkeys, Tolstoy and Shakespeare (by yag)
Calvin Hsia is the lead developer on Visual FoxPro and is always coming up with interesting bits of example code. It usually starts with the two of us together and him saying “back when I was in college…” <g>
Anyway, today we were having our weekly 1:1 meeting and wouldn’t you know it he pointed me to a new piece of code he wrote that auto-generates text based on a seed file. In essence, he takes the seed file (his example was War and Peace) and using a random number generator and an extrapolation of what letters usually follow others (“q” is usually followed by “u”, etc.), he generates random text that isn’t so, er, random.
Here’s a sample of what he generated:
The Guards had already left Petersburg on the tenth of August and her son who had remained in Moscow for his equipment was to join them on the march to Radzivilov. It was St Natalias day and the name day of two of the Rostovs the mother and the youngest daughter both named Nataly.
Anyway, I thought it was interesting. You can look at the VFP source here: http://www.calvinhsia.com/vfp/monkeys.asp