aboutsummaryrefslogtreecommitdiff
path: root/challenge-270
diff options
context:
space:
mode:
Diffstat (limited to 'challenge-270')
-rw-r--r--challenge-270/mark-anderson/raku/ch-1.raku23
1 files changed, 23 insertions, 0 deletions
diff --git a/challenge-270/mark-anderson/raku/ch-1.raku b/challenge-270/mark-anderson/raku/ch-1.raku
new file mode 100644
index 0000000000..bc0a28297c
--- /dev/null
+++ b/challenge-270/mark-anderson/raku/ch-1.raku
@@ -0,0 +1,23 @@
+#!/usr/bin/env raku
+use Test;
+
+is special-positions([
+ [1,0,0],
+ [0,0,1],
+ [1,0,0],
+ ]), 1;
+
+is special-positions([
+ [1,0,0],
+ [0,1,0],
+ [0,0,1],
+ ]), 3;
+
+sub special-positions(@m)
+{
+ my @ones = (^@m X ^@m[0]).grep({ @m[.[0];.[1]] });
+
+ + @ones.grep({ all .[0] == one(@ones>>.[0]),
+ .[1] == one(@ones>>.[1])
+ })
+}