They say that if you let a million monkeys type on a million typewriters, they will eventually write the works of Shakespeare. While not quite the same thing [bbenchoff] (why does that sound familiar?), spent some computing cycles to generate random data and, via heuristics, find valid Atari 2600 “games” in the data.

As you might expect, the games aren’t going to be things you want to play all day long. In fact, they are more like demos. However, there are a number of interesting programs, considering they were just randomly generated.

Part of the reason this works is that the Atari has a fairly simple 6502-based CPU, so it is straightforward to evaluate the code, and a complete game fits in 4 K. Still, that means there are, according to [Brian], 1010159 possible ROMs. Compare that to about 1080 protons in the visible universe, and you start to see the scale of the problem.

To cut down the problem, you need some heuristics you can infer from actual games. For one thing, at least 75% of the first 1K of a ROM should be valid opcodes. It is also easy to identify code that writes to the TV and other I/O devices. Obviously, a program with no I/O isn’t going to be an interesting one.

Some of the heuristics deal with reducing the search space. For example, a valid ROM will have a reset vector in the last two bytes, so it is possible to generate random data and then apply the small number of legal reset vectors.

Why? Do you really need a reason? If you don’t have a 2600 handy, do like [Brian] and use an emulator. We wonder if the setup would ever recreate Tarzan?


From Blog – Hackaday via this RSS feed