Elementary Automata (Generating Random Sequences X)


I was rather discontented with last week’s post results. Most automata seemed to produce self-correcting patterns, even when seeded randomly—one could argue that rand() isn’t the strongest random generator, but that wasn’t the problem. No, indeed, most automata exhibit self-correcting behavior, forming the same self-similar pattern, or worse, the same periodic pattern.

So I made a few more experiments with random seeds and larger images. The code isn’t very complicated and isn’t of interest in itself, but it reveals a couple of interesting things.

Read the rest of this entry »

Elementary Automata (Generating Random Sequences IX)


A while ago, Wolfram (re)introduced elementary cellular automata, a special case of cellular automata that lives in one dimension. One cutesy aspect of these automata is that the rules are easy to describe and number. As any automata, it is given a context, a region of interest, and gives an output depending on the context. For example, we can have the rules:

Context output
000 1
001 0
010 1
011 0
100 1
101 0
110 1
111 1

The output column can be viewed as a number, in this case 11010101, 0xd5, or 213. This is rule 213.

It may be tempting to use those to generate chaos, noise, and random numbers. But is it that a good idea?

Read the rest of this entry »

Woe is coding.


Read the rest of this entry »

#include <the_usual>


Recently on Freenode channel ##cpp, I saw some code using an include-all-you-can header. The idea was to help beginners to the language, help them start programming without having to remember which header was which, and which headers are needed.

Is that really a good idea?

Read the rest of this entry »

Fast Recurrences


Quite a while ago, I wrote a post on how to compute an arbitrarily large Fibonacci number F_n in essentially O(\log n) steps. Turns out, that technique generalizes to other recurrence relations, and of any order.

Read the rest of this entry »