Another meeting of the Houston Recreational Computer Programming Group was held this past Sunday, June 8th, 2014. We had a great turnout this time, if we get many more people showing up, we'll be needing to find a bigger room.
Patrick Wheeler presented some modifications he's made to PanDoc, a program which converts Markdown into a variety of different formats, which enable him to run arbitrary shell commands as part of the processing of the Markdown and process the output of those programs, possibly via another invocation of Pandoc. This enables things like automatically updating documentation when corresponding code changes are made, automatically recomputing graphs when underlying data changes, etc.
Stephen Cameron presented his program "earthlike" to produce cubemap images for earth-like planets for his game Space Nerds In Space. More details may be found at the following links
- Slideshow about the "earthlike" planet texture generating program
- Space Nerds In Space code where earthlink program source may be found
Andrew Okin presented his implementation of Conway's Game of Life in C. The program is multithreaded and implements several optimizations. It is capable of running a 2000x1000 grid at about 60 ticks per second.
One of the simplest optimizations is ignoring inactive cells. In Conway's Game of Life, if a cell and its neighbors did not change states on the last tick, the cell's state is guaranteed not to change. The program takes advantage of this by ignoring these "inactive" cells.
One of the more prevalent optimizations, however, is how neighbors are counted. The simple approach is to go to each cell and check the surrounding cells to see if they are active. Unfortunately, this method is not very efficient, as it requires checking the state of cells several times. To solve this, I implemented an algorithm which goes through the grid and, for each active cell, adds one to a number stored in the last four bits of the neighboring cells' states. Once this is done for all cells, it goes through and uses this number to determine the new state of each cell. This algorithm sped the simulation up quite significantly.
Jeremy Van Grinsven presented his program to generate half-tone images in the form of a Hilbert curve. The motivation or inspiration for this was provided by the idea of plasma cutting a design from a sheet of steel. Plasma cutters are good at cutting, but the consumable parts of the machine wear out the most during the initial piercing of the steel, so it is desirable to create a design with few required piercings. A Hilbert curve, being a single connected space-filling curve, meets this requirement perfectly, requiring only a single piercing.
The program first generates a Hilbert curve with line segments. Then it performs a series of steps to essentially thicken the curve at points determined by the image it is meant to represent, with lighter parts of the image being represented by thicker segments, to let more light through, and darker parts being represented by thinner sections, to block more light. Each small line segment making up the curve produces two more or less parallel segments equidistant from the original line. So the curve is essentially doubled back on itself, forming a closed loop. The sharp 90 degree corners must be rounded off with quarter circles to allow room for the offset segments to avoid overlapping other offset segments of other nearby portions of the curve. Curve offsets are determined to be:
side_dimension / 2 ^ Hilbert_degree / 2
The source image is sampled at regular intervals along curve at a perpendicular tangent to the curve at half of the offset on each side. The offset is scaled by a value corresponding to the lightness or darkness of the sample, leaving 5 percent on the min and max to make sure the curve never becomes too thick or too thin, that is, never overlaps other parts of the curve, and always has a minimum thickness.
Then all the the offset segments are combined into a single closed contour and then it may be cut it out on a laser cutter or plasma cutter.
The next meeting of the Houston Recreational Computer Programming Group will be held on July 13th, 2014. See you there!