Son aktivite 3 weeks ago Unlisted

The first day of Advent of Code (only tested on the example inputs).

Revizyon c58a0ee954a9b4b63e26dd3b555196d6a84f0d91

AoC-Day1.nv Ham Playground
1|:: rotate $direction :@math: $n|
2 :dial: $n
3|:: rotate right :dial: 99|
4 :dial: 0
5|:: rotate left :dial: 0|
6 :dial: 99
7|:: rotate right? :dial: $n|
8 :@math: add $n 1
9|:: rotate left? :dial: $n|
10 :@math: subtract $n 1
11
12|:: rotate $direction 0 times|
13|:: rotate $direction $n times :@math: $x|
14 :: rotate $direction $x times
15|:: rotate $direction $n times? :next:|
16 :@math: subtract $n 1
17|:: rotate $direction $n times?|
18 :: rotate $direction
19 :next:
20
21|:: read the rotations? :rotations: $direction $amount|
22 :: rotate $direction $amount times
23 :: if the dial is 0, increment the code
24|:: read the rotations|
25
26|:: if the dial is 0, increment the code :@math: $n|
27 :code: $n
28|:: if the dial is 0, increment the code? :dial: 0? :code: $n|
29 :@math: add 1 $n
30|:: if the dial is 0, increment the code|
31
32||:: read the rotations
33 :dial: 50
34 :code: 0
35 :rotations:
36 . left 68
37 . left 30
38 . right 48
39 . left 5
40 . right 60
41 . left 55
42 . left 1
43 . left 99
44 . right 14
45 . left 82