| commit 69: | d3751c21be73 |
| parent 68: | 65abf1117723 |
| branch: | market-1 |
fixes in visual, fix 1 memory leak, add parameters to agents modules
Changed (Δ182 bytes):
raw changeset »
agents/evil.c (1 lines added, 1 lines removed)
agents/neuro.c (2 lines added, 1 lines removed)
agents/simpleton.c (1 lines added, 1 lines removed)
agtevo1.c (2 lines added, 1 lines removed)
descr (1 lines added, 1 lines removed)
visual.c (5 lines added, 2 lines removed)
Up to file-list agents/evil.c:
| … | … | @@ -15,7 +15,7 @@ void neuro_unref(neuro_t* neuro); |
15 |
15 |
|
16 |
16 |
int counter; |
17 |
17 |
|
18 |
void init( |
|
18 |
void init(char* param) |
|
19 |
19 |
{ |
20 |
20 |
counter = 0; |
21 |
21 |
} |
Up to file-list agents/neuro.c:
| … | … | @@ -13,8 +13,9 @@ void* ksmalloc(size_t size1, char* type) |
13 |
13 |
|
14 |
14 |
int counter; |
15 |
15 |
|
16 |
void init( |
|
16 |
void init(char* param) |
|
17 |
17 |
{ |
18 |
printf("%s\n", param); |
|
18 |
19 |
counter = 0; |
19 |
20 |
} |
20 |
21 |
Up to file-list agents/simpleton.c:
| … | … | @@ -15,7 +15,7 @@ void neuro_unref(neuro_t* neuro); |
15 |
15 |
|
16 |
16 |
int counter; |
17 |
17 |
|
18 |
void init( |
|
18 |
void init(char* param) |
|
19 |
19 |
{ |
20 |
20 |
counter = 0; |
21 |
21 |
} |
| … | … | @@ -93,7 +93,7 @@ void populate_world(world_t* world) |
93 |
93 |
free(name); |
94 |
94 |
|
95 |
95 |
init = dlsym(handle, "init"); |
96 |
init( |
|
96 |
init(strchr(strchr(line, ' ') + 1, ' ') + 1); |
|
97 |
97 |
printf(dlerror()); |
98 |
98 |
for (i = 0; i < count; i++) { |
99 |
99 |
agent = agent_new_from_object(handle); |
| … | … | @@ -111,6 +111,7 @@ void populate_world(world_t* world) |
111 |
111 |
} |
112 |
112 |
|
113 |
113 |
free(filename); |
114 |
free(line); |
|
114 |
115 |
fclose(descr); |
115 |
116 |
} |
116 |
117 |
1 |
1 |
#include <stdio.h> |
2 |
2 |
#include <stdlib.h> |
3 |
#include <string.h> |
|
3 |
4 |
|
4 |
5 |
#include "world.h" |
5 |
6 |
#include "const.h" |
| … | … | @@ -76,13 +77,15 @@ void add_genome(int genome_number) |
76 |
77 |
int readint() |
77 |
78 |
{ |
78 |
79 |
int i; |
79 |
s |
|
80 |
sscanf(strr, "%d", &i); |
|
81 |
strr = strchr(strr, ' ') + 1; |
|
80 |
82 |
return i; |
81 |
83 |
} |
82 |
84 |
double readfloat() |
83 |
85 |
{ |
84 |
86 |
double d; |
85 |
s |
|
87 |
sscanf(strr, "%f", &d); |
|
88 |
strr = strchr(strr, ' ') + 1; |
|
86 |
89 |
return d; |
87 |
90 |
} |
88 |
91 |
genome = genome_load(readint, readfloat); |
