initial
This commit is contained in:
19
farm/ant.c
Normal file
19
farm/ant.c
Normal file
@@ -0,0 +1,19 @@
|
||||
#include "ant.h"
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void reset_ants(struct Ant* ants, unsigned short nest) {
|
||||
memset(ants, 0, sizeof(struct Ant) * NUM_ANTS);
|
||||
for (int i = 0; i < NUM_ANTS; i++) {
|
||||
ants[i].id = i;
|
||||
ants[i].cell = nest;
|
||||
}
|
||||
}
|
||||
|
||||
struct Ant* create_ants() {
|
||||
int ants_size = sizeof(struct Ant) * NUM_ANTS;
|
||||
struct Ant *ants = (struct Ant *)malloc(ants_size);
|
||||
return ants;
|
||||
}
|
||||
Reference in New Issue
Block a user