Exemplo n.º 1
0
int main(void){
  read_file("input_1.csv"); //get cities
  get_dists(); //get distances
  get_ants();

  fields f = {table, dists, phers};

  ants = get_ants(ANT_NUM, fields);
  best_ant = start(fields, ants);
  //    print best_ant.paths
}
Exemplo n.º 2
0
int				parsing(t_env *data)
{
	char	*line;
	int		ret;

	line = NULL;
	while (!(data->ants))
		get_ants(data, line);
	while ((ret = get_next_line(0, &line)))
	{
		if (!check_line(&line, data))
		{
			if (!can_start(data))
				parsing_error(data, line);
			ft_strdel(&line);
			ft_putchar('\n');
			return (solve(data));
		}
		ft_putendl(line);
		ft_strdel(&line);
	}
	if (ret == -1)
		ft_error("read");
	ft_putchar('\n');
	if (!can_start(data))
		parsing_error(data, line);
	return (solve(data));
}
Exemplo n.º 3
0
t_map		*get_map(void)
{
	t_map	*map;

	map = malloc(sizeof(t_map));
	map->ants = get_ants();
	ft_putnbr(map->ants);
	ft_putendl("");
	if (map->ants == 0)
		exit_error("The number of ants is 0, so lemin is finished :).");
	map->rooms = get_rooms_and_pipes();
	if (map->rooms == NULL)
		return (NULL);
	return (map);
}