20 lines
463 B
C
20 lines
463 B
C
#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;
|
|
}
|