3 color Potts model, Metropolis updating. $$ S=K\sum_{\langle i,j\rangle} \delta(s_i,s_j) $$ where the \(s_i=1,2,3\) can take three states.
pseudo-code: