Simple C++ templated Markov chain implementation