diff options
| author | Mark A <andemark@a-iot1t.uch.ad.pvt> | 2021-08-31 09:11:09 -0600 |
|---|---|---|
| committer | Mark A <andemark@a-iot1t.uch.ad.pvt> | 2021-08-31 09:11:09 -0600 |
| commit | d0d38e12cae88cf9501ce535485316d6e8f8accb (patch) | |
| tree | c184a866a32b2b56c1e7522d7a3e648d498c8a5f | |
| parent | f77cb5f593125cdd2d65225bd92633b12fd621c3 (diff) | |
| download | perlweeklychallenge-club-d0d38e12cae88cf9501ce535485316d6e8f8accb.tar.gz perlweeklychallenge-club-d0d38e12cae88cf9501ce535485316d6e8f8accb.tar.bz2 perlweeklychallenge-club-d0d38e12cae88cf9501ce535485316d6e8f8accb.zip | |
ch-1.raku touch-up
| -rw-r--r-- | challenge-128/mark-anderson/raku/ch-1.raku | 52 |
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; } |
