grammar:
s gv
s gh
g df
f bf
v bwq
q bwq
q wzq
q wxq
q cwq
h bwwe
e bwwe
e bwbe
e bxbe
e bcwe
e bzxe
e cbwe
end
mapping:
d TestArchDoor
b TestWall
w TestWindow
z TestQuadWindow
x TestBevelWindow
c TestRoundWindow
end
Running that grammar produces this building:
Up next is the simulated annealing. For a simple test I'll compare each element to its neighbors and let it probably become the same as the most frequent neighbor. There will be a decreasing probability of each of the subsequently less frequent neighbors that will also fall off as the temperature decreases. To make sense of that lets cover simulated annealing briefly. The basic idea stems for annealing in metallurgy where a metal is cooled slowly to create big crystals with fewer defects. In each iteration of the annealing loop elements are allowed change based on some set of contextual rules and the current temperature. The higher the temperature the more drastic the changes can be. In the further spirit of non-determinism these changes also have a random component but will err towards stability as the temperature decreases. To make sure the changes are useful a cost function is also introduced to evaluate each state. That can ensure that new states are "better" than the old ones. The process ends when the temperature gets too low for meaningful changes to take place or some cost threshold is crossed. To test it out I'll be making elements turn into their most frequent neighbors which should result in a completely uniform building.
Lets see how that goes!