A working second iteration, ready to add the GUI

The problem was that I forgot that the lattice was 8-connected. Fixed
now.