File tree 1 file changed +16
-6
lines changed
1 file changed +16
-6
lines changed Original file line number Diff line number Diff line change 6
6
# https://opensource.org/licenses/MIT.
7
7
#
8
8
# https://adventofcode.com/2021/day/__DAY_NUM__
9
+ use v6.d ;
10
+
11
+ grammar InputFormat {
12
+ rule TOP { .* }
13
+ }
14
+
15
+ class FormatActions {
16
+ method TOP ($/ ) { }
17
+ }
9
18
10
19
class __CLASS_NAME__ {
11
20
has $ . input is required ;
12
- has $ . input-lines = $ ! input . lines ;
21
+ has @ . input-lines = $ ! input . lines ;
22
+ has @ . parsed-lines = $ ! input . lines . map :
23
+ { InputFormat. parse($ _ , : actions(FormatActions. new )) };
13
24
14
- method solve-part1 () of Str (Cool ) {
25
+ method solve-part1 ( --> Str (Cool ) ) {
15
26
" TODO" ;
16
27
}
17
28
18
- method solve-part2 () of Str (Cool ) {
29
+ method solve-part2 ( --> Str (Cool ) ) {
19
30
" TODO" ;
20
31
}
21
32
}
@@ -29,11 +40,10 @@ class RunContext {
29
40
my $ expected = $ . expected «$ part » // ' ' ;
30
41
say " Running __CLASS_NAME__ part $ part on $ ! input-file expecting '$ expected '" ;
31
42
my $ solver = __CLASS_NAME__. new (: $ ! input );
32
- my $ method = $ solver .^ find_method(" solve-part$ part" ). assuming : $ solver ;
33
43
my $ start = now;
34
- my $ result = $ method ();
44
+ my $ result = $ solver . " solve-part $ part " ();
35
45
my $ end = now;
36
- say $ result ;
46
+ put $ result ;
37
47
" Part $ part took %.3fms\n " . printf (($ end - $ start ) * 1000 );
38
48
if $ expected {
39
49
if $ expected eq $ result {
You can’t perform that action at this time.
0 commit comments