Given a n by n grid, what's the longest path between the cells such that the path does not overlap and no path cell is adjacent to more than 2 other cells (the one it go to, and come from). The start and end of the path may be placed anywhere on the grid. (I'm specifically interested in a 32x32 grid)
No, not homework, just very curious.
A zig-zag pattern (all the way along a row, then dow two, then all the way along a row the other way) starting in the top left and ending in the bottom left would get you out of a total of 1024 grid, so a little over half.
A spiral would be another good solution but I'm not sure how to calculate that
>>9124832
Thanks a lot for replying however i was just looking for a more mathematically rigid answer though.
>>9124817
hilbert curve
>>9124896
Wouldn't a hilbert curve fill all of space? That wouldn't work, seeing as I'm looking for the path that's not directly adjacent to it self.
>>9124817
>>9124962
why not diagonal all the way?
>>9124977
Doesn't work on the edges :/
>>9124962
Building on this.
The diagonal lines are obviously the best use of space for the middle, but the edges complicate things.
>>9125029
This guy's on point : https://en.m.wikipedia.org/wiki/Hilbert_curve
>>9125020
Came to this, i think it's slightly better.
What'cha guys thing?
I think this is the best you can do, 650 cells filled. I've shaded the edges so it's easier to see the patterns.
The middle is two thirds full, the edges are a little over half full: 127/240, with the extra seven coming from the way the corners work out.