tracks/perl6/exercises/grains/example.yaml in trackler-2.1.0.33 vs tracks/perl6/exercises/grains/example.yaml in trackler-2.1.0.34
- old
+ new
@@ -9,5 +9,18 @@
} else {
is grains-on-square(.<input>), |.<expected description>;
}
}
is total-grains, |$c-data<cases>[1]<expected description>;
+
+unit: module
+example: |
+ sub grains-on-square ($number) is export {
+ die if $number < 1 or $number > 64;
+ 2**($number-1);
+ }
+
+ sub total-grains is export {
+ my Int $total;
+ for 1..64 { $total += grains-on-square($_) }
+ $total;
+ }