During vertebrate embryogenesis, the expression of Hox genes that define anterior-posterior identity follows general rules: temporal colinearity and posterior prevalence. A mathematical measure for the quality or fitness of the embryonic pattern produced by a gene regulatory network is derived. Using this measure and in silico evolution we derive gene interaction networks for anterior-posterior (AP) patterning under two developmental paradigms. For patterning during growth (paradigm I), which is appropriate for vertebrates and short germ-band insects, the algorithm creates gene expression patterns reminiscent of Hox gene expression. The networks operate through a timer gene, the level of which measures developmental progression (a candidate is the widely conserved posterior morphogen Caudal). The timer gene provides a simple mechanism to coordinate patterning with growth rate. The timer, when expressed as a static spatial gradient, functions as a classical morphogen (paradigm II), providing a natural way to derive the AP patterning, as seen in long germ-band insects that express their Hox genes simultaneously, from the ancestral short germ-band system. Although the biochemistry of Hox regulation in higher vertebrates is complex, the actual spatiotemporal expression phenotype is not, and simple activation and repression by Hill functions suffices in our model. In silico evolution provides a quantitative demonstration that continuous positive selection can generate complex phenotypes from simple components by incremental evolution, as Darwin proposed.