Set mutation chance super low and check for end case in mutation

This commit is contained in:
2026-03-18 09:35:42 +00:00
parent 07a47952c3
commit 41c4a39e05
2 changed files with 3 additions and 3 deletions

View File

@@ -39,8 +39,8 @@ typedef double f64;
#define NUM_PROGRAMS_POW_2 8
#define NUM_PROGRAMS (1 << NUM_PROGRAMS_POW_2)
#define MUTATION_CHANCE 0
#define MUTATION_OFFSET 2
#define MUTATION_CHANCE 10000
#define MUTATION_OFFSET 3
#endif

View File

@@ -29,7 +29,7 @@ void simulation_iterate(simulation_t *sim)
#if MUTATION_CHANCE
for (u64 i = 0; i < SIMULATION_SIZE; ++i)
{
if ((rand() % MUTATION_CHANCE) == 0)
if ((rand() % MUTATION_CHANCE) == (MUTATION_CHANCE - 1))
{
sim->memory[i] += (rand() % MUTATION_OFFSET) - (MUTATION_OFFSET / 2);
}