Blog

Maze generation on n-sided polygon grids

I wanted to see if a maze could be generated on a grid that is not made of rectangles, but instead of various interlaced polygons.  In two dimensions, of course, triangles and hexagons are the only geometries that make sense.

Recipe: recursive self-referential structure in rails

Here is a solution for displaying nested data in a tree-like structure n-levels deep.  Regardless of how deep the nesting is to go, only one flat table is needed. Suppose, for example, there is a table of "groups," where a group can belong to any other group, nested as deeply as is wanted.  The desired output would need to clearly show the relationships, for example:

Pronounceable name generation in ruby

While building a ruby on rails project, I needed to generate "seed data" to populate what will be a table of people's names.  But, I wanted my sample page to look as normal as possible, so using the same name over and over, or just generating random characters would not be ideal.  I wanted names that, although humorous, would look like real names and actually be pronounceable.  This novel little script is a perfect example of why Ruby is quickly becoming my language of choice. 

Fractal Trees, part. 2: three dimensions

The next step I'm taking on fractal trees is to transform my algorithm from two into three dimensions.  In theory, this is very simple, but implementing it, as I discovered, is a little tricky.  The basic idea remains exactly the same as for the two-dimensional tree.  The only difference is, that when a child branch is born from its parent, it doesn't just choose one angle, it chooses a three-dimensional vector.  All of the branching and recursion work exactly the same way.  The same golden ratio I used before will still be used, meaning that every size is related to every other size by a factor of $\frac{1+\sqrt{5}}{2}$.

Fractal trees, part 1

Fractals appear everywhere in nature.  They are probably most obvious in the pattern by which trees and other plants grow.  I want to eventually generate entire forests and landscapes based on chaos.  Before I can do that, I need to make a sort of language or library of code to render each specific element.  I'll start by figuring out how to draw a fractal tree.