aboutsummaryrefslogtreecommitdiff
path: root/challenge-109
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2021-04-25 21:35:52 +0100
committerGitHub <noreply@github.com>2021-04-25 21:35:52 +0100
commit35112129b544f058f2d66e33d3e5540adab65d86 (patch)
tree5a87581c0caad5f24e47d91fd208f6ec12b4014a /challenge-109
parent6f8ce1414892ec83c36aea7c2c54256d3a7ccf0c (diff)
parent895a9d76deaaebf7e0d63a3e2551b0c1fb1bcd11 (diff)
downloadperlweeklychallenge-club-35112129b544f058f2d66e33d3e5540adab65d86.tar.gz
perlweeklychallenge-club-35112129b544f058f2d66e33d3e5540adab65d86.tar.bz2
perlweeklychallenge-club-35112129b544f058f2d66e33d3e5540adab65d86.zip
Merge pull request #3953 from k-mx/master
Challenge 109 part 2 by Maxim Kolodyazhny
Diffstat (limited to 'challenge-109')
-rwxr-xr-xchallenge-109/maxim-kolodyazhny/raku/ch-2.raku19
1 files changed, 19 insertions, 0 deletions
diff --git a/challenge-109/maxim-kolodyazhny/raku/ch-2.raku b/challenge-109/maxim-kolodyazhny/raku/ch-2.raku
new file mode 100755
index 0000000000..bc524a2fef
--- /dev/null
+++ b/challenge-109/maxim-kolodyazhny/raku/ch-2.raku
@@ -0,0 +1,19 @@
+#!/usr/bin/env raku
+
+multi sub MAIN ( $_ where { /\,/ } ) { samewith .split: <,> }
+multi sub MAIN ( $_ where { .unique and .all ~~ /^ \d+ $/ and .elems == 7 }) {
+ .permutations
+ .first({
+ [==] .rotor( <2 -1 3 -1 3 -1>.pairup )>>.sum
+ })
+ .say
+}
+
+sub USAGE() {
+ print qq:to/EOH/;
+ Usage: {$*PROGRAM-NAME} [1,2,3...,7]
+
+ Prints the answer for "Four Squares Puzzle"
+EOH
+}
+