What is this?
A 2D map is being generated that can later be converted to a 3D space for use as a level in a game. Using cellular automata, 2 bytes are used to generate 65,025 maps. The maps are not necessarily unique (different seeds and rules can result in the same map), but are perfectly repeatable. White space on the maps is empty and represents where the player can move, grey space is filled and shows empty areas that were non-contiguous with the player starting point.
How is the map generated?
A random seed is converted to binary and expanded to fill the first row of an array. Expansion of seed is done by checking each bit of the seed in turn. If the bit is "on" then the eight bits of the seed are added to the next eight columns. If the bit is "off" then the eight columns are left empty. After each bit in the seed is checked all 64 columns in the first row of the array are filled.
An elementary cellular automata is then run using the current rule to fill the remaining rows in the array.
To ensure the player has a space to start in every map, an 8x8 "safe area" is created in the middle.
The array data is then smoothed using another cellular automata that checks for crowding/loneliness. The number of times the smoothing array is based on the initial rule to give different areas more or less smoothing.
Finally, a simple flood fill is started in the center of the landing pad to find parts contiguous with the "safe area" where the player can move.
Place names Locations are generated based on the rule being used - each bit in the rule refers to two possible values on a tree from inner vs outer system down to the city in a particular state. I've named all locations on Earth, but these are essentially random. If I spot an interesting looking rule, I'll give that a name as well.