Works a bit less but on in a better way
changed rules of queue addition still problems on map4 with 2 merged paths
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/04/18 18:05:06 by tmaze #+# #+# */
|
||||
/* Updated: 2019/04/18 20:13:29 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/04/19 12:52:45 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -60,13 +60,10 @@ int get_score(t_lmdata *data, t_ind **ret, int nb_paths)
|
||||
min = scores[i];
|
||||
while (nbants > 0 && !(i = 0))
|
||||
{
|
||||
ft_printf("=== debug score ===\nnb_paths: %d\nscore[%d]: %d\nmin: %d\nnbants: %d\n\n", nb_paths, i, scores[i], min, nbants);
|
||||
while (i < nb_paths && nbants > 0)
|
||||
{
|
||||
ft_printf("score[%d]: %d\n\n", i, scores[i]);
|
||||
if (scores[i] == min)
|
||||
{
|
||||
ft_printf("increment\n\n");
|
||||
nbants--;
|
||||
ret[i]->weight++;
|
||||
scores[i] = (ret[i]->weight > 0) * (get_nb_nodes(ret[i]) + ret[i]->weight - 1);
|
||||
@@ -82,8 +79,11 @@ int get_score(t_lmdata *data, t_ind **ret, int nb_paths)
|
||||
i = -1;
|
||||
min = 0;
|
||||
while (ret[++i])
|
||||
{
|
||||
scores[i] = (ret[i]->weight > 0) * (get_nb_nodes(ret[i]) + ret[i]->weight - 1);
|
||||
if (min < scores[i])
|
||||
min = scores[i];
|
||||
}
|
||||
}
|
||||
return (min);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user