algorithmic modeling for Rhino


After an intense, beginner style, use of grasshopper shared knowledge it's time to contribute with one of my works.

The objective is to make a perfect maze with the fewer short dead-ends (very bad looking). A maze is called perfect when you can pick two random points in it and still find a way between them.

Many maze algorithms exists, but they generate different "qualities" of perfect mazes. So I chose to implement the Recursive Backtracking because to me, it's a quite elegant solution and a quite simple logic. I had to translate code from Ruby (baah) to C# in the aim of creating a Mazificate O' Matic grasshopper block.

The block's output is the list of edges to be modified. I Z-extrude it to make it real, temporary solution.

You can grab more information on maze algorithms on this website :

Because it's holiday time, there is still some TODO on this definition :

  • Add a toogle to have the boundary walls (easy one)
  • Change the Z-extrusion method to one which will work with any surfaces.
    • Getting each normal from each critic point of the curves then move each curves? 
    • Offset the curves ?
    • Project the curves on an offsetted surface ?
  • Make an elegant definition =)
  • Fame, Honor, Happiness and Women

Z-Extrusion failing with a sphere

 - Mac Gros

Views: 7588


Replies to This Discussion

Very nice.


Is your definition shared anywhere? I would love to see you you did this elegantly, my attempts have been quite clumsy. cheers!

Thanks a lot !

Hey Mac, looks great!
But this only works for rectangular mazes.
im not a c# pro, how do I get the option "column" working?
thanks in advance!

Hey !

First of all thanks for all your kind comments, just seen'em.
I must admit that, Lucas Confurius, you touched a rather delicate point.

I updated the code and the grasshopper boxes to get the extrusion workings via a surface offset (lovely method, usable w/ a sphere). But I didn't cleaned it nor annotated it and I clearly made a mistake because of the Rows/Columns not working. I'll take care of this when my portfolio is finished, tough job.

And, to make this post even better, the new version is joined w/ render =D


Hey Mac Gros,

Amazing! Thanks for making it openly available.

Was wondering however if its possible to assign the number of rows and columns of the surface maze separately?

Great work!

Very cool indeed! 

hi! great work! very impressive! 

I'm looking for a way to create a maze game in unity, could you tell me that is there any way to translate the C# code from GH to a Visual Studio C# code? What do I need to add or modify? I know it's the same language, but how do I do this transformation?

Only for school research.

Thank you very much, looking forward to you reply!






  • Add Photos
  • View All


  • Add Videos
  • View All

© 2022   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service