This commit is contained in:
Alan Evans
2021-12-09 17:59:43 +00:00
parent b4e1a94b57
commit 9159a85282

View File

@@ -56,12 +56,12 @@ solution2(Table) ->
get_basins(Low_points, Table) ->
get_basins(Low_points, Table, 0, []).
get_basins(Low_points, Table, []).
get_basins([], _Table, _, Basins) -> Basins;
get_basins([Low_point|Rest], Table, Count, Basins) ->
get_basins([], _Table, Basins) -> Basins;
get_basins([Low_point|Rest], Table, Basins) ->
Basin = [Low_point|lists:usort(get_up_slopes([Low_point], Table))],
get_basins(Rest, Table, Count + 1, [Basin|Basins]).
get_basins(Rest, Table, [Basin|Basins]).
low_points([H|_] = Table) ->
X = length(H),