It's a
neuroevolution project, written in C++.
My previous neuroevolution projects were written in Python, which is very easy to work with, but generally runs about 100 times slower than C++. Python can be speeded up by using various packages that convert python code into C++ code or by using external C++ libraries for number crunching, but I found that the techniques which were easy to use didn't improve performance by much, and the other techniques were such a headache that I decided I was better off just learning C++ and starting from scratch.
For this latest project, I'm implementing an evolutionary algorithm inspired by
NEAT. There's a genetic algorithm component which allows for sexual recombination between individuals, rather than purely asexual reproduction as was the case in my earlier attempts, which increases the diversity of individuals, allows selection to operate separately on good and bad mutations and is less prone to getting stuck at local maximums in the fitness landscape. NEAT also uses a system that splits a population into different species and limits competition and interbreeding between species to encourage greater diversity, and increases competition and interbreeding when the number of species exceeds a certain limit, and I'm planning to implement my own version of this, too.
The new approach also makes a distinction between genotype and phenotype. In my previous attempts, a new organism was a direct copy of it's parent, with a few mutations, which meant that it 'knew' whatever it's parent knew at the point of reproduction. With a separate genotype and phenotype, organisms won't pass on what they learn over the course of their lifespan, but will pass on genes that code for a set of useful instincts and, possibly, genes that give new organisms the innate ability to learn and adapt to some degree, though for that to happen, I think I'll have to include some learning algorithms and a system whereby genes can specify where and when those algorithms are applied.
The distinction also means that data which is only needed during reproduction can be kept separate from data that's needed while the organism is processing information and interacting with it's environment, so the datastructures where the heaviest processing takes place can be kept smaller, take up less space in the CPU cache and be processed more efficiently.
Writing it in C++ is proving quite challenging, but I'm glad I made the move, and I'm learning a lot. At the moment, I'm trying to get a handle on dynamic memory allocation, which is something I never had to deal with in Python, and I'm a bit fuzzy on various other aspects of the language. I've made significant revisions to my code several times so far, as I've figured out better ways of doing things, and I've spent a lot of time experimenting with fragments of code to figure out what works and what doesn't, as well as browsing online reference sources and flicking through a C++ study guide that I picked up in a charity shop, so my progress has been slow and I'm still working on getting the fundamentals right.