aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-128/mark-anderson/raku/ch-1.raku52
1 files changed, 24 insertions, 28 deletions
diff --git a/challenge-128/mark-anderson/raku/ch-1.raku b/challenge-128/mark-anderson/raku/ch-1.raku
index 7e33cfec7d..84d89f6f4f 100644
--- a/challenge-128/mark-anderson/raku/ch-1.raku
+++ b/challenge-128/mark-anderson/raku/ch-1.raku
@@ -1,32 +1,28 @@
#!/usr/bin/env raku
-say "Example 1";
-.say for max-sub-matrix(<1 0 0 0 1 0>,
- <1 1 0 0 0 1>,
- <1 0 0 0 0 0>);
-
-say " ";
-
-say "Example 2";
-.say for max-sub-matrix(<0 0 1 1>,
- <0 0 0 1>,
- <0 0 1 0>);
-
-say " ";
-
-say "Example 3";
-.say for max-sub-matrix(<1 0 1 0 1 0 1 0 1 0 0 1>,
- <1 0 1 0 1 0 1 0 1 0 0 1>,
- <1 0 0 0 1 0 0 0 1 1 0 0>,
- <1 0 0 0 1 0 0 0 1 1 0 0>,
- <1 0 0 0 1 0 1 0 1 0 1 1>,
- <1 0 0 0 1 0 0 0 1 0 0 1>,
- <1 0 1 0 1 0 1 0 1 0 0 1>,
- <1 0 1 0 1 0 1 0 1 0 0 0>,
- <1 0 1 0 1 0 1 0 1 0 0 1>,
- <1 0 1 0 1 0 1 0 1 0 0 1>,
- <1 0 1 0 1 0 1 0 1 0 0 0>,
- <1 0 0 0 0 0 0 0 1 0 1 0>);
+use Test;
+plan 3;
+
+is-deeply max-sub-matrix(<1 0 0 0 1 0>,
+ <1 1 0 0 0 1>,
+ <1 0 0 0 0 0>), ['2 x 3', '3 x 2'];
+
+is-deeply max-sub-matrix(<0 0 1 1>,
+ <0 0 0 1>,
+ <0 0 1 0>), ['3 x 2',];
+
+is-deeply max-sub-matrix(<1 0 1 0 1 0 1 0 1 0 0 1>,
+ <1 0 1 0 1 0 1 0 1 0 0 1>,
+ <1 0 0 0 1 0 0 0 1 1 0 0>,
+ <1 0 0 0 1 0 0 0 1 1 0 0>,
+ <1 0 0 0 1 0 1 0 1 0 1 1>,
+ <1 0 0 0 1 0 0 0 1 0 0 1>,
+ <1 0 1 0 1 0 1 0 1 0 0 1>,
+ <1 0 1 0 1 0 1 0 1 0 0 0>,
+ <1 0 1 0 1 0 1 0 1 0 0 1>,
+ <1 0 1 0 1 0 1 0 1 0 0 1>,
+ <1 0 1 0 1 0 1 0 1 0 0 0>,
+ <1 0 0 0 0 0 0 0 1 0 1 0>), ['4 x 3', '6 x 2'];
sub max-sub-matrix(+$matrix)
{
@@ -52,5 +48,5 @@ sub max-sub-matrix(+$matrix)
}
}
- %results.maxpairs;
+ %results.maxpairs>>.key.sort.Array;
}