Nearest-neighbor Ising teaching model with Metropolis updates. It is simple, but the logic is the same: propose a microscopic move, calculate dE, accept thermally.