This commit is contained in:
CptG9000
2021-12-05 22:12:33 +00:00
2 changed files with 60 additions and 16 deletions

View File

@@ -11,7 +11,7 @@ solve() ->
init:stop().
solve(A) ->
solve(A, get_test_data()).
solve(A, get_data()).
solve(['1'], D) ->
io:format("The solution to ~p puzzle1 is: ~p~n", [?MODULE, solve(1, D)]);
@@ -60,7 +60,6 @@ get_count_list([H|_] = D) ->
get_count_list(D, init_acc(length(H), [])).
get_count_list([], Acc) ->
io:format("~p~n", [Acc]),
Acc;
get_count_list([H|T], Acc) ->
get_count_list(T, lists:zipwith(fun(X, {Ones, Zeros}) ->
@@ -75,6 +74,7 @@ init_acc(Len, Acc) ->
%% Convert binary list to integer, e.g. "1011" -> 11 dec
bl2int(CL) ->
io:format("convert ~p~n", [CL]),
bl2int(lists:reverse(CL), 0, 0).
bl2int([], Acc, _) ->

File diff suppressed because one or more lines are too long