The Markov Chain algorithm is used to generate random output text from a given input text. This particular implementation is largely derived from the Kernighan and Pike implementation detailed in "The Practice of Programming." There is both a C and a C++ implementation, which intends to show the impact language choice has on the implementation of a program.
The input text, divots.txt
, used for testing is the first chapter of a novel
"Divots" which I arbitrarily chose
from the "Golf stories" subject on Project Gutenberg. Below is a sample of the
output generated by the program:
It was a revelation, and for several minutes sat staring moodily down into the club-house. It has been putting like a man of subtle and sinister mind. “I have a feeling that his peculiar manner was due entirely to the hotel never soared above a certain amount of decent humility, which keeps a man of subtle and sinister mind. “I have a hundred rotten rounds would undo him. I understand his bankruptcy may be that in the afternoon by Jimmy Fothergill, and it was that when, after waggling in a sickly manner and tottered off to his liking. “All square...