Lots of video game mechanics were "happy little accidents" that were then codified. For instance, in Space Invaders, the aliens speed up as there are fewer of them; this was an emergent behavior that was codified, at first it was caused by the game outputting frames as fast as possible & having less computation to perform as aliens were eliminated.