Mutate first offspring genome instead of host genome#785
Draft
chrxh wants to merge 1 commit into
Draft
Conversation
Clone and mutate the genome for the first offspring (currentOffspring == 0) directly after the offspring creature is created, leaving the host genome untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move genome mutation so it applies to the first offspring's own cloned genome instead of the host genome.
Previously
mutateGenomecloned and mutated the host creature's genome in place (before it was cloned for the offspring). Now:processCell: the offspring creature is created (findOrCreateNewCreature) beforemutateGenome, so the mutation targets the offspring.mutateGenome: mutatesoffspring->genome, guarded bycurrentOffspring == 0 && createsNewCreature(...); the host genome is left untouched. Once-guard viaatomicExch(offspring->mutationState).findOrCreateNewCreature: the first offspring (currentOffspring == 0) gets its own genome copy (cloneGenome) so the mutation does not affect the host.Result: only the first offspring is mutated, on its own genome copy; the parent keeps its original genome.
Testing
Not built/run here — the vcpkg submodule is not provisioned in this environment. Tests intentionally left unchanged.
🤖 Generated with Claude Code