Skip to content

Mutate first offspring genome instead of host genome#785

Draft
chrxh wants to merge 1 commit into
developfrom
claude/mutate-offspring-genome
Draft

Mutate first offspring genome instead of host genome#785
chrxh wants to merge 1 commit into
developfrom
claude/mutate-offspring-genome

Conversation

@chrxh

@chrxh chrxh commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Summary

Move genome mutation so it applies to the first offspring's own cloned genome instead of the host genome.

Previously mutateGenome cloned and mutated the host creature's genome in place (before it was cloned for the offspring). Now:

  • processCell: the offspring creature is created (findOrCreateNewCreature) before mutateGenome, so the mutation targets the offspring.
  • mutateGenome: mutates offspring->genome, guarded by currentOffspring == 0 && createsNewCreature(...); the host genome is left untouched. Once-guard via atomicExch(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

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>
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.

1 participant