aboutsummaryrefslogtreecommitdiff
path: root/challenge-030
diff options
context:
space:
mode:
authorMohammad S Anwar <Mohammad.Anwar@yahoo.com>2019-10-15 15:47:04 +0100
committerGitHub <noreply@github.com>2019-10-15 15:47:04 +0100
commit03faf2af6a5b99388399570b045a0039ea1697c9 (patch)
tree28c13cad25c4833ada4b94119d00916d612f0f2b /challenge-030
parent7c3b2d7b0d24493363aacd3199682e52bd7e1d62 (diff)
parent9915dc28049f3e451fd6e5476d5b7ee2077747a4 (diff)
downloadperlweeklychallenge-club-03faf2af6a5b99388399570b045a0039ea1697c9.tar.gz
perlweeklychallenge-club-03faf2af6a5b99388399570b045a0039ea1697c9.tar.bz2
perlweeklychallenge-club-03faf2af6a5b99388399570b045a0039ea1697c9.zip
Merge pull request #782 from Doomtrain14/master
Added perl6 solution ch#30-2 & updated some
Diffstat (limited to 'challenge-030')
-rw-r--r--challenge-030/yet-ebreo/perl5/ch-2.pl23
-rw-r--r--challenge-030/yet-ebreo/perl6/ch-1.p616
-rw-r--r--challenge-030/yet-ebreo/perl6/ch-2.p699
3 files changed, 135 insertions, 3 deletions
diff --git a/challenge-030/yet-ebreo/perl5/ch-2.pl b/challenge-030/yet-ebreo/perl5/ch-2.pl
index 87a22ba2ef..941afc638f 100644
--- a/challenge-030/yet-ebreo/perl5/ch-2.pl
+++ b/challenge-030/yet-ebreo/perl5/ch-2.pl
@@ -9,7 +9,7 @@ use warnings;
use feature 'say';
my $r = join ",", 0..12;
-eval==12 && /[02468]\+/ && say y/+/,/r while glob "{$r}+{$r}+{$r}";
+eval==12 && say y/+/,/r while glob "{$r}+{$r}+{$r}";
=begin
@@ -28,11 +28,17 @@ perl .\ch-2.pl
0,11,1
0,12,0
1,0,11
+1,1,10
1,2,9
+1,3,8
1,4,7
+1,5,6
1,6,5
+1,7,4
1,8,3
+1,9,2
1,10,1
+1,11,0
2,0,10
2,1,9
2,2,8
@@ -45,10 +51,15 @@ perl .\ch-2.pl
2,9,1
2,10,0
3,0,9
+3,1,8
3,2,7
+3,3,6
3,4,5
+3,5,4
3,6,3
+3,7,2
3,8,1
+3,9,0
4,0,8
4,1,7
4,2,6
@@ -59,9 +70,13 @@ perl .\ch-2.pl
4,7,1
4,8,0
5,0,7
+5,1,6
5,2,5
+5,3,4
5,4,3
+5,5,2
5,6,1
+5,7,0
6,0,6
6,1,5
6,2,4
@@ -70,18 +85,24 @@ perl .\ch-2.pl
6,5,1
6,6,0
7,0,5
+7,1,4
7,2,3
+7,3,2
7,4,1
+7,5,0
8,0,4
8,1,3
8,2,2
8,3,1
8,4,0
9,0,3
+9,1,2
9,2,1
+9,3,0
10,0,2
10,1,1
10,2,0
11,0,1
+11,1,0
12,0,0
=cut \ No newline at end of file
diff --git a/challenge-030/yet-ebreo/perl6/ch-1.p6 b/challenge-030/yet-ebreo/perl6/ch-1.p6
index 041e7854b1..294df0499c 100644
--- a/challenge-030/yet-ebreo/perl6/ch-1.p6
+++ b/challenge-030/yet-ebreo/perl6/ch-1.p6
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
# Write a script to list dates for Sunday
# Christmas between 2019 and 2100.
# For example, 25 Dec 2022 is Sunday.
@@ -8,4 +7,17 @@ for 2019..2100 -> $year {
if ($date.day-of-week == 7) {
say "12/25/$year"
}
-} \ No newline at end of file
+}
+
+# perl6 .\ch-1.p6
+# 12/25/2022
+# 12/25/2033
+# 12/25/2039
+# 12/25/2044
+# 12/25/2050
+# 12/25/2061
+# 12/25/2067
+# 12/25/2072
+# 12/25/2078
+# 12/25/2089
+# 12/25/2095 \ No newline at end of file
diff --git a/challenge-030/yet-ebreo/perl6/ch-2.p6 b/challenge-030/yet-ebreo/perl6/ch-2.p6
new file mode 100644
index 0000000000..893a07fd15
--- /dev/null
+++ b/challenge-030/yet-ebreo/perl6/ch-2.p6
@@ -0,0 +1,99 @@
+# Write a script to print all possible series of 3 numbers
+# Where in each series at least one of the
+# number is even and sum of the three numbers
+# is always 12. For example, 3,4,5.
+
+$_.sum == 12 && .say for [X] (0 .. 12) xx 3;
+
+# perl6 .\ch-2.p6
+# (0 0 12)
+# (0 1 11)
+# (0 2 10)
+# (0 3 9)
+# (0 4 8)
+# (0 5 7)
+# (0 6 6)
+# (0 7 5)
+# (0 8 4)
+# (0 9 3)
+# (0 10 2)
+# (0 11 1)
+# (0 12 0)
+# (1 0 11)
+# (1 1 10)
+# (1 2 9)
+# (1 3 8)
+# (1 4 7)
+# (1 5 6)
+# (1 6 5)
+# (1 7 4)
+# (1 8 3)
+# (1 9 2)
+# (1 10 1)
+# (1 11 0)
+# (2 0 10)
+# (2 1 9)
+# (2 2 8)
+# (2 3 7)
+# (2 4 6)
+# (2 5 5)
+# (2 6 4)
+# (2 7 3)
+# (2 8 2)
+# (2 9 1)
+# (2 10 0)
+# (3 0 9)
+# (3 1 8)
+# (3 2 7)
+# (3 3 6)
+# (3 4 5)
+# (3 5 4)
+# (3 6 3)
+# (3 7 2)
+# (3 8 1)
+# (3 9 0)
+# (4 0 8)
+# (4 1 7)
+# (4 2 6)
+# (4 3 5)
+# (4 4 4)
+# (4 5 3)
+# (4 6 2)
+# (4 7 1)
+# (4 8 0)
+# (5 0 7)
+# (5 1 6)
+# (5 2 5)
+# (5 3 4)
+# (5 4 3)
+# (5 5 2)
+# (5 6 1)
+# (5 7 0)
+# (6 0 6)
+# (6 1 5)
+# (6 2 4)
+# (6 3 3)
+# (6 4 2)
+# (6 5 1)
+# (6 6 0)
+# (7 0 5)
+# (7 1 4)
+# (7 2 3)
+# (7 3 2)
+# (7 4 1)
+# (7 5 0)
+# (8 0 4)
+# (8 1 3)
+# (8 2 2)
+# (8 3 1)
+# (8 4 0)
+# (9 0 3)
+# (9 1 2)
+# (9 2 1)
+# (9 3 0)
+# (10 0 2)
+# (10 1 1)
+# (10 2 0)
+# (11 0 1)
+# (11 1 0)
+# (12 0 0) \ No newline at end of file