Adaptive automata based on Darwinian selection