We describe an algorithm for computing the number of Hamiltonian circuits in a rectangular grid graph consisting of squares. For any fixed , the set of Hamiltonian circuits on such graphs (for varying ) can be identified via an appropriate coding with the words of a certain regular language . We show how to systematically construct a finite automaton recognizing . This allows, in principle, the computation of the (rational) generating function of . We exhibit a bijection between the states of and the words of length of the familiar Motzkin language. This yields an upper bound on the degree of the denominator polynomial of , hence of the order of the linear recurrence satisfied by the coefficients for fixed .
The method described here has been implemented. Numerical data resulting from this implementation are presented at the end of this article.