From: Greg Burri Date: Wed, 9 Dec 2020 12:49:26 +0000 (+0100) Subject: Add an HTML export X-Git-Url: http://git.euphorik.ch/index.cgi?a=commitdiff_plain;h=0605372b7839c369bd3a5f0dff7b5f1f1ea00452;p=advent_of_code_2020.git Add an HTML export --- diff --git a/advent_of_code_2020.jl b/advent_of_code_2020.jl index 1dd73e7..3bbe26f 100644 --- a/advent_of_code_2020.jl +++ b/advent_of_code_2020.jl @@ -13,7 +13,16 @@ main { """ # ╔═╡ f0dd4400-3313-11eb-3295-af913c2212fb -md"# Advent Of Code 2020" +md" +# 🦌 Advent Of Code 2020 + +The goals are: +* Learn *Julia* +* Write readable code (avoid golfing) +* Write efficient code if possible + +See [Advent Of Code 2020](https://adventofcode.com/2020) for more information. +" # ╔═╡ 0b7b8920-3314-11eb-2cfb-7d20c0967e67 md"## Day 1" @@ -516,6 +525,8 @@ function parse_day8(lines) end # ╔═╡ 9d1a8980-3a0d-11eb-380e-8fcaf30c849c +# The returned boolean is true if the execution has finished correctly or false if there is a infinite loop. +# The returned integer is the accumulator when the inifinite loop is detected or when the execution has finished correctly. function execute(instructions) :: Tuple{Bool, Int} pos = 1 accumulator = 0 diff --git a/advent_of_code_2020.jl.html b/advent_of_code_2020.jl.html new file mode 100644 index 0000000..6d22326 --- /dev/null +++ b/advent_of_code_2020.jl.html @@ -0,0 +1,240 @@ + + + + + ⚡ Pluto.jl ⚡ + + + + + + + + + + +
+
9.5 Î¼s

🦌 Advent Of Code 2020

+

The goals are:

+
    +
  • Learn Julia

    +
  • +
  • Write readable code (avoid golfing)

    +
  • +
  • Write efficient code if possible

    +
  • +
+

See Advent Of Code 2020 for more information.

+
12.7 Î¼s

Day 1

+
8.8 Î¼s
input_day1
36.5 ms
day1_part1 (generic function with 1 method)
73.9 Î¼s
day1_part2 (generic function with 1 method)
92.2 Î¼s

Result for part 1: nothing

+
95.6 ms

Result for part 2: nothing

+
23.2 ms

Day 2

+
10.3 Î¼s
520 Î¼s
nb_of_valid_passwords_part2 (generic function with 1 method)
54.3 Î¼s
parse_day2 (generic function with 1 method)
51.0 Î¼s
nb_of_valid_passwords_part1 (generic function with 1 method)
39.7 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+
187 ms
input_day2
11.0 ms

Result for part 1: 600

+
117 Î¼s

Result for part 2: 245

+
130 Î¼s

Day 3

+
13.1 Î¼s
parse_day3 (generic function with 1 method)
29.5 Î¼s
nb_trees_encountered (generic function with 2 methods)
158 Î¼s
nb_trees_encountered_part2 (generic function with 1 method)
25.9 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+
463 ms
input_day3
323×31 LinearAlgebra.Adjoint{Bool,Array{Bool,2}}:
+ 0  0  1  0  0  0  0  0  0  1  1  1  0  0  …  0  0  1  1  0  0  1  0  1  0  0  0  0
+ 0  1  0  1  0  0  0  0  0  1  0  1  1  0     1  1  1  0  0  0  1  1  0  0  0  1  1
+ 0  0  1  0  1  0  0  1  0  0  0  0  0  0     0  1  0  1  0  0  1  0  0  0  0  0  0
+ 0  0  1  0  0  0  0  0  0  1  0  0  0  0     0  0  1  1  1  0  0  0  0  0  0  0  0
+ 0  0  0  1  0  0  1  1  1  0  0  1  1  0     0  0  0  0  0  0  0  1  1  0  0  1  1
+ 0  0  0  0  0  0  1  0  1  0  1  1  0  0  …  0  1  0  0  0  0  1  1  1  0  0  0  0
+ 0  0  0  0  0  0  0  0  0  0  1  1  0  0     1  0  0  1  1  0  0  0  0  0  0  1  0
+ ⋮              ⋮              ⋮           ⋱        ⋮              ⋮              ⋮
+ 0  0  1  0  0  0  0  0  1  0  0  0  0  0     0  0  0  1  0  0  0  0  0  0  0  0  0
+ 0  1  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  1  1  1  0  0  0  0  1
+ 0  0  0  0  0  0  0  0  1  0  1  1  1  1     0  0  0  0  0  1  0  1  0  1  0  0  0
+ 1  0  0  0  0  0  0  0  0  0  0  0  1  1  …  0  0  0  0  0  0  0  0  0  1  0  0  1
+ 0  0  0  0  0  0  0  0  0  0  0  1  0  0     0  0  0  1  0  0  0  1  0  1  0  0  0
+ 0  0  0  0  1  1  0  0  0  1  1  0  0  0     0  0  0  0  1  0  0  0  0  0  0  0  0
62.6 ms

Result for part 1: 262

+

Result for part 2: 2698900776

+
12.8 ms

Day 4

+
11.7 Î¼s
parse_day4 (generic function with 1 method)
51.2 Î¼s
count_nb_valid_passport (generic function with 2 methods)
169 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+

Test 2, part 2: true

+
187 ms
input_day4
10.8 ms

Result for part 1: 264

+

Result for part 2: 224

+
902 Î¼s

Day 5

+
12.2 Î¼s
parse_day5 (generic function with 1 method)
103 Î¼s

Test 1, part 1: true

+
217 ms
find_missing_id (generic function with 1 method)
46.4 Î¼s
input_day5
13.4 ms

Result for part 1: 850

+

Result for part 2: 599

+
32.8 ms

Day 6

+
16.8 Î¼s
parse_day6 (generic function with 1 method)
45.4 Î¼s
sum_of_group_lengths (generic function with 1 method)
48.1 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+
792 ms

Number of groups read from data/day06.txt: 490

+
1.1 ms

Result for part 1: 6735

+

Result for part 2: 3221

+
2.5 ms

Day 7

+
14.6 Î¼s
847 Î¼s
parse_day7 (generic function with 1 method)
94.5 Î¼s
bags_that_contain (generic function with 1 method)
52.1 Î¼s
nb_bags_contained (generic function with 1 method)
75.8 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+

Test 2, part 2: true

+
127 Î¼s
input_day7
3.4 ms

Result for part 1: 335

+

Result for part 2: 2431

+
2.2 ms

Day 8

+
30.1 Î¼s
1.0 ms
parse_day8 (generic function with 1 method)
33.7 Î¼s
execute (generic function with 1 method)
43.4 Î¼s
fix_to_not_loop (generic function with 1 method)
67.1 Î¼s

Test 1, part 1: true

+

Test 1, part 2: true

+
43.0 ms
input_day8
497 Î¼s

Result for part 1: (false, 1928)

+

Result for part 2: 1319

+
1.8 ms
+ + + + \ No newline at end of file