aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMohammad S Anwar <mohammad.anwar@yahoo.com>2020-11-24 19:25:34 +0000
committerMohammad S Anwar <mohammad.anwar@yahoo.com>2020-11-24 19:25:34 +0000
commitaf8fdbc8d7a17f83e67334b0c96111d6552ffb21 (patch)
tree960edc848520aafa5dd37bb36618ed5409bf09f3
parent1ffdb91ce5310fb8145b23f7ffdb6d5ef8600d3f (diff)
downloadperlweeklychallenge-club-af8fdbc8d7a17f83e67334b0c96111d6552ffb21.tar.gz
perlweeklychallenge-club-af8fdbc8d7a17f83e67334b0c96111d6552ffb21.tar.bz2
perlweeklychallenge-club-af8fdbc8d7a17f83e67334b0c96111d6552ffb21.zip
- Added solutions by Pete Houston.
-rw-r--r--challenge-088/pete-houston/perl/ch-1.pl29
-rw-r--r--challenge-088/pete-houston/perl/ch-2.pl72
-rw-r--r--stats/pwc-current.json231
-rw-r--r--stats/pwc-language-breakdown-summary.json50
-rw-r--r--stats/pwc-language-breakdown.json606
-rw-r--r--stats/pwc-leaders.json376
-rw-r--r--stats/pwc-summary-1-30.json122
-rw-r--r--stats/pwc-summary-121-150.json58
-rw-r--r--stats/pwc-summary-151-180.json32
-rw-r--r--stats/pwc-summary-181-210.json92
-rw-r--r--stats/pwc-summary-31-60.json34
-rw-r--r--stats/pwc-summary-61-90.json118
-rw-r--r--stats/pwc-summary-91-120.json94
-rw-r--r--stats/pwc-summary.json44
14 files changed, 1037 insertions, 921 deletions
diff --git a/challenge-088/pete-houston/perl/ch-1.pl b/challenge-088/pete-houston/perl/ch-1.pl
new file mode 100644
index 0000000000..d743d26dde
--- /dev/null
+++ b/challenge-088/pete-houston/perl/ch-1.pl
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+#===============================================================================
+#
+# FILE: 8801.pl
+#
+# USAGE: ./8801.pl N N [ ... ]
+#
+# DESCRIPTION: Output an array of the products of all but the value at
+# that index.
+#
+# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+# ORGANIZATION: Openstrike
+# VERSION: 1.0
+# CREATED: 23/11/20
+#===============================================================================
+
+use strict;
+use warnings;
+use integer;
+
+my @in = grep { $_ > 0 } @ARGV;
+die "Need at least 2 positive integers to proceed.\n" if $#in < 1;
+
+my $prod = 1;
+$prod *= $_ for @in;
+
+my @out;
+push @out, $prod/$_ for @in;
+print "@out\n";
diff --git a/challenge-088/pete-houston/perl/ch-2.pl b/challenge-088/pete-houston/perl/ch-2.pl
new file mode 100644
index 0000000000..5e619d742e
--- /dev/null
+++ b/challenge-088/pete-houston/perl/ch-2.pl
@@ -0,0 +1,72 @@
+#!/usr/bin/env perl
+#===============================================================================
+#
+# FILE: 8802.pl
+#
+# USAGE: ./8802.pl [ filename ]
+#
+# DESCRIPTION: Spiralise matrix
+#
+# NOTES: Reads from STDIN if no filename provided
+# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk
+# ORGANIZATION: Openstrike
+# VERSION: 1.0
+# CREATED: 23/11/20
+#===============================================================================
+
+use strict;
+use warnings;
+
+my $matrix = get_data ($ARGV[0]);
+
+my ($rmin, $cmin, $rmax, $cmax) = (0, 0, $#$matrix, $#{$matrix->[0]});
+my @turns = ([0, 1], [1, 0], [0, -1], [-1, 0]);
+my @out;
+
+# Start at top left, moving right
+my ($r, $c) = ($rmin, $cmin);
+my $move = 0;
+
+while ($rmin <= $rmax && $cmin <= $cmax) {
+ push @out, $matrix->[$r][$c];
+ my ($rnext, $cnext) = ($r + $turns[$move][0], $c + $turns[$move][1]);
+ if ($rnext < $rmin ||
+ $rnext > $rmax ||
+ $cnext < $cmin ||
+ $cnext > $cmax) {
+ # Turn right
+ if ($rnext < $rmin) { $cmin++; }
+ elsif ($rnext > $rmax) { $cmax--; }
+ elsif ($cnext > $cmax) { $rmin++; }
+ else { $rmax--; }
+ $move = ($move + 1) % 4;
+ ($r, $c) = ($r + $turns[$move][0], $c + $turns[$move][1]);
+ } else {
+ ($r, $c) = ($rnext, $cnext);
+ }
+}
+
+print "@out\n";
+
+sub get_data {
+ my $fh = \*STDIN;
+ if (defined $_[0]) {
+ open $fh, '<', $_[0] or die "Cannot open $_[0]: $!";
+ }
+
+ my @input;
+ my $cols = 0;
+ while (my $line = <$fh>) {
+ my @ints = ($line =~ /(\d+)/g);
+ if ($cols > 0) {
+ die "Bad no of items at line $. - should be $cols" unless
+ $cols == $#ints + 1;
+ } elsif ($#ints < 1) {
+ die "Not a rectangle";
+ } else {
+ $cols = $#ints + 1;
+ }
+ push @input, \@ints;
+ }
+ return \@input;
+}
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index db101f2ab0..d232e1a7e8 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,4 +1,82 @@
{
+ "series" : [
+ {
+ "colorByPoint" : 1,
+ "name" : "Perl Weekly Challenge - 088",
+ "data" : [
+ {
+ "drilldown" : "Andrew Shitov",
+ "name" : "Andrew Shitov",
+ "y" : 1
+ },
+ {
+ "name" : "Dave Jacoby",
+ "y" : 2,
+ "drilldown" : "Dave Jacoby"
+ },
+ {
+ "name" : "E. Choroba",
+ "y" : 2,
+ "drilldown" : "E. Choroba"
+ },
+ {
+ "drilldown" : "James Smith",
+ "name" : "James Smith",
+ "y" : 2
+ },
+ {
+ "y" : 2,
+ "name" : "Mark Anderson",
+ "drilldown" : "Mark Anderson"
+ },
+ {
+ "name" : "Niels van Dijke",
+ "y" : 2,
+ "drilldown" : "Niels van Dijke"
+ },
+ {
+ "drilldown" : "PJ Durai",
+ "name" : "PJ Durai",
+ "y" : 2
+ },
+ {
+ "name" : "Pete Houston",
+ "y" : 2,
+ "drilldown" : "Pete Houston"
+ },
+ {
+ "name" : "Philip Hood",
+ "y" : 2,
+ "drilldown" : "Philip Hood"
+ },
+ {
+ "name" : "Roger Bell_West",
+ "y" : 4,
+ "drilldown" : "Roger Bell_West"
+ },
+ {
+ "y" : 3,
+ "name" : "Simon Green",
+ "drilldown" : "Simon Green"
+ },
+ {
+ "y" : 2,
+ "name" : "Simon Proctor",
+ "drilldown" : "Simon Proctor"
+ },
+ {
+ "name" : "Stuart Little",
+ "y" : 2,
+ "drilldown" : "Stuart Little"
+ },
+ {
+ "y" : 3,
+ "name" : "W. Luis Mochan",
+ "drilldown" : "W. Luis Mochan"
+ }
+ ]
+ }
+ ],
"drilldown" : {
"series" : [
{
@@ -12,34 +90,34 @@
"name" : "Andrew Shitov"
},
{
- "id" : "Dave Jacoby",
- "name" : "Dave Jacoby",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "Dave Jacoby",
+ "id" : "Dave Jacoby"
},
{
"id" : "E. Choroba",
- "name" : "E. Choroba",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "E. Choroba"
},
{
- "id" : "James Smith",
"name" : "James Smith",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "id" : "James Smith"
},
{
"name" : "Mark Anderson",
@@ -52,14 +130,14 @@
"id" : "Mark Anderson"
},
{
- "id" : "Niels van Dijke",
+ "name" : "Niels van Dijke",
"data" : [
[
"Perl",
2
]
],
- "name" : "Niels van Dijke"
+ "id" : "Niels van Dijke"
},
{
"id" : "PJ Durai",
@@ -72,16 +150,27 @@
"name" : "PJ Durai"
},
{
- "id" : "Philip Hood",
+ "data" : [
+ [
+ "Perl",
+ 2
+ ]
+ ],
+ "name" : "Pete Houston",
+ "id" : "Pete Houston"
+ },
+ {
+ "name" : "Philip Hood",
"data" : [
[
"Raku",
2
]
],
- "name" : "Philip Hood"
+ "id" : "Philip Hood"
},
{
+ "id" : "Roger Bell_West",
"name" : "Roger Bell_West",
"data" : [
[
@@ -92,8 +181,7 @@
"Raku",
2
]
- ],
- "id" : "Roger Bell_West"
+ ]
},
{
"name" : "Simon Green",
@@ -120,16 +208,17 @@
"name" : "Simon Proctor"
},
{
- "name" : "Stuart Little",
"data" : [
[
"Raku",
2
]
],
+ "name" : "Stuart Little",
"id" : "Stuart Little"
},
{
+ "id" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -140,116 +229,42 @@
1
]
],
- "name" : "W. Luis Mochan",
- "id" : "W. Luis Mochan"
+ "name" : "W. Luis Mochan"
}
]
},
- "legend" : {
- "enabled" : 0
+ "xAxis" : {
+ "type" : "category"
},
- "title" : {
- "text" : "Perl Weekly Challenge - 088"
+ "yAxis" : {
+ "title" : {
+ "text" : "Total Solutions"
+ }
},
"chart" : {
"type" : "column"
},
+ "title" : {
+ "text" : "Perl Weekly Challenge - 088"
+ },
+ "legend" : {
+ "enabled" : 0
+ },
"plotOptions" : {
"series" : {
+ "borderWidth" : 0,
"dataLabels" : {
- "format" : "{point.y}",
- "enabled" : 1
- },
- "borderWidth" : 0
- }
- },
- "yAxis" : {
- "title" : {
- "text" : "Total Solutions"
+ "enabled" : 1,
+ "format" : "{point.y}"
+ }
}
},
"subtitle" : {
- "text" : "[Champions: 13] Last updated at 2020-11-24 09:37:31 GMT"
+ "text" : "[Champions: 14] Last updated at 2020-11-24 19:25:24 GMT"
},
- "series" : [
- {
- "colorByPoint" : 1,
- "data" : [
- {
- "y" : 1,
- "name" : "Andrew Shitov",
- "drilldown" : "Andrew Shitov"
- },
- {
- "drilldown" : "Dave Jacoby",
- "y" : 2,
- "name" : "Dave Jacoby"
- },
- {
- "drilldown" : "E. Choroba",
- "name" : "E. Choroba",
- "y" : 2
- },
- {
- "drilldown" : "James Smith",
- "y" : 2,
- "name" : "James Smith"
- },
- {
- "name" : "Mark Anderson",
- "y" : 2,
- "drilldown" : "Mark Anderson"
- },
- {
- "drilldown" : "Niels van Dijke",
- "name" : "Niels van Dijke",
- "y" : 2
- },
- {
- "drilldown" : "PJ Durai",
- "y" : 2,
- "name" : "PJ Durai"
- },
- {
- "name" : "Philip Hood",
- "y" : 2,
- "drilldown" : "Philip Hood"
- },
- {
- "drilldown" : "Roger Bell_West",
- "y" : 4,
- "name" : "Roger Bell_West"
- },
- {
- "drilldown" : "Simon Green",
- "y" : 3,
- "name" : "Simon Green"
- },
- {
- "drilldown" : "Simon Proctor",
- "name" : "Simon Proctor",
- "y" : 2
- },
- {
- "y" : 2,
- "name" : "Stuart Little",
- "drilldown" : "Stuart Little"
- },
- {
- "y" : 3,
- "name" : "W. Luis Mochan",
- "drilldown" : "W. Luis Mochan"
- }
- ],
- "name" : "Perl Weekly Challenge - 088"
- }
- ],
"tooltip" : {
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
"followPointer" : 1,
- "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/>"
- },
- "xAxis" : {
- "type" : "category"
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>"
}
}
diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json
index acf4a72fd1..646707be4c 100644
--- a/stats/pwc-language-breakdown-summary.json
+++ b/stats/pwc-language-breakdown-summary.json
@@ -1,27 +1,7 @@
{
- "yAxis" : {
- "title" : {
- "text" : null
- },
- "min" : 0
- },
- "subtitle" : {
- "text" : "Last updated at 2020-11-24 09:37:30 GMT"
- },
"series" : [
{
- "dataLabels" : {
- "enabled" : "true",
- "format" : "{point.y:.0f}",
- "align" : "right",
- "y" : 10,
- "style" : {
- "fontFamily" : "Verdana, sans-serif",
- "fontSize" : "13px"
- },
- "color" : "#FFFFFF",
- "rotation" : -90
- },
+ "name" : "Contributions",
"data" : [
[
"Blog",
@@ -29,18 +9,32 @@
],
[
"Perl",
- 3909
+ 3911
],
[
"Raku",
2538
]
],
- "name" : "Contributions"
+ "dataLabels" : {
+ "y" : 10,
+ "align" : "right",
+ "style" : {
+ "fontFamily" : "Verdana, sans-serif",
+ "fontSize" : "13px"
+ },
+ "format" : "{point.y:.0f}",
+ "color" : "#FFFFFF",
+ "rotation" : -90,
+ "enabled" : "true"
+ }
}
],
- "tooltip" : {
- "pointFormat" : "<b>{point.y:.0f}</b>"
+ "yAxis" : {
+ "min" : 0,
+ "title" : {
+ "text" : null
+ }
},
"xAxis" : {
"type" : "category",
@@ -51,6 +45,12 @@
}
}
},
+ "subtitle" : {
+ "text" : "Last updated at 2020-11-24 19:25:24 GMT"
+ },
+ "tooltip" : {
+ "pointFormat" : "<b>{point.y:.0f}</b>"
+ },
"chart" : {
"type" : "column"
},
diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json
index 6a4ea6addf..f4e1f481f2 100644
--- a/stats/pwc-language-breakdown.json
+++ b/stats/pwc-language-breakdown.json
@@ -1,8 +1,33 @@
{
+ "tooltip" : {
+ "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
+ "followPointer" : "true",
+ "headerFormat" : "<span style=\"font-size:11px\"></span>"
+ },
+ "subtitle" : {
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-11-24 19:25:24 GMT"
+ },
+ "title" : {
+ "text" : "Perl Weekly Challenge Language"
+ },
+ "legend" : {
+ "enabled" : "false"
+ },
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "enabled" : 1,
+ "format" : "{point.y}"
+ }
+ }
+ },
+ "chart" : {
+ "type" : "column"
+ },
"drilldown" : {
"series" : [
{
- "id" : "001",
"data" : [
[
"Perl",
@@ -17,11 +42,11 @@
11
]
],
- "name" : "001"
+ "name" : "001",
+ "id" : "001"
},
{
"id" : "002",
- "name" : "002",
"data" : [
[
"Perl",
@@ -35,7 +60,8 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "002"
},
{
"name" : "003",
@@ -56,7 +82,7 @@
"id" : "003"
},
{
- "id" : "004",
+ "name" : "004",
"data" : [
[
"Perl",
@@ -71,7 +97,7 @@
10
]
],
- "name" : "004"
+ "id" : "004"
},
{
"name" : "005",
@@ -92,7 +118,6 @@
"id" : "005"
},
{
- "id" : "006",
"name" : "006",
"data" : [
[
@@ -107,9 +132,12 @@
"Blog",
7
]
- ]
+ ],
+ "id" : "006"
},
{
+ "id" : "007",
+ "name" : "007",
"data" : [
[
"Perl",
@@ -123,12 +151,9 @@
"Blog",
10
]
- ],
- "name" : "007",
- "id" : "007"
+ ]
},
{
- "id" : "008",
"data" : [
[
"Perl",
@@ -143,9 +168,12 @@
12
]
],
- "name" : "008"
+ "name" : "008",
+ "id" : "008"
},
{
+ "id" : "009",
+ "name" : "009",
"data" : [
[
"Perl",
@@ -159,9 +187,7 @@
"Blog",
13
]
- ],
- "name" : "009",
- "id" : "009"
+ ]
},
{
"id" : "010",
@@ -182,6 +208,7 @@
]
},
{
+ "id" : "011",
"data" : [
[
"Perl",
@@ -196,11 +223,11 @@
10
]
],
- "name" : "011",
- "id" : "011"
+ "name" : "011"
},
{
"id" : "012",
+ "name" : "012",
"data" : [
[
"Perl",
@@ -214,11 +241,10 @@
"Blog",
11
]
- ],
- "name" : "012"
+ ]
},
{
- "name" : "013",
+ "id" : "013",
"data" : [
[
"Perl",
@@ -233,10 +259,10 @@
13
]
],
- "id" : "013"
+ "name" : "013"
},
{
- "name" : "014",
+ "id" : "014",
"data" : [
[
"Perl",
@@ -251,10 +277,10 @@
15
]
],
- "id" : "014"
+ "name" : "014"
},
{
- "id" : "015",
+ "name" : "015",
"data" : [
[
"Perl",
@@ -269,10 +295,9 @@
15
]
],
- "name" : "015"
+ "id" : "015"
},
{
- "id" : "016",
"name" : "016",
"data" : [
[
@@ -287,11 +312,10 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "016"
},
{
- "id" : "017",
- "name" : "017",
"data" : [
[
"Perl",
@@ -305,10 +329,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "017",
+ "id" : "017"
},
{
- "name" : "018",
"data" : [
[
"Perl",
@@ -323,10 +348,11 @@
14
]
],
+ "name" : "018",
"id" : "018"
},
{
- "id" : "019",
+ "name" : "019",
"data" : [
[
"Perl",
@@ -341,9 +367,11 @@
13
]
],
- "name" : "019"
+ "id" : "019"
},
{
+ "id" : "020",
+ "name" : "020",
"data" : [
[
"Perl",
@@ -357,12 +385,10 @@
"Blog",
13
]
- ],
- "name" : "020",
- "id" : "020"
+ ]
},
{
- "name" : "021",
+ "id" : "021",
"data" : [
[
"Perl",
@@ -377,7 +403,7 @@
10
]
],
- "id" : "021"
+ "name" : "021"
},
{
"id" : "022",
@@ -398,7 +424,6 @@
"name" : "022"
},
{
- "name" : "023",
"data" : [
[
"Perl",
@@ -413,10 +438,10 @@
12
]
],
+ "name" : "023",
"id" : "023"
},
{
- "id" : "024",
"data" : [
[
"Perl",
@@ -431,11 +456,11 @@
11
]
],
- "name" : "024"
+ "name" : "024",
+ "id" : "024"
},
{
"id" : "025",
- "name" : "025",
"data" : [
[
"Perl",
@@ -449,11 +474,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "025"
},
{
"id" : "026",
- "name" : "026",
"data" : [
[
"Perl",
@@ -467,9 +492,11 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "026"
},
{
+ "name" : "027",
"data" : [
[
"Perl",
@@ -484,11 +511,9 @@
9
]
],
- "name" : "027",
"id" : "027"
},
{
- "id" : "028",
"name" : "028",
"data" : [
[
@@ -503,9 +528,11 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "028"
},
{
+ "id" : "029",
"data" : [
[
"Perl",
@@ -520,8 +547,7 @@
12
]
],
- "name" : "029",
- "id" : "029"
+ "name" : "029"
},
{
"data" : [
@@ -560,8 +586,6 @@
]
},
{
- "id" : "032",
- "name" : "032",
"data" : [
[
"Perl",
@@ -575,7 +599,9 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "032",
+ "id" : "032"
},
{
"id" : "033",
@@ -614,6 +640,7 @@
"id" : "034"
},
{
+ "id" : "035",
"name" : "035",
"data" : [
[
@@ -628,11 +655,11 @@
"Blog",
9
]
- ],
- "id" : "035"
+ ]
},
{
"id" : "036",
+ "name" : "036",
"data" : [
[
"Perl",
@@ -646,11 +673,9 @@
"Blog",
11
]
- ],
- "name" : "036"
+ ]
},
{
- "name" : "037",
"data" : [
[
"Perl",
@@ -665,9 +690,11 @@
9
]
],
+ "name" : "037",
"id" : "037"
},
{
+ "id" : "038",
"name" : "038",
"data" : [
[
@@ -682,11 +709,9 @@
"Blog",
12
]
- ],
- "id" : "038"
+ ]
},
{
- "id" : "039",
"data" : [
[
"Perl",
@@ -701,10 +726,10 @@
12
]
],
- "name" : "039"
+ "name" : "039",
+ "id" : "039"
},
{
- "id" : "040",
"data" : [
[
"Perl",
@@ -719,7 +744,8 @@
10
]
],
- "name" : "040"
+ "name" : "040",
+ "id" : "040"
},
{
"id" : "041",
@@ -740,7 +766,7 @@
"name" : "041"
},
{
- "id" : "042",
+ "name" : "042",
"data" : [
[
"Perl",
@@ -755,9 +781,10 @@
11
]
],
- "name" : "042"
+ "id" : "042"
},
{
+ "name" : "043",
"data" : [
[
"Perl",
@@ -772,10 +799,10 @@
11
]
],
- "name" : "043",
"id" : "043"
},
{
+ "name" : "044",
"data" : [
[
"Perl",
@@ -790,10 +817,11 @@
11
]
],
- "name" : "044",
"id" : "044"
},
{
+ "id" : "045",
+ "name" : "045",
"data" : [
[
"Perl",
@@ -807,9 +835,7 @@
"Blog",
11
]
- ],
- "name" : "045",
- "id" : "045"
+ ]
},
{
"name" : "046",
@@ -830,7 +856,7 @@
"id" : "046"
},
{
- "name" : "047",
+ "id" : "047",
"data" : [
[
"Perl",
@@ -845,9 +871,11 @@
10
]
],
- "id" : "047"
+ "name" : "047"
},
{
+ "id" : "048",
+ "name" : "048",
"data" : [
[
"Perl",
@@ -861,13 +889,10 @@
"Blog",
12
]
- ],
- "name" : "048",
- "id" : "048"
+ ]
},
{
"id" : "049",
- "name" : "049",
"data" : [
[
"Perl",
@@ -881,9 +906,11 @@
"Blog",
12
]
- ]
+ ],
+ "name" : "049"
},
{
+ "name" : "050",
"data" : [
[
"Perl",