finished basic genetic algorithm