A 'modular knight' moves on circular chess board made from concentric circles divided into sectors.

As a default, the board is split into 5 sectors with 2 concentric tracks and the knight can move 3 steps forward (in any direction) followed by 1 step to the side (in either direction), as shown in the interactivity below. The middle and edge of the board are joined so that when the knight moves over the outside edge of the circular board it re-enters in the same sector on the inside of the track (and vice versa).

Start the interactivity below by clicking on the +. The brown squares represent the squares the knight has visited and the peach squares the possible destinations on the next move.

To begin with, understand why all of the peach squares are possibilities.

Then, can you make the knight visit every square once and only once and return to its starting point?

Suppose there are p sectors and q concentric tracks and a knight's move is a steps in one direction and b steps in the other direction. Find conditions on the numbers p, q, a and b under which it is possible for the knight to visit every square and return to its starting point.

Note that on the interactivity you can change the size of the track, the direction and number of steps the knight can move forward, and the number of steps it can move to the side.