Considerably speed up path generation

This makes 10x10 grids sane: rather than taking 4 minutes to load they
take 1 second.  While this still isn't fast, it's good enough for now.