steps East-West:
steps North-South:

(steps between 1 and 20 inclusive)

Routes on a grid of M North-South streets and N East-West streets are calculated by this app.

The routes found are sorted by length, the shortest ones being shown first (the five neon colours are used at random). The app makes 1000 attempts to find routes, using the "Depth First Search" algorithm, which makes some random choices of directions to try. There is no guarantee that all routes are found. In fact for most grid there are thousands of routes. The current screen shows routes. You can also hover over the settings button to see the number of routes currently found, and use the settings button to change the values of M and N.

Optimal routes use only North and East steps to get from (0, 0) to (M, N) along the grid. It is known that there are (M + N)! / (M!N!) routes in this situation. For example, the default values of M and N in this app are 5 and 3, leading to 8! / (5!3!) = 56 optimal routes. These are sometimes all found by the app.