Genetic driven AI implementation based on hierarchical state machine