Cellular automaton BlocksCAD snowflake generator
cults3d
This is a highly customizable and randomizable cellular automaton snowflake generator in BlocksCAD. It comes in two versions: a 20-level version (board radius up to 20) and a 40-level version, which pushes the limits of BlocksCAD's capabilities. The 40-level version becomes sluggish but still works smoothly with Firefox, unlike Chrome. The automaton starts by placing a live hex at the board's center and then applies evolution rules, similar to Conway's Game of Life. The default rule set, represented by darker blue screenshots, is based on Stephen Wolfram's system: a live cell survives indefinitely, and a new cell emerges when it has exactly one live neighbor. You can modify this rule set by adjusting the effects of different numbers of live neighbors (0-6) on survival or generation. You can also introduce indeterministic rules, where there are probabilities between 0 and 1 for survival or generation in various neighbor count scenarios. Even with indeterminate rules, snowflake symmetry is still enforced by the code. The light blue images were created using an indeterminate rule set with a single modification: setting the probability of generation when there's one neighbor to 0.5. This results in more snowflake-like patterns. Another intriguing set of generation parameters is 0,0.5,0,0.1,0,0,1 (a 50% chance of generation with one neighbor; a 10% chance with three neighbors, certainty with six neighbors). You're encouraged to share interesting rule sets in the comments. The default rule and its probabilistic variant are quite printable. Rules where all survival probabilities are 1 will produce completely connected snowflakes. If some survival probabilities are less than 1, there might be outliers. The OpenSCAD-based Customizer was generated by exporting OpenSCAD code from BlocksCAD and moving variable definitions to the top of the file for Customizer compatibility. When you turn on color shading (by setting different color1 and color2 values), the color shading is determined by the step at which a cell was generated. You can also enable periodic banding for a special color effect. Implementing a cellular automaton in BlocksCAD proved challenging due to its lack of support for arrays and functional programming nature. To speed up the code, the cellular automaton is only implemented on a 1/12 segment of the board, with the rest reconstructed by symmetry. The heart of the code lies in a massive recursive evolve module that takes 421 arguments. The first argument represents iteration count, while the remaining 420 arguments store one cell of data each. When the iteration count reaches zero, the evolve module calls draw(i,j,v) for each cell, drawing the hex if v is non-zero and up to 11 other related hexes by snowflake symmetries. The evolve module recursively calls itself with the iteration count decremented and each cell argument evolved. The evolution of cell arguments involves adding neighbor counts for each argument, checking if the cell should be alive. There's a hardcoded call to a cell evolution function for every single one of the 420 arguments. A go module is also present, calling evolve with its initial 421 (radius 40 version) arguments: an iterations count, followed by a central 1, and then zeroes. Finally, the code linearly extrudes the output of the go module to create a 3D shape. You might think it's crazy to drag-and-drop evolution code for every one of 420 cells in evolve, but I didn't do that. Instead, I wrote a quick-and-dirty Python script (included as blockscad.py and cell6.py: the latter is the main script) to automatically generate a subset of BlocksCAD XML code. The rest of the code was manually entered in BlocksCAD: the go module, some top-level code, the cell evolution function, and the draw module. Assembling all the code in BlocksCAD required some work. Most of the manually entered code was saved as a backup (included as the "hand code"). I then imported the XML file generated by Python into BlocksCAD and added an extrusion wrapper around the go module. After optimizing the code, I finally made it work. You can watch me explain this process in more detail at https://youtu.be/sJjrz4mL5aA.
With this file you will be able to print Cellular automaton BlocksCAD snowflake generator with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Cellular automaton BlocksCAD snowflake generator.