AoC-Day1.nv
· 1.0 KiB · Text
Brut
Playground
|:: rotate $direction :@math: $n|
:dial: $n
|:: rotate right :dial: 99|
:dial: 0
|:: rotate left :dial: 0|
:dial: 99
|:: rotate right? :dial: $n|
:@math: add $n 1
|:: rotate left? :dial: $n|
:@math: subtract $n 1
|:: rotate $direction 0 times|
|:: rotate $direction $n times :@math: $x|
:: rotate $direction $x times
|:: rotate $direction $n times? :next:|
:@math: subtract $n 1
|:: rotate $direction $n times?|
:: rotate $direction
:next:
|:: read the rotations? :rotations: $direction $amount|
:: rotate $direction $amount times
:: if the dial is 0, increment the code
|:: read the rotations|
|:: if the dial is 0, increment the code :@math: $n|
:code: $n
|:: if the dial is 0, increment the code? :dial: 0? :code: $n|
:@math: add 1 $n
|:: if the dial is 0, increment the code|
||:: read the rotations
:dial: 50
:code: 0
:rotations:
. left 68
. left 30
. right 48
. left 5
. right 60
. left 55
. left 1
. left 99
. right 14
. left 82
| 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 |
Aoc-Day1-Playground.nv
· 1.0 KiB · Text
Brut
Playground
||:@include: lib/rpn.nv
|:: rotate $direction :@rpn data: $n|
:dial: $n
|:: rotate right :dial: 99|
:dial: 0
|:: rotate left :dial: 0|
:dial: 99
|:: rotate right? :dial: $n|
:@rpn: ($n 1 +)
|:: rotate left? :dial: $n|
:@rpn: ($n 1 -)
|:: rotate $direction 0 times|
|:: rotate $direction $n times :@rpn data: $x|
:: rotate $direction $x times
|:: rotate $direction $n times? :next:|
:@rpn: ($n 1 -)
|:: rotate $direction $n times?|
:: rotate $direction
:next:
|:: read the rotations? :rotations: $direction $amount|
:: rotate $direction $amount times
:: if the dial is 0, increment the code
|:: read the rotations|
|:: if the dial is 0, increment the code :@rpn data: $n|
:code: $n
|:: if the dial is 0, increment the code? :dial: 0? :code: $n|
:@rpn: ($n 1 +)
|:: if the dial is 0, increment the code|
||:: read the rotations
:dial: 50
:code: 0
:rotations:
. left 68
. left 30
. right 48
. left 5
. right 60
. left 55
. left 1
. left 99
. right 14
. left 82
| 1 | ||:@include: lib/rpn.nv |
| 2 | |
| 3 | |:: rotate $direction :@rpn data: $n| |
| 4 | :dial: $n |
| 5 | |:: rotate right :dial: 99| |
| 6 | :dial: 0 |
| 7 | |:: rotate left :dial: 0| |
| 8 | :dial: 99 |
| 9 | |:: rotate right? :dial: $n| |
| 10 | :@rpn: ($n 1 +) |
| 11 | |:: rotate left? :dial: $n| |
| 12 | :@rpn: ($n 1 -) |
| 13 | |
| 14 | |:: rotate $direction 0 times| |
| 15 | |:: rotate $direction $n times :@rpn data: $x| |
| 16 | :: rotate $direction $x times |
| 17 | |:: rotate $direction $n times? :next:| |
| 18 | :@rpn: ($n 1 -) |
| 19 | |:: rotate $direction $n times?| |
| 20 | :: rotate $direction |
| 21 | :next: |
| 22 | |
| 23 | |:: read the rotations? :rotations: $direction $amount| |
| 24 | :: rotate $direction $amount times |
| 25 | :: if the dial is 0, increment the code |
| 26 | |:: read the rotations| |
| 27 | |
| 28 | |:: if the dial is 0, increment the code :@rpn data: $n| |
| 29 | :code: $n |
| 30 | |:: if the dial is 0, increment the code? :dial: 0? :code: $n| |
| 31 | :@rpn: ($n 1 +) |
| 32 | |:: if the dial is 0, increment the code| |
| 33 | |
| 34 | ||:: read the rotations |
| 35 | :dial: 50 |
| 36 | :code: 0 |
| 37 | :rotations: |
| 38 | . left 68 |
| 39 | . left 30 |
| 40 | . right 48 |
| 41 | . left 5 |
| 42 | . right 60 |
| 43 | . left 55 |
| 44 | . left 1 |
| 45 | . left 99 |
| 46 | . right 14 |
| 47 | . left 82 |