|
|
@@ -49,7 +49,6 @@ func parts(rotations []Rotation) (int, int) {
|
|
|
dial := 50
|
|
|
|
|
|
for _, rotation := range rotations {
|
|
|
- was := dial
|
|
|
if rotation.Direction == 'L' {
|
|
|
dial -= rotation.Clicks
|
|
|
} else {
|
|
|
@@ -58,10 +57,12 @@ func parts(rotations []Rotation) (int, int) {
|
|
|
|
|
|
if dial > 100 {
|
|
|
passedZeros += dial / 100
|
|
|
+ if dial%100 == 0 {
|
|
|
+ passedZeros--
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if dial < 0 {
|
|
|
- fmt.Println(was, dial, rotation, passedZeros)
|
|
|
if abs(dial) > 100 {
|
|
|
passedZeros += abs(dial) / 100
|
|
|
}
|
|
|
@@ -69,7 +70,10 @@ func parts(rotations []Rotation) (int, int) {
|
|
|
if rotation.Clicks != abs(dial) {
|
|
|
passedZeros++
|
|
|
}
|
|
|
- fmt.Println(was, dial, rotation, passedZeros)
|
|
|
+
|
|
|
+ if dial%100 == 0 {
|
|
|
+ passedZeros--
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
dial %= 100
|