chrxh / alien

ALIEN is a CUDA-powered artificial life simulation program.
https://alien-project.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 106 forks source link

Added # comments in code, and symbols decompilation in comments. #60

Closed dguerizec closed 1 year ago

dguerizec commented 1 year ago

Hello,

I made this PR because I was frustrated with non-human readable code in replicated cells. What it does, is trying to replace numbers with symbols where applicable, and write what could be a version of the original code in end-of-line # comments. These comments have to pass the compilation process, so the code stays editable without burdens. Due to the nature of the symbols map, it can't be perfect, but it's working pretty well most of the time.

chrxh commented 1 year ago

Hi,

this seems to be a useful extension! I'll have a closer look at it tomorrow.

In the upcoming version, however, the machine code will be replaced by neural networks (and the entire simulation model modified) because they are more amenable to evolutionary adaptation and learning methods. The development can be found on the branch https://github.com/chrxh/alien/tree/version4 and is not finished yet. You can find more extensions (e.g. genetic editor) and some code refactorings there.

I'll keep the current version, which allows cells to operate on the basis of machine code, on an extra branch in the future.

dguerizec commented 1 year ago

I've checked the version4, but failed to compile it on linux. Maybe I'll give it another try later, when I have time to fix compilation quirks. I love the idea of neural networks! I was a bit disappointed when I saw a NN cell type... but disabled. I wonder if the simulation will evolve as fast in the v4 as it does in the v3, if there is no code to bootstrap some "fixed" behaviors. I personally see the code as DNA genes (genome), and the NN as the brain connections (connectome). Both can be subject to mutations, but one is static and the other is plastic (over the lifetime of an organism). I could elaborate on this subject, but this is not the place :) Anyway, I'm looking forward to check the version 4!

chrxh commented 1 year ago

I've tested your feature. It works well and I find it very useful. I'll merge the PR. The Ubuntu CI is complaining but it seems nothing to do with your changes. It has not been running for over a month. There were probably changes in the toolchain. I'll have a look at it when I find time. If you have any idea of the reason, I'd be happy to know :) Anyway, thanks a lot for your contribution!

I'm doing the development to version 4.0 on my Windows PC, so it's quite likely that it doesn't compile on other platforms yet. I will fix that at a later time.

chrxh commented 1 year ago

Sorry, I forgot to answer your question:

I wonder if the simulation will evolve as fast in the v4 as it does in the v3, if there is no code to bootstrap some "fixed" behaviors.

Most of the "fixed behavior" or configurations will be set directly as properties in the cell functions. Most important, however, is that the constructor cells will contain a genome. It encodes an entire cell cluster with configurations for all its cells. There will also be a visual editor for genomes. I attach a screenshot:

Genome editor