  LCLs or locally checkable labelling problems (e.g. maximal independent set,
maximal matching, and vertex colouring) in the LOCAL model of computation are
very well-understood in cycles (toroidal 1-dimensional grids): every problem
has a complexity of $O(1)$, $\Theta(\log^* n)$, or $\Theta(n)$, and the design
of optimal algorithms can be fully automated.
  This work develops the complexity theory of LCL problems for toroidal
2-dimensional grids. The complexity classes are the same as in the
1-dimensional case: $O(1)$, $\Theta(\log^* n)$, and $\Theta(n)$. However, given
an LCL problem it is undecidable whether its complexity is $\Theta(\log^* n)$
or $\Theta(n)$ in 2-dimensional grids.
  Nevertheless, if we correctly guess that the complexity of a problem is
$\Theta(\log^* n)$, we can completely automate the design of optimal
algorithms. For any problem we can find an algorithm that is of a normal form
$A' \circ S_k$, where $A'$ is a finite function, $S_k$ is an algorithm for
finding a maximal independent set in $k$th power of the grid, and $k$ is a
constant.
  Finally, partially with the help of automated design tools, we classify the
complexity of several concrete LCL problems related to colourings and
orientations.
