Genetic Algorithms

Genetic algorithms are a technique for improving content by repeatedly creating groups of items, checking to see which ones best score on a certain ranking, then mixing some of the top items together. It mimics natural selection, in that that the best performers are able to pass along attributes to later generations.

Genetic Algorithm
In the case of dungeon generation, genetic algorithms are used for creating a dungeon layout that best fits various properties. The map is represented as a tree and evaluated with a fitness function, which looks at the properties the map has (such as room count, average room size, number of enemies, number of treasure chests, or practically anything else) and returns a value.

Because genetic algorithms can be implemented in so many different ways, a very general version is presented here.

Algorithm
1: create a group of one-room maps