Set mutation chance super low and check for end case in mutation
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user