Skip to main content
2 of 4
added 7 characters in body
David Roberts
  • 35.5k
  • 11
  • 124
  • 349

Snake algorithm that minimizes straight lines

How can I find the non-self-intersecting loop that uses the least amount of straight lines (curves left/right as often as possible every turn) and still loops back on itself?

Here's an example we have calculated for 8x8:

Image

Here is an example we have calculated for a 6x6:

Image

Tzlil
  • 61
  • 1