void distance_player(char **map, int x, int y, int nbr) { map[x][y] = nbr + '0'; if (map[x][y + 1] != '1' && map[x][y + 1] == '0') distance_player(map, x, y + 1, nbr + 1) if (map[x + 1][y] != '1' && map[x + 1][y] == '0') distance_player(map, x + 1, y, nbr + 1) if (map[x - 1][y] != '1' && map[x + 1][y] == '0') distance_player(map, x - 1, y, nbr + 1) if (map[x][y - 1] != '1' && map[x][y - 1] == '0') distance_player(map, x, y - 1, nbr + 1) } t_xy path_finding(t_data *data, int x, int y) { t_xy new_pos; char **map_cpy; if (cur.x == ply.x && cur.y == ply.y) return (0); map_cpy = ft_strdups(data->map); distance_player(map_cpy, x, y, 0); } void move_enemy(t_data *data) { }