File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
aoclp_solutions/src/y2025 Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -34,8 +34,8 @@ fn all_moves() -> impl Iterator<Item = i64> {
3434 let from = dial;
3535 dial = rotation. apply ( dial) ;
3636
37- let tick = rotation. direction . one_tick ( ) ;
38- successors ( Some ( from) , move |int_dial| Some ( tick . apply ( * int_dial) ) )
37+ let step = rotation. step ( ) ;
38+ successors ( Some ( from) , move |int_dial| Some ( step . apply ( * int_dial) ) )
3939 . skip ( 1 )
4040 . take ( rotation. clicks as usize )
4141 } ) )
@@ -48,12 +48,6 @@ enum RotationDirection {
4848 Right = 1 ,
4949}
5050
51- impl RotationDirection {
52- fn one_tick ( self ) -> Rotation {
53- Rotation { direction : self , clicks : 1 }
54- }
55- }
56-
5751impl FromStr for RotationDirection {
5852 type Err = aoclp:: Error ;
5953
@@ -77,6 +71,10 @@ impl Rotation {
7771 fn apply ( & self , dial : i64 ) -> i64 {
7872 ( dial + self . clicks * ( self . direction as i64 ) ) . rem_euclid ( 100 )
7973 }
74+
75+ fn step ( & self ) -> Self {
76+ Self { direction : self . direction , clicks : 1 }
77+ }
8078}
8179
8280impl FromStr for Rotation {
You can’t perform that action at this time.
0 commit comments