“Uh, what?” you say.

A few weeks ago, I read a post on Hacker News about something called “the coastline paradox.” Despite my geology background, I hadn’t heard of this before.

The measured length of the coastline depends on the method used to measure it and the degree of cartographic generalization. Since a landmass has features at all scales, from hundreds of kilometers in size to tiny fractions of a millimeter and below, there is no obvious size of the smallest feature that should be taken into consideration when measuring, and hence no single well-defined perimeter to the landmass.

Essentially, the smaller unit of measurement you use to try and measure something with a fractal pattern, the longer it becomes.

So, I’m currently reading a book called “Reading the Rocks” by Marcia Bjornerud and there is an entire section devoted to the coastline paradox, which I just learned about.

Mandelbrot’s point was simple: If you use a very long stick to measure a coastline, you will capture the broadest arcs but miss the fjords, firths, and coves, and you will conclude that the coastline is not terribly long. As you use shorter and shorter rulers, however, the coast actually stretches. Mandelbrot named such stretchy features fractals…

Neat!

This brings up the second TIL: What is the phenomenon called when you hear something for the first time and then suddenly start seeing or hearing it everywhere?

It’s the Baader-Meinhof phenomenon, also known as the frequency illusion:

The frequency illusion (also known as the Baader-Meinhof phenomenon) is a cognitive bias in which a person notices a specific concept, word, or product more frequently after recently becoming aware of it.

Well, here’s to seeing more coastline paradoxes.

## Generating terrain maps

Recently, I went down a rabbit hole attempting to learn how to generate interesting looking maps for games (insert mind-blown-gif here). While I’m not going to be using Voronoi diagrams anytime soon,  I am still interested in attempting to generate Civilization-like maps.

Most map generation algorithms rely on perlin noise. I wanted to go a different route.

So far, these are the rules that I’ve come up with for my algorithm:

1. Create a grid of some given size (e.g., 100 x 50). Set all tiles to “ocean”.
2. Randomly pick 8 tiles (variable) across the map to seed as “land”.
3. Now iterate across all tiles on the map and build an array of tiles that are “ocean” tiles but have a land tile N/W/S/E of them.
4. Once you have this array, randomly pick a single value. Flip it from “ocean” to “land”
5. Repeat step 3 until a given number of tiles have been filled across the grid (e.g., for an “Earth-like planet”, 30% of tiles will be land).
6. Now, to add some additional randomness — iterate across all tiles and build an array containing all “land” tiles next to water (N/W/S/E).
7. Randomly pick 1, flip from land to ocean.
8. Repeat step 6 a given number of tries (e.g., 100).
9. Done! (Maybe)

Height maps, biomes and all that can come later. To quote Amit, whom I linked to earlier:

The most realistic approach would have been to define elevation first, and then define the coastline to be where the elevation reaches sea level. Instead, I’m starting with the goal, which is a good coastline, and working backwards from there.

Anyway, it’s been kind of neat to figure out.

Another example map, created using the above rules: