%% date:: [[2023-04-08]] sibling:: [[Imperative]], [[Declarative]], [[Emergent load testing]], [[Artificial Intelligence]] parent:: [[Software Development]], [[Emergence]] %% # [[Generative]] *Generative* refers to something that is given a sufficiently large sample of input and autonomously delivers output that is surprising or new. Generative code refers to code capable of a wide range of output, and is often used in algorithms for [[Artificial Intelligence]]. Generative code is an example of [[Emergent software]]. ## Types of generative programming ### Procedural generation Procedural generation is when output is generated from algorithms, usually on the fly. Examples of this are procedurally generated levels on video games (especially common for [[Roguelike]] games) where the specifics of the level (where mobs and loot are located) and the map itself are created on demand. Procedural generation adds an element of randomness, but is limited as to the elements that it can use. ### Template generation Template generation consists of using a standard format or structure of the output but with variable inputs. ### Evolutionary algorithms Some algorithms generate output based on a set of rules or genetic code. For example, [[The Game of Life]] is a mathematical game created by [[John Horton Conway]] that produces interesting structures based on simple rules. ### [[Generative AI]] Generative AI is the most complex form of generative programming because it is less limited than the others. Where others have their structure, rules, or behaviour manually determined, generative AI is probabilistic and non-deterministic. It learns rules and context from training data, so it often produces results that are surprising. Because generative AI is a non-deterministic system, it is impossible to predict precisely what the output of generative AI will be.