Category Archives: recursion

Tile a board with randomly colored trominoes in C#

The post Tile a board with colored trominoes in C#explains how to color a tromino filing so no two adjacent trominoes share the same color. That example basically tried every possible color for each of the trominoes until it found … Continue reading

Posted in algorithms, drawing, graphics, mathematics, recursion | Leave a comment

Tile a board with colored trominoes in C#

The post Tile a board with trominoes in C# explains how to tile a board with a missing square with trominoes. This post shows how to color the trominoes so no two adjacent ones share the same color. The four-color … Continue reading

Posted in algorithms, drawing, graphics, mathematics, recursion | Tagged , , , , , , , , , , , , , , , , , , | 1 Comment

Tile a board with trominoes in C#

Trominoes are polyominoes of order three. That means they are polygons made up of three equal sized squares joined at their edges. There only are two kinds of trominoes: three squares joined in a line and three squares joined in … Continue reading

Posted in algorithms, drawing, graphics, mathematics, recursion | Tagged , , , , , , , , , , , , , , , , , | 1 Comment

Draw a randomly colored Sierpinski pentagon in C#

The example Draw a colored Sierpinski pentagon in C# lets the user click on the parts of a Sierpinski pentagon to change their colors. Eddie Bole thought it would be interesting to color the larger pentagons in addition to the … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | 4 Comments

Draw a colored Sierpinski pentagon in C#

The example Draw a Sierpinski pentagon in C# shows how to draw a Sierpinski pentagon. This example modifies that one so the user can click on pentagons to change their colors. To do that, this program takes a very different … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | 6 Comments

Draw a Pythagoras tree fractal in C#

A Pythagoras tree (or Pythagorean tree) is a fractal tree built from squares. It starts with a square that forms the tree’s base. The program then makes the Pythagoras tree by recursively attaching two smaller branches to the original branch. … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | 1 Comment

Draw a Sierpinski pentagon in C#

In a Sierpinski pentagon, larger pentagons are recursively divided into five smaller pentagons with a sixth uncolored pentagon in the center. The following picture shows the first four levels of the resulting fractal. For this example, I decided to think … Continue reading

Posted in drawing, fractals, graphics, recursion | Tagged , , , , , , , , , , | 6 Comments

Write a TreeView into a tab-delimited file in C#

The example Load a TreeView from a tab-delimited file in C# shows how to load a TreeView control from a file. This example shows how to do the converse: write a TreeView control’s values into a file. The following SaveTreeViewIntoFile … Continue reading

Posted in algorithms, controls, files, recursion | Tagged , , , , , , , , , , , | Leave a comment

Recursively draw equations in C#

The basic idea for recursively drawing equations is simple. Well, sort of simple. Classes represent different kinds of equations. A particular class knows how to draw its kind of equation. It uses other classes to draw its pieces. For example, … Continue reading

Posted in algorithms, drawing, fonts, graphics, recursion | Tagged , , , , , , , , , , , | 2 Comments

Enumerate TreeView nodes in C#

The previous two posts show two ways you can enumerate TreeView nodes that are checked. The idea is to recursively crawl over the tree’s nodes and pick out the checked ones. Unfortunately that method isn’t easily extendable. For example, if … Continue reading

Posted in algorithms, controls, recursion, user interface | Tagged , , , , , , , , , , , , , , , , | Leave a comment