File tree 1 file changed +7
-10
lines changed
1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,14 @@ class Solution : Solver {
14
14
const int height = 103 ;
15
15
16
16
// run the simulation for 100 steps and count the robots in the different quadrants.
17
- public object PartOne ( string input ) {
18
- var quadrants = Simulate ( input )
19
- . ElementAt ( 100 )
20
- . CountBy ( GetQuadrant )
21
- . Where ( group => group . Key . x != 0 && group . Key . y != 0 )
22
- . Select ( group => group . Value )
23
- . ToArray ( ) ;
24
- return quadrants [ 0 ] * quadrants [ 1 ] * quadrants [ 2 ] * quadrants [ 3 ] ;
25
- }
17
+ public object PartOne ( string input ) =>
18
+ Simulate ( input )
19
+ . ElementAt ( 100 )
20
+ . CountBy ( GetQuadrant )
21
+ . Where ( group => group . Key . x != 0 && group . Key . y != 0 )
22
+ . Aggregate ( 1 , ( acc , group ) => acc * group . Value ) ;
26
23
27
- // i figured that the xmas tree pattern has a long horizontal ### pattern in it
24
+ // I figured that the xmas tree pattern has a long horizontal ### pattern in it
28
25
public object PartTwo ( string input ) =>
29
26
Simulate ( input )
30
27
. TakeWhile ( robots => ! Plot ( robots ) . Contains ( "#################" ) )
You can’t perform that action at this time.
0 commit comments