File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
aoclp_solutions/src/y2025 Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -41,23 +41,17 @@ fn all_moves() -> impl Iterator<Item = i64> {
4141 } ) )
4242}
4343
44+ #[ repr( i64 ) ]
4445#[ derive( Debug , Copy , Clone ) ]
4546enum RotationDirection {
46- Left ,
47- Right ,
47+ Left = - 1 ,
48+ Right = 1 ,
4849}
4950
5051impl RotationDirection {
5152 fn one_tick ( self ) -> Rotation {
5253 Rotation { direction : self , clicks : 1 }
5354 }
54-
55- fn turn_modifier ( self ) -> i64 {
56- match self {
57- RotationDirection :: Left => -1 ,
58- RotationDirection :: Right => 1 ,
59- }
60- }
6155}
6256
6357impl FromStr for RotationDirection {
@@ -81,7 +75,7 @@ struct Rotation {
8175
8276impl Rotation {
8377 fn apply ( & self , dial : i64 ) -> i64 {
84- ( dial + self . clicks * self . direction . turn_modifier ( ) ) . rem_euclid ( 100 )
78+ ( dial + self . clicks * ( self . direction as i64 ) ) . rem_euclid ( 100 )
8579 }
8680}
8781
You can’t perform that action at this time.
0 commit comments