my solutions to advent of code
aoc advent-of-code

day 13 2015 - dude im stupid happiest_table at a function level is totally useless

aylac.top 823fd273 0a157a9f

verified
Changed files
+1 -8
2015
13
gleam
+1 -8
2015/13/gleam/src/main.gleam
···
fn do_find_happiest_table(
happiness_dict,
people,
-
happiest_table,
first_person first_person,
last_person last_person,
table table,
···
let assert Ok(relation) =
happiness_dict |> dict.get(Relation(last_person, first_person))
as "There should be more than one person"
-
let table = table + relation
-
case table > happiest_table {
-
True -> table
-
False -> happiest_table
-
}
+
table + relation
}
False -> {
people
···
do_find_happiest_table(
happiness_dict,
people |> set.delete(person),
-
happiest_table,
first_person,
last_person: person,
table: table + relation,
···
do_find_happiest_table(
happiness_dict,
people |> set.delete(person),
-
0,
first_person: person,
last_person: person,
table: 0,