Intel's Ronler Acres Plant

Silicon Forest
If the type is too small, Ctrl+ is your friend

Saturday, December 10, 2011

Encommulate

I have been playing with some simple computer programs lately. My most recent program computes the number of possible different patterns for square tiles. I originally wrote it a couple of years ago when I was mucking about with the Eternity II puzzle. I came across it while I was going through some of my old files and I decided to see if it still ran. It does, but it is very slow, so I decided to see if I could speed it up a little. I was successful at that, but the numbers it displays are hard to read. They are big numbers, and there aren't any commas, so I thought I would write a routine to insert commas in the numbers. I ended up writing two. The first one was graceful and elegant, but it used a boatload of variables and constants and was really rather complicated. After a bit of reflection I came up with a more primitive approach that works just as well and is simpler to boot. I needed a name for this routine. I could have called it something like format_integer_for_display_with_commas, but then I struck on encommulate, which I think is a perfectly wonderful name for this routine. You can find the source code to this program here, in Google Documents.

No comments: