aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2020-01-06 16:21:36 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2020-01-06 16:21:36 +0000
commit25a2c304925d4276c91130275dc68d7587590fc5 (patch)
treed8bb31a89bc62b918724679059d9821017087262
parent71f15a851e231c803b8b01a529d81bc07e59627e (diff)
downloadperlweeklychallenge-club-25a2c304925d4276c91130275dc68d7587590fc5.tar.gz
perlweeklychallenge-club-25a2c304925d4276c91130275dc68d7587590fc5.tar.bz2
perlweeklychallenge-club-25a2c304925d4276c91130275dc68d7587590fc5.zip
- Added solutions by Javier Luque.
-rw-r--r--challenge-042/javier-luque/blog.txt1
-rw-r--r--challenge-042/javier-luque/perl/ch-1.pl14
-rw-r--r--challenge-042/javier-luque/perl/ch-2.pl38
-rw-r--r--challenge-042/javier-luque/raku/ch-1.p613
-rw-r--r--challenge-042/javier-luque/raku/ch-2.p629
-rw-r--r--stats/pwc-current.json73
-rw-r--r--stats/pwc-language-breakdown-summary.json74
-rw-r--r--stats/pwc-language-breakdown.json608
-rw-r--r--stats/pwc-leaders.json764
-rw-r--r--stats/pwc-summary-1-30.json42
-rw-r--r--stats/pwc-summary-121-150.json90
-rw-r--r--stats/pwc-summary-31-60.json92
-rw-r--r--stats/pwc-summary-61-90.json104
-rw-r--r--stats/pwc-summary-91-120.json104
-rw-r--r--stats/pwc-summary.json48
15 files changed, 1106 insertions, 988 deletions
diff --git a/challenge-042/javier-luque/blog.txt b/challenge-042/javier-luque/blog.txt
new file mode 100644
index 0000000000..b23134bfd4
--- /dev/null
+++ b/challenge-042/javier-luque/blog.txt
@@ -0,0 +1 @@
+https://perlchallenges.wordpress.com/2020/01/06/perl-weekly-challenge-042/
diff --git a/challenge-042/javier-luque/perl/ch-1.pl b/challenge-042/javier-luque/perl/ch-1.pl
new file mode 100644
index 0000000000..5a58151aa2
--- /dev/null
+++ b/challenge-042/javier-luque/perl/ch-1.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+# Test: ./ch-1.pl
+use strict;
+use warnings;
+use feature qw /say/;
+
+for my $i (1..50) {
+ say 'Decimal ' . $i .
+ ' = Octal ' . to_octal($i);
+}
+
+sub to_octal {
+ return sprintf('%o', shift);
+}
diff --git a/challenge-042/javier-luque/perl/ch-2.pl b/challenge-042/javier-luque/perl/ch-2.pl
new file mode 100644
index 0000000000..04a6078fd6
--- /dev/null
+++ b/challenge-042/javier-luque/perl/ch-2.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl
+# test: ./ch2.pl
+use strict;
+use warnings;
+use feature qw /say/;
+use constant {
+ MAX_STRING_LENGTH => 4
+};
+
+for my $i ( 1 .. 20 ) {
+ my $string = generate_random_string();
+ my $ok = (validate_string($string)) ? 'OK ' : 'NOT OK';
+ say $string . ' - ' . $ok;
+}
+
+sub generate_random_string {
+ my $length = int(rand(MAX_STRING_LENGTH - 1) + 2);
+ my $string;
+
+ for my $i (1 .. $length ) {
+ $string .= (int(rand(2))) ? '(' : ')';
+ }
+
+ return $string;
+}
+
+sub validate_string {
+ my $open_p;
+
+ for my $char (split('', shift)) {
+ $open_p++ if ($char eq '(');
+ $open_p-- if ($char eq ')');
+
+ return 0 if ($open_p < 0);
+ }
+
+ return ($open_p == 0);
+}
diff --git a/challenge-042/javier-luque/raku/ch-1.p6 b/challenge-042/javier-luque/raku/ch-1.p6
new file mode 100644
index 0000000000..97022c1f81
--- /dev/null
+++ b/challenge-042/javier-luque/raku/ch-1.p6
@@ -0,0 +1,13 @@
+# Test: perl6 ch-1.p6
+use v6.d;
+
+sub MAIN() {
+ for (1..50) -> $i {
+ say 'Decimal ' ~ $i ~
+ ' = Octal ' ~ to-octal($i);
+ }
+}
+
+sub to-octal(Int $i) {
+ return sprintf('%o', $i);
+}
diff --git a/challenge-042/javier-luque/raku/ch-2.p6 b/challenge-042/javier-luque/raku/ch-2.p6
new file mode 100644
index 0000000000..8d19010e59
--- /dev/null
+++ b/challenge-042/javier-luque/raku/ch-2.p6
@@ -0,0 +1,29 @@
+# Test: perl6 ./ch-2.p6
+use v6.d;
+constant $MAX_STRING_LENGTH = 4;
+
+sub MAIN () {
+ for ( 1 .. 20 ) {
+ my $string = generate-random-string();
+ my $ok = (validate-string($string)) ?? 'OK ' !! 'NOT OK';
+ say $string ~ ' - ' ~ $ok;
+ }
+}
+
+sub generate-random-string {
+ return <( )>.roll(
+ Int((2 .. $MAX_STRING_LENGTH + 1).rand)
+ ).join;
+}
+
+sub validate-string(Str $word) {
+ my $open_p;
+
+ for $word.comb -> $letter {
+ $open_p++ if ($letter eq '(');
+ $open_p-- if ($letter eq ')');
+ return 0 if ($open_p < 0);
+ }
+
+ return ($open_p == 0);
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 164640bb48..cdd8f453e8 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,22 +1,34 @@
{
- "title" : {
- "text" : "Perl Weekly Challenge - 042"
- },
- "subtitle" : {
- "text" : "[Champions: 2] Last updated at 2020-01-06 15:28:32 GMT"
- },
"plotOptions" : {
"series" : {
+ "borderWidth" : 0,
"dataLabels" : {
"enabled" : 1,
"format" : "{point.y}"
- },
- "borderWidth" : 0
+ }
}
},
"drilldown" : {
"series" : [
{
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Raku",
+ 2
+ ],
+ [
+ "Blog",
+ 1
+ ]
+ ],
+ "id" : "Javier Luque",
+ "name" : "Javier Luque"
+ },
+ {
"id" : "Kivanc Yazan",
"name" : "Kivanc Yazan",
"data" : [
@@ -27,47 +39,58 @@
]
},
{
- "id" : "Simon Proctor",
"data" : [
[
"Raku",
2
]
],
- "name" : "Simon Proctor"
+ "name" : "Simon Proctor",
+ "id" : "Simon Proctor"
}
]
},
- "tooltip" : {
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
- "followPointer" : 1,
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>"
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
- }
+ "xAxis" : {
+ "type" : "category"
},
"series" : [
{
+ "name" : "Perl Weekly Challenge - 042",
"data" : [
{
- "name" : "Kivanc Yazan",
+ "y" : 5,
+ "name" : "Javier Luque",
+ "drilldown" : "Javier Luque"
+ },
+ {
"y" : 2,
+ "name" : "Kivanc Yazan",
"drilldown" : "Kivanc Yazan"
},
{
- "name" : "Simon Proctor",
"y" : 2,
- "drilldown" : "Simon Proctor"
+ "drilldown" : "Simon Proctor",
+ "name" : "Simon Proctor"
}
],
- "name" : "Perl Weekly Challenge - 042",
"colorByPoint" : 1
}
],
- "xAxis" : {
- "type" : "category"
+ "subtitle" : {
+ "text" : "[Champions: 3] Last updated at 2020-01-06 16:21:07 GMT"
+ },
+ "title" : {
+ "text" : "Perl Weekly Challenge - 042"
+ },
+ "tooltip" : {
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
+ "followPointer" : 1
+ },
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
},
"legend" : {
"enabled" : 0
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index 730a99bdde..678a429aaa 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,35 +1,4 @@
{
- "series" : [
- {
- "name" : "Contributions",
- "data" : [
- [
- "Blog",
- 444
- ],
- [
- "Perl",
- 1690
- ],
- [
- "Raku",
- 1020
- ]
- ],
- "dataLabels" : {
- "y" : 10,
- "rotation" : -90,
- "style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
- },
- "enabled" : "true",
- "format" : "{point.y:.0f}",
- "color" : "#FFFFFF",
- "align" : "right"
- }
- }
- ],
"yAxis" : {
"title" : {
"text" : null
@@ -39,6 +8,9 @@
"tooltip" : {
"pointFormat" : "<b>{point.y:.0f}</b>"
},
+ "title" : {
+ "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
+ },
"legend" : {
"enabled" : "false"
},
@@ -48,16 +20,44 @@
"xAxis" : {
"labels" : {
"style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
}
},
"type" : "category"
},
"subtitle" : {
- "text" : "Last updated at 2020-01-06 15:28:32 GMT"
+ "text" : "Last updated at 2020-01-06 16:21:07 GMT"
},
- "title" : {
- "text" : "Perl Weekly Challenge Contributions [2019 - 2020]"
- }
+ "series" : [
+ {
+ "data" : [
+ [
+ "Blog",
+ 445
+ ],
+ [
+ "Perl",
+ 1692
+ ],
+ [
+ "Raku",
+ 1022
+ ]
+ ],
+ "dataLabels" : {
+ "format" : "{point.y:.0f}",
+ "y" : 10,
+ "align" : "right",
+ "enabled" : "true",
+ "rotation" : -90,
+ "style" : {
+ "fontSize" : "13px",
+ "fontFamily" : "Verdana, sans-serif"
+ },
+ "color" : "#FFFFFF"
+ },
+ "name" : "Contributions"
+ }
+ ]
}
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index c8903b4c3e..b353bf32f7 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,244 +1,30 @@
{
- "chart" : {
- "type" : "column"
- },
- "legend" : {
- "enabled" : "false"
- },
- "xAxis" : {
- "type" : "category"
- },
- "series" : [
- {
- "data" : [
- {
- "drilldown" : "001",
- "y" : 140,
- "name" : "#001"
- },
- {
- "drilldown" : "002",
- "y" : 109,
- "name" : "#002"
- },
- {
- "name" : "#003",
- "drilldown" : "003",
- "y" : 71
- },
- {
- "name" : "#004",
- "y" : 91,
- "drilldown" : "004"
- },
- {
- "drilldown" : "005",
- "y" : 71,
- "name" : "#005"
- },
- {
- "y" : 48,
- "drilldown" : "006",
- "name" : "#006"
- },
- {
- "name" : "#007",
- "drilldown" : "007",
- "y" : 56
- },
- {
- "drilldown" : "008",
- "y" : 70,
- "name" : "#008"
- },
- {
- "name" : "#009",
- "y" : 68,
- "drilldown" : "009"
- },
- {
- "drilldown" : "010",
- "y" : 60,
- "name" : "#010"
- },
- {
- "name" : "#011",
- "drilldown" : "011",
- "y" : 79
- },
- {
- "y" : 83,
- "drilldown" : "012",
- "name" : "#012"
- },
- {
- "y" : 76,
- "drilldown" : "013",
- "name" : "#013"
- },
- {
- "name" : "#014",
- "y" : 96,
- "drilldown" : "014"
- },
- {
- "name" : "#015",
- "y" : 93,
- "drilldown" : "015"
- },
- {
- "name" : "#016",
- "y" : 66,
- "drilldown" : "016"
- },
- {
- "drilldown" : "017",
- "y" : 79,
- "name" : "#017"
- },
- {
- "drilldown" : "018",
- "y" : 76,
- "name" : "#018"
- },
- {
- "drilldown" : "019",
- "y" : 95,
- "name" : "#019"
- },
- {
- "name" : "#020",
- "drilldown" : "020",
- "y" : 95
- },
- {
- "name" : "#021",
- "y" : 67,
- "drilldown" : "021"
- },
- {
- "name" : "#022",
- "y" : 63,
- "drilldown" : "022"
- },
- {
- "name" : "#023",
- "drilldown" : "023",
- "y" : 91
- },
- {
- "name" : "#024",
- "y" : 70,
- "drilldown" : "024"
- },
- {
- "y" : 55,
- "drilldown" : "025",
- "name" : "#025"
- },
- {
- "name" : "#026",
- "drilldown" : "026",
- "y" : 70
- },
- {
- "name" : "#027",
- "drilldown" : "027",
- "y" : 58
- },
- {
- "name" : "#028",
- "drilldown" : "028",
- "y" : 78
- },
- {
- "drilldown" : "029",
- "y" : 77,
- "name" : "#029"
- },
- {
- "name" : "#030",
- "drilldown" : "030",
- "y" : 115
- },
- {
- "drilldown" : "031",
- "y" : 87,
- "name" : "#031"
- },
- {
- "name" : "#032",
- "drilldown" : "032",
- "y" : 92
- },
- {
- "y" : 108,
- "drilldown" : "033",
- "name" : "#033"
- },
- {
- "name" : "#034",
- "drilldown" : "034",
- "y" : 60
- },
- {
- "name" : "#035",
- "drilldown" : "035",
- "y" : 60
- },
- {
- "y" : 61,
- "drilldown" : "036",
- "name" : "#036"
- },
- {
- "name" : "#037",
- "drilldown" : "037",
- "y" : 63
- },
- {
- "name" : "#038",
- "y" : 60,
- "drilldown" : "038"
- },
- {
- "name" : "#039",
- "y" : 60,
- "drilldown" : "039"
- },
- {
- "y" : 66,
- "drilldown" : "040",
- "name" : "#040"
- },
- {
- "name" : "#041",
- "y" : 67,
- "drilldown" : "041"
- },
- {
- "drilldown" : "042",
- "y" : 4,
- "name" : "#042"
- }
- ],
- "name" : "Perl Weekly Challenge Languages",
- "colorByPoint" : "true"
- }
- ],
"yAxis" : {
"title" : {
"text" : "Total Solutions"
}
},
"tooltip" : {
- "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
"headerFormat" : "<span style=\"font-size:11px\"></span>",
- "followPointer" : "true"
+ "followPointer" : "true",
+ "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>"
+ },
+ "title" : {
+ "text" : "Perl Weekly Challenge Language"
+ },
+ "legend" : {
+ "enabled" : "false"
+ },
+ "chart" : {
+ "type" : "column"
+ },
+ "xAxis" : {
+ "type" : "category"
},
"drilldown" : {
"series" : [
{
+ "name" : "001",
"id" : "001",
"data" : [
[
@@ -253,12 +39,9 @@
"Blog",
11
]
- ],
- "name" : "001"
+ ]
},
{
- "id" : "002",
- "name" : "002",
"data" : [
[
"Perl",
@@ -272,11 +55,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "002",
+ "name" : "002"
},
{
- "id" : "003",
"name" : "003",
+ "id" : "003",
"data" : [
[
"Perl",
@@ -293,8 +78,8 @@
]
},
{
- "id" : "004",
"name" : "004",
+ "id" : "004",
"data" : [
[
"Perl",
@@ -329,7 +114,6 @@
]
},
{
- "id" : "006",
"data" : [
[
"Perl",
@@ -344,10 +128,10 @@
7
]
],
- "name" : "006"
+ "name" : "006",
+ "id" : "006"
},
{
- "id" : "007",
"data" : [
[
"Perl",
@@ -362,10 +146,10 @@
10
]
],
- "name" : "007"
+ "name" : "007",
+ "id" : "007"
},
{
- "id" : "008",
"data" : [
[
"Perl",
@@ -380,10 +164,12 @@
12
]
],
- "name" : "008"
+ "name" : "008",
+ "id" : "008"
},
{
"name" : "009",
+ "id" : "009",
"data" : [
[
"Perl",
@@ -397,10 +183,10 @@
"Blog",
13
]
- ],
- "id" : "009"
+ ]
},
{
+ "name" : "010",
"id" : "010",
"data" : [
[
@@ -415,11 +201,11 @@
"Blog",
11
]
- ],
- "name" : "010"
+ ]
},
{
"name" : "011",
+ "id" : "011",
"data" : [
[
"Perl",
@@ -433,11 +219,9 @@
"Blog",
10
]
- ],
- "id" : "011"
+ ]
},
{
- "id" : "012",
"data" : [
[
"Perl",
@@ -452,10 +236,10 @@
11
]
],
- "name" : "012"
+ "name" : "012",
+ "id" : "012"
},
{
- "id" : "013",
"data" : [
[
"Perl",
@@ -470,11 +254,12 @@
13
]
],
+ "id" : "013",
"name" : "013"
},
{
- "id" : "014",
"name" : "014",
+ "id" : "014",
"data" : [
[
"Perl",
@@ -491,7 +276,6 @@
]
},
{
- "id" : "015",
"data" : [
[
"Perl",
@@ -506,6 +290,7 @@
15
]
],
+ "id" : "015",
"name" : "015"
},
{
@@ -527,6 +312,7 @@
]
},
{
+ "id" : "017",
"name" : "017",
"data" : [
[
@@ -541,12 +327,11 @@
"Blog",
12
]
- ],
- "id" : "017"
+ ]
},
{
- "id" : "018",
"name" : "018",
+ "id" : "018",
"data" : [
[
"Perl",
@@ -563,7 +348,6 @@
]
},
{
- "id" : "019",
"data" : [
[
"Perl",
@@ -578,10 +362,12 @@
13
]
],
+ "id" : "019",
"name" : "019"
},
{
"name" : "020",
+ "id" : "020",
"data" : [
[
"Perl",
@@ -595,11 +381,11 @@
"Blog",
13
]
- ],
- "id" : "020"
+ ]
},
{
"name" : "021",
+ "id" : "021",
"data" : [
[
"Perl",
@@ -613,8 +399,7 @@
"Blog",
10
]
- ],
- "id" : "021"
+ ]
},
{
"data" : [
@@ -635,6 +420,8 @@
"id" : "022"
},
{
+ "id" : "023",
+ "name" : "023",
"data" : [
[
"Perl",
@@ -648,11 +435,10 @@
"Blog",
12
]
- ],
- "name" : "023",
- "id" : "023"
+ ]
},
{
+ "id" : "024",
"name" : "024",
"data" : [
[
@@ -667,11 +453,9 @@
"Blog",
11
]
- ],
- "id" : "024"
+ ]
},
{
- "name" : "025",
"data" : [
[
"Perl",
@@ -686,10 +470,10 @@
12
]
],
- "id" : "025"
+ "id" : "025",
+ "name" : "025"
},
{
- "id" : "026",
"data" : [
[
"Perl",
@@ -704,9 +488,11 @@
10
]
],
+ "id" : "026",
"name" : "026"
},
{
+ "name" : "027",
"id" : "027",
"data" : [
[
@@ -721,10 +507,11 @@
"Blog",
9
]
- ],
- "name" : "027"
+ ]
},
{
+ "id" : "028",
+ "name" : "028",
"data" : [
[
"Perl",
@@ -738,9 +525,7 @@
"Blog",
9
]
- ],
- "name" : "028",
- "id" : "028"
+ ]
},
{
"data" : [
@@ -757,12 +542,10 @@
12
]
],
- "name" : "029",
- "id" : "029"
+ "id" : "029",
+ "name" : "029"
},
{
- "id" : "030",
- "name" : "030",
"data" : [
[
"Perl",
@@ -776,10 +559,11 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "030",
+ "id" : "030"
},
{
- "name" : "031",
"data" : [
[
"Perl",
@@ -794,9 +578,12 @@
9
]
],
- "id" : "031"
+ "id" : "031",
+ "name" : "031"
},
{
+ "id" : "032",
+ "name" : "032",
"data" : [
[
"Perl",
@@ -810,11 +597,11 @@
"Blog",
10
]
- ],
- "name" : "032",
- "id" : "032"
+ ]
},
{
+ "id" : "033",
+ "name" : "033",
"data" : [
[
"Perl",
@@ -828,9 +615,7 @@
"Blog",
10
]
- ],
- "name" : "033",
- "id" : "033"
+ ]
},
{
"id" : "034",
@@ -851,6 +636,7 @@
]
},
{
+ "name" : "035",
"id" : "035",
"data" : [
[
@@ -865,12 +651,11 @@
"Blog",
9
]
- ],
- "name" : "035"
+ ]
},
{
- "id" : "036",
"name" : "036",
+ "id" : "036",
"data" : [
[
"Perl",
@@ -923,8 +708,8 @@
"id" : "038"
},
{
- "id" : "039",
"name" : "039",
+ "id" : "039",
"data" : [
[
"Perl",
@@ -941,7 +726,6 @@
]
},
{
- "id" : "040",
"data" : [
[
"Perl",
@@ -956,11 +740,10 @@
9
]
],
+ "id" : "040",
"name" : "040"
},
{
- "id" : "041",
- "name" : "041",
"data" : [
[
"Perl",
@@ -974,7 +757,9 @@
"Blog",
6
]
- ]
+ ],
+ "name" : "041",
+ "id" : "041"
},
{
"id" : "042",
@@ -982,23 +767,20 @@
"data" : [
[
"Perl",
- 2
+ 4
],
[
"Raku",
- 2
+ 4
],
[
"Blog",
- 0
+ 1
]
]
}
]
},
- "subtitle" : {
- "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-01-06 15:28:32 GMT"
- },
"plotOptions" : {
"series" : {
"dataLabels" : {
@@ -1008,7 +790,225 @@
"borderWidth" : 0
}
},
- "title" : {
- "text" : "Perl Weekly Challenge Language"
- }
+ "subtitle" : {
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-01-06 16:21:07 GMT"
+ },
+ "series" : [
+ {
+ "data" : [
+ {
+ "name" : "#001",
+ "drilldown" : "001",
+ "y" : 140
+ },
+ {
+ "drilldown" : "002",
+ "name" : "#002",
+ "y" : 109
+ },
+ {
+ "drilldown" : "003",
+ "name" : "#003",
+ "y" : 71
+ },
+