Code of an ising model for a two state lattice of magnets