Блог пользователя Soul_Full_Of_Thunder

Автор Soul_Full_Of_Thunder, история, 6 лет назад, По-английски

Two days ago, one of my friends (Danylo99) told me about a cool problem from a recent SIT contest. The goal was to find a nontrivial cycle that visits all cells on a 2D grid with even sides.

I thought it would be interesting to visualize the results.

Here is a slightly larger one. If anyone knows other approaches, please share :)

By the way, I also made a video of what's going on inside the algorithm.

Hope you all have a great day!

  • Проголосовать: нравится
  • +59
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Damn that's cool!!!

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +36 Проголосовать: не нравится

what does non trivial means?

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I think, general approaches are covered by Maze generation algorithm article from Wikipedia. Most of them may be utilised to solve the problem. I wonder though if there's a way to generate such cycles uniformly at random, as these approaches (including yours, I think) are a bit biased and usually there are cycles that they can't generate at all.

»
6 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +21 Проголосовать: не нравится

If anyone wants to try a similar problem — printing a Hamiltonian path on a 2D grid that starts in given cell (or tell if it does not exist) here it is. Sounds easy right? But willingness to suffer is advised.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How about tweaking Hilbert Curve? I think it can also give some interesting results.