-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.h
More file actions
37 lines (30 loc) · 747 Bytes
/
main.h
File metadata and controls
37 lines (30 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define NUMBER_ORGANISMS 100
#define NUMBER_GENES 20
#define ALLELES 4
#define MUTATION_RATE 0.001
#define TARGET_SUM 30
#define MAX_DISTANCE 43
#include <math.h>
struct posn{
int x;
int y;};
struct genetic {
char **cur_generation;
char **next_generation;
char *target_org;
int *org_fitnesses;
int totalFitness;};
typedef struct genetic * Gen;
// function declarations
Gen CreateInitialPopulation(void);
void freeMem(Gen g);
void SetTargetOrg(Gen g);
int OneRun(Gen g);
bool EvaluateOrganisms(Gen g);
bool EvaluateOrganismsSum(Gen g);
bool EvaluateOrganismsPath(Gen g);
void ProduceNextGeneration(Gen g);
int SelectOrganism(Gen g);