File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -14,17 +14,14 @@ class Solution : Solver {
1414 const int height = 103 ;
1515
1616 // 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 ) ;
2623
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
2825 public object PartTwo ( string input ) =>
2926 Simulate ( input )
3027 . TakeWhile ( robots => ! Plot ( robots ) . Contains ( "#################" ) )
You can’t perform that action at this time.
0 commit comments