This week’s assignment for Programming A to Z was to modify or augment our in-class example of a Markov chain. Somehow during class I got the idea to make a program that would create imaginary creatures by analyzing n-grams from a list of animals. I created a list of creatures from a medieval bestiary, and made a few simple changes to Adam’s MarkovFilter example. Here are some examples of creatures created by the program: kitelerowl, elockdawk, swatyr, bonomelizarr, hydrowhawk, heleonewt and, my favorite, hootalaphoot. This is the code for Bestiary.java:
import com.decontextualize.a2z.TextFilter;
public class Bestiary extends TextFilter {
public static void main(String[] args) {
new Bestiary().run();
}
Markov mark = new Markov(2, 10);
public void eachLine(String line) {
mark.feedLine(line);
}
public void end() {
println(mark.generateLine());
}
}
I would like to eventually narrow down the list of possible animal components, create images for each, and develop a Processing sketch to assemble composites of the animals as the algorithm pieces them together.
