A sample solution in Java for Assignment 06 is available here: ApproximateInference.tar.gz.
I had the brilliant idea (ha-ha) that I’d write this one up in a largely imperative style, passing and mutating arrays and array indices, in an attempt to get it to run quickly. It does run fairly fast (the Gibbs sampler gets around 2M samples / second on my desktop computer). Part of the cost of using this style is that it took a little longer than I expected to complete; it also is less readable than I’d like.