Actually, here’s a funny fact about lattice Boltzmann: you can use just any LB code which was written for fluid dynamics and use it to solve a diffusion equation (or, an advection-diffusion equation if you want).
Here’s the procedure: take for example the Matlab code for the lid-driven cavity. Then, take the density rho as your diffused scalar, erase all terms in which the velocity u appears, and re-interpret the viscosity nu as being the diffusivity constant D. That’s it.
For example, the computation of the equilibrium
cu = 3*(cx(i)*ux+cy(i)*uy);
fEq(i,:,:) = rho .* t(i) .* ...
( 1 + cu + 1/2*(cu.*cu) - 3/2*(ux.^2+uy.^2) );
is simply replaced by
fEq(i,:,:) = rho .* t(i);
Once your code works, you can make it more efficient by switching from a 9-neighbor lattice to a 4-neighbor lattice.