INITIALIZING...
Nobody programs these creatures. They start with random brains and get better on their own, through four simple rules repeated over and over:
You are the environment. The defenses you build are the selection pressure. Change them and evolution adapts to the new challenge — exactly like life adapts to its surroundings. There is no hidden training and no goal in any single brain: only survival of whoever happens to do a little better.