aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad Sajid Anwar <Mohammad.Anwar@yahoo.com>2025-08-11 00:22:27 +0100
committerGitHub <noreply@github.com>2025-08-11 00:22:27 +0100
commit3022cc2fa0c84215c17f9b3bf508ea5ff0ea0b06 (patch)
treea1a41e7c19db78b38084207af8132c3b664d59b4
parent843ff8693b58afca1e467fb1163c91e413a5ec9b (diff)
parent4ccb9d36c1f086f7155961e6836acd05dfdf4ae2 (diff)
downloadperlweeklychallenge-club-3022cc2fa0c84215c17f9b3bf508ea5ff0ea0b06.tar.gz
perlweeklychallenge-club-3022cc2fa0c84215c17f9b3bf508ea5ff0ea0b06.tar.bz2
perlweeklychallenge-club-3022cc2fa0c84215c17f9b3bf508ea5ff0ea0b06.zip
Merge pull request #12491 from arnesom/challenge-333-arne-sommer
week 333 Arne Sommer
-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;
+