aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-333/arne-sommer/blog.txt1
-rwxr-xr-xchallenge-333/arne-sommer/raku/ch-1.raku24
-rwxr-xr-xchallenge-333/arne-sommer/raku/ch-2.raku5
-rwxr-xr-xchallenge-333/arne-sommer/raku/duplicate-zeroes5
-rwxr-xr-xchallenge-333/arne-sommer/raku/straight-line24
5 files changed, 59 insertions, 0 deletions
diff --git a/challenge-333/arne-sommer/blog.txt b/challenge-333/arne-sommer/blog.txt
new file mode 100644
index 0000000000..37ac339a2c
--- /dev/null
+++ b/challenge-333/arne-sommer/blog.txt
@@ -0,0 +1 @@
+https://raku-musings.com/straight-zeros.html \ No newline at end of file
diff --git a/challenge-333/arne-sommer/raku/ch-1.raku b/challenge-333/arne-sommer/raku/ch-1.raku
new file mode 100755
index 0000000000..99b2cceb2a
--- /dev/null
+++ b/challenge-333/arne-sommer/raku/ch-1.raku
@@ -0,0 +1,24 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@list where @list.elems > 2 && all(@list) ~~ /^\d+\,\d+$/,
+ :v(:$verbose));
+
+my ($Ax, $Ay) = @list.shift.split(",")>>.Int;
+my ($Bx, $By) = @list.shift.split(",")>>.Int;
+
+while @list
+{
+ my ($Cx, $Cy) = @list.shift.split(",")>>.Int;
+
+ say ": Checking if ($Ax,$Ay), ($Bx,$By), ($Cx,$Cy) forms a triangle" if $verbose;
+
+ if $Ax * ($By - $Cy) + $Bx * ($Cy - $Ay) + $Cx * ($Ay - $By)
+ {
+ say ": trangle detected" if $verbose;
+ say False;
+ exit
+ }
+}
+
+say True;
+
diff --git a/challenge-333/arne-sommer/raku/ch-2.raku b/challenge-333/arne-sommer/raku/ch-2.raku
new file mode 100755
index 0000000000..b63febec22
--- /dev/null
+++ b/challenge-333/arne-sommer/raku/ch-2.raku
@@ -0,0 +1,5 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@ints where @ints.elems > 0 && all(@ints) ~~ Int);
+
+say @ints.map({ $_ ?? $_ !! (0,0) })[*;*][0 .. @ints.end];
diff --git a/challenge-333/arne-sommer/raku/duplicate-zeroes b/challenge-333/arne-sommer/raku/duplicate-zeroes
new file mode 100755
index 0000000000..b63febec22
--- /dev/null
+++ b/challenge-333/arne-sommer/raku/duplicate-zeroes
@@ -0,0 +1,5 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@ints where @ints.elems > 0 && all(@ints) ~~ Int);
+
+say @ints.map({ $_ ?? $_ !! (0,0) })[*;*][0 .. @ints.end];
diff --git a/challenge-333/arne-sommer/raku/straight-line b/challenge-333/arne-sommer/raku/straight-line
new file mode 100755
index 0000000000..99b2cceb2a
--- /dev/null
+++ b/challenge-333/arne-sommer/raku/straight-line
@@ -0,0 +1,24 @@
+#! /usr/bin/env raku
+
+unit sub MAIN (*@list where @list.elems > 2 && all(@list) ~~ /^\d+\,\d+$/,
+ :v(:$verbose));
+
+my ($Ax, $Ay) = @list.shift.split(",")>>.Int;
+my ($Bx, $By) = @list.shift.split(",")>>.Int;
+
+while @list
+{
+ my ($Cx, $Cy) = @list.shift.split(",")>>.Int;
+
+ say ": Checking if ($Ax,$Ay), ($Bx,$By), ($Cx,$Cy) forms a triangle" if $verbose;
+
+ if $Ax * ($By - $Cy) + $Bx * ($Cy - $Ay) + $Cx * ($Ay - $By)
+ {
+ say ": trangle detected" if $verbose;
+ say False;
+ exit
+ }
+}
+
+say True;
+