Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation rebase #102

Merged
merged 11 commits into from
May 26, 2024
Merged

Mutation rebase #102

merged 11 commits into from
May 26, 2024

Conversation

EthanD1998
Copy link
Collaborator

All of the mutation code after rebasing with reproduction and UI changes

Things included in mutation:

  • A vector of mutation chances for each cell determined by the genome with a base mutation rate of 20%. This is done in a vector so that there are multiple chances that a cell might mutate. This means that there are chances that a cell doesn't mutate at all and there is a chance that a cell might not mutate after reproduction.
  • A _mutate function which is used to determine which type of mutation is happening. There is an equal chance of an insert, modify, and delete mutation happening. If an insert or modify mutation happens then a gene will be generated to be put into that slot.
  • A protected gene variable. the genome can create a protected set of genes making it so that a mutation can't happen in a specific location. This is to simulate the "fixing" of mutated genes that is done in real cells. When mutating if a genome is fully protected then the genes can't be modified or deleted but it can insert a gene at the end of the genome.
  • Gene generation is determined by a function called in mutate. This function currently uses set percentages to determine what gene is selected. This allows us to make it easier to generate something like a modifier gene and harder to generate something like a nucleus gene.

@Alex-x90
Copy link
Collaborator

Alex-x90 commented May 21, 2024

  • Make sure to run clang format

src/cell.cpp Outdated Show resolved Hide resolved
src/modifier_gene.hpp Outdated Show resolved Hide resolved
EthanD1998 and others added 8 commits May 25, 2024 09:37
All the code from the previous github mutation branch that github did not like. Includes handling the mutate function, generating new mutations, calculating the percent chance of mutating, protected genes, and added genes that effect mutations
Added the mutation chance code back in after the rebase
Got rid of redundant code in generating genes and modifier genes
Fixed the crashes that were happening with the mutation code. In the mutate function, cellState gets called to check the protected genes. Because of the placement of the mutate function in the seteq, cell state had not been created yet.
Changed reproduction to kill the parent cell and create two child cells so both cells can mutate and recreate their cell structures
Fixed protected genes and moved the death emit on reproduction. I have noticed this not working properly and keeping the parent alive for some reason. as well as some crashes on cell death. This happens more when creation costs are lowered. I have also tested and made sure its not being caused my the mutation code itself
@@ -114,6 +114,10 @@ void CellEnvironment::_on_cell_death(Cell *cell) {
CellSpawner *spawner = Object::cast_to<CellSpawner>(this->get_parent());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line 113 _lineageGraph.storeCell(cell); is giving a warning while compiling:

src\cell_environment.cpp(113): warning C4834: discarding return value of function with 'nodiscard' attribute.

I believe it's complaining about the fact that the storeCell function returns a Vector2 but then it isn't used anywhere here.

Copy link
Owner

@MylesScholz MylesScholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good and work for me.

@MylesScholz MylesScholz merged commit 1610b36 into main May 26, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants