@@ -76,7 +76,7 @@ class Solver {
76
76
while ? @ options {
77
77
$ min ++ until @ options [$ min ];
78
78
my $ cur = @ options [$ min ]. pop ;
79
- say " Investigating ($ cur ), cost $ min" ;
79
+ $ * ERR . say : " Investigating ($ cur ), cost $ min" ;
80
80
return $ _ if $ _ < ∞ given % cost {$ cur [0 ]}. sum ;
81
81
# say "Neighbors for $cur";
82
82
# return $min if $cur == $.target;
@@ -239,21 +239,21 @@ class RunContext {
239
239
method run-part (Solver: U $ part ) {
240
240
my $ num = $ part .^ name . comb (/\d + /). head;
241
241
my $ expected = $ . expected «$ num » // ' ' ;
242
- say " Running Day15 part $ num with $ ! algorithm on $ ! input-file expecting '$ expected '" ;
242
+ $ * ERR . say : " Running Day15 part $ num with $ ! algorithm on $ ! input-file expecting '$ expected '" ;
243
243
my $ start = now;
244
244
my $ solver = $ part . new (: $ ! input , : $ ! algorithm );
245
245
my $ make-time = now;
246
246
my $ result = $ solver . solve();
247
247
my $ end = now;
248
- put $ result ;
249
- " Part $ num took %.3fms\n " . printf ( ($ end - $ start ) * 1000 );
250
- " Construction took %.3fms solve took %.3fms\n " . printf ( ($ make-time - $ start ) * 1000 , ($ end - $ make-time ) * 1000 );
248
+ put " part $ num : $ result" ;
249
+ $ * ERR . printf ( " Part $ num took %.3fms\n " , ($ end - $ start ) * 1000 );
250
+ $ * ERR . printf ( " Construction took %.3fms solve took %.3fms\n " , ($ make-time - $ start ) * 1000 , ($ end - $ make-time ) * 1000 );
251
251
@ ! passed . push ($ result eq ' TODO' || $ expected && $ expected eq $ result );
252
252
if $ expected {
253
253
if $ expected eq $ result {
254
- say " \c[CHECK MARK] PASS with expected value '$ result '" ;
254
+ $ * ERR . say : " \c[CHECK MARK] PASS with expected value '$ result '" ;
255
255
} else {
256
- say " \c[CROSS MARK] FAIL expected '$ expected ' but got '$ result '" ;
256
+ $ * ERR . say : " \c[CROSS MARK] FAIL expected '$ expected ' but got '$ result '" ;
257
257
}
258
258
}
259
259
}
@@ -270,13 +270,13 @@ sub MAIN(*@input-files, :$algorithm = "dijkstra") {
270
270
}
271
271
}
272
272
$ context . run-part(Part1);
273
- say ' ' ;
273
+ $ * ERR . say : ' ' ;
274
274
$ context . run-part(Part2);
275
275
$ exit &= all ($ context . passed);
276
276
} else {
277
- say " EMPTY INPUT FILE: $ input-file" ;
277
+ $ * ERR . say : " EMPTY INPUT FILE: $ input-file" ;
278
278
}
279
- say ' =' x 40 ;
279
+ $ * ERR . say : ' =' x 40 ;
280
280
}
281
281
exit $ exit ?? 0 !! 1 ;
282
282
}
0 commit comments