From 9ef80fe27bef5398ea7242ae90f02e112f52f4fa Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Wed, 10 Apr 2019 17:26:20 +0100 Subject: - Added member Francis Whittle. --- members.json | 1 + 1 file changed, 1 insertion(+) diff --git a/members.json b/members.json index 715990fb11..4a9d573fcf 100644 --- a/members.json +++ b/members.json @@ -22,6 +22,7 @@ "duncan-c-white" : "Duncan C. White", "eddy-hs" : "Eddy HS", "finley" : "Finley", + "fjwhittle" : "Francis Whittle", "fred-zinn" : "Fred Zinn", "freddie-b" : "Freddie B", "gustavo-chaves" : "Gustavo Chaves", -- cgit From 481aefbea598626938020fae30ee74ad91339bda Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Wed, 10 Apr 2019 17:27:47 +0100 Subject: - Updated chart stats. --- stats/pwc-current.json | 135 ++++++++++++++++++++++++------------------- stats/pwc-summary-1-30.json | 118 ++++++++++++++++++------------------- stats/pwc-summary-31-60.json | 118 ++++++++++++++++++------------------- stats/pwc-summary-61-90.json | 71 ++++++++++++----------- stats/pwc-summary.json | 43 +++++++------- 5 files changed, 253 insertions(+), 232 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 9501dd4f7f..d4f86bb296 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,88 +1,84 @@ { + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } + }, "series" : [ { - "colorByPoint" : 1, - "name" : "Champions", "data" : [ { - "name" : "Clive Holloway", "y" : 1, - "drilldown" : "Clive Holloway" + "drilldown" : "Clive Holloway", + "name" : "Clive Holloway" }, { + "name" : "Francis Whittle", + "drilldown" : "Francis Whittle", + "y" : 2 + }, + { + "y" : 1, "drilldown" : "Gustavo Chaves", - "name" : "Gustavo Chaves", - "y" : 1 + "name" : "Gustavo Chaves" }, { - "drilldown" : "Dr James A. Smith", + "name" : "Dr James A. Smith", "y" : 4, - "name" : "Dr James A. Smith" + "drilldown" : "Dr James A. Smith" }, { - "name" : "Khalid", "y" : 2, - "drilldown" : "Khalid" + "drilldown" : "Khalid", + "name" : "Khalid" }, { - "drilldown" : "Lars Balker", "y" : 2, + "drilldown" : "Lars Balker", "name" : "Lars Balker" }, { "name" : "Chenyf", - "y" : 2, - "drilldown" : "Chenyf" + "drilldown" : "Chenyf", + "y" : 2 }, { + "drilldown" : "Robert Gratza", "y" : 2, - "name" : "Robert Gratza", - "drilldown" : "Robert Gratza" + "name" : "Robert Gratza" }, { "y" : 2, - "name" : "Sergio Iglesias", - "drilldown" : "Sergio Iglesias" + "drilldown" : "Sergio Iglesias", + "name" : "Sergio Iglesias" }, { "drilldown" : "Simon Proctor", - "name" : "Simon Proctor", - "y" : 2 + "y" : 2, + "name" : "Simon Proctor" } - ] + ], + "name" : "Champions", + "colorByPoint" : 1 } ], - "xAxis" : { - "type" : "category" - }, - "legend" : { - "enabled" : 0 + "subtitle" : { + "text" : "[Champions: 10] Last updated at 2019-04-10 16:27:08 GMT" }, - "chart" : { - "type" : "column" + "tooltip" : { + "pointerFormat" : "{point.name}: {point.y:f}
", + "followPointer" : 1, + "headerFormat" : "{series.name}
" }, "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "subtitle" : { - "text" : "[Champions: 9] Last updated at 2019-04-10 12:10:46 GMT" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "followPointer" : 1, - "pointerFormat" : "{point.name}: {point.y:f}
" - }, "drilldown" : { "series" : [ { @@ -96,16 +92,28 @@ "name" : "Clive Holloway" }, { + "name" : "Francis Whittle", + "data" : [ + [ + "Perl 6", + 2 + ] + ], + "id" : "Francis Whittle" + }, + { + "id" : "Gustavo Chaves", "data" : [ [ "Perl 5", 1 ] ], - "name" : "Gustavo Chaves", - "id" : "Gustavo Chaves" + "name" : "Gustavo Chaves" }, { + "name" : "Dr James A. Smith", + "id" : "Dr James A. Smith", "data" : [ [ "Perl 5", @@ -115,9 +123,7 @@ "Perl 6", 2 ] - ], - "name" : "Dr James A. Smith", - "id" : "Dr James A. Smith" + ] }, { "data" : [ @@ -126,8 +132,8 @@ 2 ] ], - "name" : "Khalid", - "id" : "Khalid" + "id" : "Khalid", + "name" : "Khalid" }, { "name" : "Lars Balker", @@ -140,48 +146,57 @@ "id" : "Lars Balker" }, { - "name" : "Chenyf", "data" : [ [ "Perl 6", 2 ] ], - "id" : "Chenyf" + "id" : "Chenyf", + "name" : "Chenyf" }, { - "name" : "Robert Gratza", "data" : [ [ "Perl 6", 2 ] ], - "id" : "Robert Gratza" + "id" : "Robert Gratza", + "name" : "Robert Gratza" }, { - "name" : "Sergio Iglesias", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Sergio Iglesias" + "id" : "Sergio Iglesias", + "name" : "Sergio Iglesias" }, { + "name" : "Simon Proctor", + "id" : "Simon Proctor", "data" : [ [ "Perl 6", 2 ] - ], - "name" : "Simon Proctor", - "id" : "Simon Proctor" + ] } ] }, + "chart" : { + "type" : "column" + }, "title" : { "text" : "Perl Weekly Challenge - CURRENT" + }, + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : 0 } } diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json index 2aa7b9165b..33f33238da 100644 --- a/stats/pwc-summary-1-30.json +++ b/stats/pwc-summary-1-30.json @@ -1,6 +1,57 @@ { + "chart" : { + "type" : "column" + }, + "xAxis" : { + "categories" : [ + "Abigail", + "Adam Russell", + "Ailbhe Tweedie", + "Alex Daniel", + "Alexander Karelas", + "Alexey Melezhik", + "Andrezgz", + "Antonio Gamiz", + "Arne Sommer", + "Arpad Toth", + "Athanasius", + "Aubrey Quarcoo", + "Bill Palmer", + "Bob Kleemann", + "Clive Holloway", + "Daniel Mantovani", + "Dave Cross", + "Dave Jacoby", + "David Kayal", + "Doug Schrag", + "Duncan C. White", + "Eddy HS", + "Finley", + "Francis Whittle", + "Fred Zinn", + "Freddie B", + "Gustavo Chaves", + "Jacques Guinnebault", + "Jaime Corchado", + "Jaldhar H. Vyas" + ] + }, + "title" : { + "text" : "Perl Weekly Challenge - 2019" + }, + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" + }, + "yAxis" : { + "title" : { + "text" : "" + }, + "min" : 0 + }, "series" : [ { + "name" : "Perl 5", "data" : [ 0, 4, @@ -25,18 +76,16 @@ 2, 2, 0, + 0, 2, 3, 3, 0, 2, - 4, - 6 - ], - "name" : "Perl 5" + 4 + ] }, { - "name" : "Perl 6", "data" : [ 0, 0, @@ -61,72 +110,23 @@ 0, 0, 2, + 2, 0, 0, 0, 0, 0, - 4, - 6 - ] + 4 + ], + "name" : "Perl 6" } ], - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" - }, "subtitle" : { - "text" : "[Champions: 30] Last updated at 2019-04-10 12:11:35 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge - 2019" - }, - "chart" : { - "type" : "column" + "text" : "[Champions: 30] Last updated at 2019-04-10 16:27:27 GMT" }, "plotOptions" : { "column" : { "stacking" : "percent" } - }, - "xAxis" : { - "categories" : [ - "Abigail", - "Adam Russell", - "Ailbhe Tweedie", - "Alex Daniel", - "Alexander Karelas", - "Alexey Melezhik", - "Andrezgz", - "Antonio Gamiz", - "Arne Sommer", - "Arpad Toth", - "Athanasius", - "Aubrey Quarcoo", - "Bill Palmer", - "Bob Kleemann", - "Clive Holloway", - "Daniel Mantovani", - "Dave Cross", - "Dave Jacoby", - "David Kayal", - "Doug Schrag", - "Duncan C. White", - "Eddy HS", - "Finley", - "Fred Zinn", - "Freddie B", - "Gustavo Chaves", - "Jacques Guinnebault", - "Jaime Corchado", - "Jaldhar H. Vyas", - "Dr James A. Smith" - ] - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : "" - } } } diff --git a/stats/pwc-summary-31-60.json b/stats/pwc-summary-31-60.json index 184ab6cdd0..8017f3a57d 100644 --- a/stats/pwc-summary-31-60.json +++ b/stats/pwc-summary-31-60.json @@ -1,61 +1,12 @@ { - "xAxis" : { - "categories" : [ - "Jeff", - "Jeremy Carman", - "Jim Bacon", - "JJ Merelo", - "Jo Christian Oterhals", - "Joelle Maslak", - "John Barrett", - "Juan Caballero", - "Khalid", - "Kian-Meng Ang", - "Kivanc Yazan", - "Lars Balker", - "Laurent Rosenfeld", - "Magnus Woldrich", - "Mark Senn", - "Martin Mugeni", - "Matt Latusek", - "Maxim Kolodyazhny", - "Michael Schaap", - "Neil Bowers", - "Nick Logan", - "Chenyf", - "Oleskii Tsvitenov", - "Ozzy", - "Pavel Jurca", - "Pete Houston", - "Philippe Bruhat", - "Prajith P", - "Robert Gratza", - "Ruben Westerberg" - ] - }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : "" - } - }, - "plotOptions" : { - "column" : { - "stacking" : "percent" - } - }, - "subtitle" : { - "text" : "[Champions: 30] Last updated at 2019-04-10 12:11:35 GMT" - }, - "title" : { - "text" : "Perl Weekly Challenge - 2019" - }, "chart" : { "type" : "column" }, "series" : [ { + "name" : "Perl 5", "data" : [ + 6, 2, 2, 1, @@ -84,13 +35,13 @@ 3, 4, 2, - 2, 2 - ], - "name" : "Perl 5" + ] }, { + "name" : "Perl 6", "data" : [ + 6, 0, 1, 0, @@ -119,14 +70,63 @@ 0, 0, 0, - 2, 2 - ], - "name" : "Perl 6" + ] } ], + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2019-04-10 16:27:27 GMT" + }, + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, + "xAxis" : { + "categories" : [ + "Dr James A. Smith", + "Jeff", + "Jeremy Carman", + "Jim Bacon", + "JJ Merelo", + "Jo Christian Oterhals", + "Joelle Maslak", + "John Barrett", + "Juan Caballero", + "Khalid", + "Kian-Meng Ang", + "Kivanc Yazan", + "Lars Balker", + "Laurent Rosenfeld", + "Magnus Woldrich", + "Mark Senn", + "Martin Mugeni", + "Matt Latusek", + "Maxim Kolodyazhny", + "Michael Schaap", + "Neil Bowers", + "Nick Logan", + "Chenyf", + "Oleskii Tsvitenov", + "Ozzy", + "Pavel Jurca", + "Pete Houston", + "Philippe Bruhat", + "Prajith P", + "Robert Gratza" + ] + }, + "title" : { + "text" : "Perl Weekly Challenge - 2019" + }, "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" + "pointFormat" : "{series.name}: {point.y}
", + "shared" : 1 + }, + "yAxis" : { + "min" : 0, + "title" : { + "text" : "" + } } } diff --git a/stats/pwc-summary-61-90.json b/stats/pwc-summary-61-90.json index 4436cb2847..e02d315b05 100644 --- a/stats/pwc-summary-61-90.json +++ b/stats/pwc-summary-61-90.json @@ -1,37 +1,12 @@ { - "plotOptions" : { - "column" : { - "stacking" : "percent" - } - }, - "xAxis" : { - "categories" : [ - "Sean Meininger", - "Sergio Iglesias", - "Simon Proctor", - "Simon Reinhardt", - "Steve Rogerson", - "Steven Lembark", - "Steven Wilson", - "Tiago Stock", - "Tore Andersson", - "Veesh Goldman", - "William Gilmore" - ] - }, - "yAxis" : { - "title" : { - "text" : "" - }, - "min" : 0 - }, - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" + "chart" : { + "type" : "column" }, "series" : [ { + "name" : "Perl 5", "data" : [ + 2, 0, 4, 4, @@ -43,11 +18,11 @@ 2, 3, 1 - ], - "name" : "Perl 5" + ] }, { "data" : [ + 2, 3, 0, 6, @@ -63,13 +38,41 @@ "name" : "Perl 6" } ], + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, "subtitle" : { - "text" : "[Champions: 11] Last updated at 2019-04-10 12:11:35 GMT" + "text" : "[Champions: 12] Last updated at 2019-04-10 16:27:27 GMT" + }, + "xAxis" : { + "categories" : [ + "Ruben Westerberg", + "Sean Meininger", + "Sergio Iglesias", + "Simon Proctor", + "Simon Reinhardt", + "Steve Rogerson", + "Steven Lembark", + "Steven Wilson", + "Tiago Stock", + "Tore Andersson", + "Veesh Goldman", + "William Gilmore" + ] }, "title" : { "text" : "Perl Weekly Challenge - 2019" }, - "chart" : { - "type" : "column" + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" + }, + "yAxis" : { + "title" : { + "text" : "" + }, + "min" : 0 } } diff --git a/stats/pwc-summary.json b/stats/pwc-summary.json index a523502438..50fe22ab2c 100644 --- a/stats/pwc-summary.json +++ b/stats/pwc-summary.json @@ -25,6 +25,7 @@ 2, 2, 0, + 0, 2, 3, 3, @@ -77,7 +78,6 @@ "name" : "Perl 5" }, { - "name" : "Perl 6", "data" : [ 0, 0, @@ -102,6 +102,7 @@ 0, 0, 2, + 2, 0, 0, 0, @@ -150,9 +151,22 @@ 0, 0, 0 - ] + ], + "name" : "Perl 6" } ], + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" + }, + "subtitle" : { + "text" : "[Champions: 72] Last updated at 2019-04-10 16:27:08 GMT" + }, + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, "xAxis" : { "categories" : [ "Abigail", @@ -178,6 +192,7 @@ "Duncan C. White", "Eddy HS", "Finley", + "Francis Whittle", "Fred Zinn", "Freddie B", "Gustavo Chaves", @@ -228,28 +243,16 @@ "William Gilmore" ] }, - "yAxis" : { - "min" : 0, - "title" : { - "text" : "" - } - }, - "subtitle" : { - "text" : "[Champions: 71] Last updated at 2019-04-10 12:10:46 GMT" + "title" : { + "text" : "Perl Weekly Challenge - 2019" }, "chart" : { "type" : "column" }, - "tooltip" : { - "pointFormat" : "{series.name}: {point.y}
", - "shared" : 1 - }, - "plotOptions" : { - "column" : { - "stacking" : "percent" + "yAxis" : { + "min" : 0, + "title" : { + "text" : "" } - }, - "title" : { - "text" : "Perl Weekly Challenge - 2019" } } -- cgit From 08421ab29ca411cc43513682868aebb4dde67fc4 Mon Sep 17 00:00:00 2001 From: Nick Logan Date: Wed, 10 Apr 2019 23:12:19 -0400 Subject: Add week 3 polyglot solutions --- challenge-003/nick-logan/perl5/ch-1.pl | 29 +++++++++++++++++++++++++++++ challenge-003/nick-logan/perl5/ch-2.pl | 13 +++++++++++++ challenge-003/nick-logan/perl6/ch-1.p6 | 29 +++++++++++++++++++++++++++++ challenge-003/nick-logan/perl6/ch-2.p6 | 13 +++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 challenge-003/nick-logan/perl5/ch-1.pl create mode 100644 challenge-003/nick-logan/perl5/ch-2.pl create mode 100644 challenge-003/nick-logan/perl6/ch-1.p6 create mode 100644 challenge-003/nick-logan/perl6/ch-2.p6 diff --git a/challenge-003/nick-logan/perl5/ch-1.pl b/challenge-003/nick-logan/perl5/ch-1.pl new file mode 100644 index 0000000000..b76f7d6d92 --- /dev/null +++ b/challenge-003/nick-logan/perl5/ch-1.pl @@ -0,0 +1,29 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + +my @ARGV = do { sub eval { &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; + +my $numbers_tried = 0; +my $numbers_found = 0; + +NUMBERS: while ($numbers_found != @ARGV[0]) { + + $numbers_tried++; + my $state = $numbers_tried; + while ($state != 1) { + if ($state % 2 == 0) { + $state /= 2; + } + elsif ($state % 3 == 0) { + $state /= 3; + } + elsif ($state % 5 == 0) { + $state /= 5; + } + else { + next NUMBERS; + } + } + $numbers_found++; + + print("$numbers_tried\n"); +} diff --git a/challenge-003/nick-logan/perl5/ch-2.pl b/challenge-003/nick-logan/perl5/ch-2.pl new file mode 100644 index 0000000000..10bcd74535 --- /dev/null +++ b/challenge-003/nick-logan/perl5/ch-2.pl @@ -0,0 +1,13 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + +my @ARGV = do { sub eval { &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; + +my @state = (1,); +for (1 .. @ARGV[0]) { + print(join(" ", @state), "\n"); + my @row = map &{ sub ($_) { @state[$_] + (@state[$_ + 1] // 0) } }.(), (0 .. ($_ - 2)); + @state = (); + push(@state, 1); + push(@state, $_) for @row; + push(@state, 1); +} diff --git a/challenge-003/nick-logan/perl6/ch-1.p6 b/challenge-003/nick-logan/perl6/ch-1.p6 new file mode 100644 index 0000000000..b76f7d6d92 --- /dev/null +++ b/challenge-003/nick-logan/perl6/ch-1.p6 @@ -0,0 +1,29 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + +my @ARGV = do { sub eval { &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; + +my $numbers_tried = 0; +my $numbers_found = 0; + +NUMBERS: while ($numbers_found != @ARGV[0]) { + + $numbers_tried++; + my $state = $numbers_tried; + while ($state != 1) { + if ($state % 2 == 0) { + $state /= 2; + } + elsif ($state % 3 == 0) { + $state /= 3; + } + elsif ($state % 5 == 0) { + $state /= 5; + } + else { + next NUMBERS; + } + } + $numbers_found++; + + print("$numbers_tried\n"); +} diff --git a/challenge-003/nick-logan/perl6/ch-2.p6 b/challenge-003/nick-logan/perl6/ch-2.p6 new file mode 100644 index 0000000000..10bcd74535 --- /dev/null +++ b/challenge-003/nick-logan/perl6/ch-2.p6 @@ -0,0 +1,13 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + +my @ARGV = do { sub eval { &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; + +my @state = (1,); +for (1 .. @ARGV[0]) { + print(join(" ", @state), "\n"); + my @row = map &{ sub ($_) { @state[$_] + (@state[$_ + 1] // 0) } }.(), (0 .. ($_ - 2)); + @state = (); + push(@state, 1); + push(@state, $_) for @row; + push(@state, 1); +} -- cgit From ec34b1f4e29bb6ece971838525231cd81b92cad3 Mon Sep 17 00:00:00 2001 From: Nick Logan Date: Wed, 10 Apr 2019 23:16:27 -0400 Subject: Add note explaining lack of best practices --- challenge-001/nick-logan/perl5/ch-1.pl | 2 ++ challenge-001/nick-logan/perl5/ch-2.pl | 4 ++-- challenge-001/nick-logan/perl6/ch-1.p6 | 2 ++ challenge-001/nick-logan/perl6/ch-2.p6 | 4 ++-- challenge-002/nick-logan/perl5/ch-1.pl | 2 ++ challenge-002/nick-logan/perl5/ch-2.pl | 2 ++ challenge-002/nick-logan/perl6/ch-1.p6 | 2 ++ challenge-002/nick-logan/perl6/ch-2.p6 | 2 ++ challenge-002/nick-logan/perl6/to-base35.p6 | 6 ++++-- 9 files changed, 20 insertions(+), 6 deletions(-) diff --git a/challenge-001/nick-logan/perl5/ch-1.pl b/challenge-001/nick-logan/perl5/ch-1.pl index c35822d44b..e20ce33987 100644 --- a/challenge-001/nick-logan/perl5/ch-1.pl +++ b/challenge-001/nick-logan/perl5/ch-1.pl @@ -1 +1,3 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + print((($_ eq "e") and uc($_) or $_)) for split("", "Perl Weekly Challenge") diff --git a/challenge-001/nick-logan/perl5/ch-2.pl b/challenge-001/nick-logan/perl5/ch-2.pl index cb8a9074af..00372d5c38 100644 --- a/challenge-001/nick-logan/perl5/ch-2.pl +++ b/challenge-001/nick-logan/perl5/ch-2.pl @@ -1,3 +1,3 @@ -print((join( "", (!($_ % 3) and "Fizz" or ""), (!($_ % 5) and "Buzz" or "") ) or $_), "\n") for 1..20; - +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both +print((join( "", (!($_ % 3) and "Fizz" or ""), (!($_ % 5) and "Buzz" or "") ) or $_), "\n") for 1..20; diff --git a/challenge-001/nick-logan/perl6/ch-1.p6 b/challenge-001/nick-logan/perl6/ch-1.p6 index c35822d44b..e20ce33987 100644 --- a/challenge-001/nick-logan/perl6/ch-1.p6 +++ b/challenge-001/nick-logan/perl6/ch-1.p6 @@ -1 +1,3 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + print((($_ eq "e") and uc($_) or $_)) for split("", "Perl Weekly Challenge") diff --git a/challenge-001/nick-logan/perl6/ch-2.p6 b/challenge-001/nick-logan/perl6/ch-2.p6 index cb8a9074af..00372d5c38 100644 --- a/challenge-001/nick-logan/perl6/ch-2.p6 +++ b/challenge-001/nick-logan/perl6/ch-2.p6 @@ -1,3 +1,3 @@ -print((join( "", (!($_ % 3) and "Fizz" or ""), (!($_ % 5) and "Buzz" or "") ) or $_), "\n") for 1..20; - +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both +print((join( "", (!($_ % 3) and "Fizz" or ""), (!($_ % 5) and "Buzz" or "") ) or $_), "\n") for 1..20; diff --git a/challenge-002/nick-logan/perl5/ch-1.pl b/challenge-002/nick-logan/perl5/ch-1.pl index f7787b8a04..ffbf7bc003 100644 --- a/challenge-002/nick-logan/perl5/ch-1.pl +++ b/challenge-002/nick-logan/perl5/ch-1.pl @@ -1 +1,3 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + my @ARGV = do { sub eval($_) { &EVAL($_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; print("$_\n") for map &{ sub ($_) { /^0(0|1|2|3|4|5|6|7|8|9)+/ and (0+$_) or $_ } }.(), @ARGV; diff --git a/challenge-002/nick-logan/perl5/ch-2.pl b/challenge-002/nick-logan/perl5/ch-2.pl index f6d6226cda..95628189ed 100644 --- a/challenge-002/nick-logan/perl5/ch-2.pl +++ b/challenge-002/nick-logan/perl5/ch-2.pl @@ -1,3 +1,5 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + my @ARGV = do { sub eval { chomp &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; my ($state, $result, $dict, $base35) = (1, "", {}, @ARGV[0]); $dict{$_} = $_ for "1".."9"; diff --git a/challenge-002/nick-logan/perl6/ch-1.p6 b/challenge-002/nick-logan/perl6/ch-1.p6 index f7787b8a04..ffbf7bc003 100644 --- a/challenge-002/nick-logan/perl6/ch-1.p6 +++ b/challenge-002/nick-logan/perl6/ch-1.p6 @@ -1 +1,3 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + my @ARGV = do { sub eval($_) { &EVAL($_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; print("$_\n") for map &{ sub ($_) { /^0(0|1|2|3|4|5|6|7|8|9)+/ and (0+$_) or $_ } }.(), @ARGV; diff --git a/challenge-002/nick-logan/perl6/ch-2.p6 b/challenge-002/nick-logan/perl6/ch-2.p6 index f6d6226cda..95628189ed 100644 --- a/challenge-002/nick-logan/perl6/ch-2.p6 +++ b/challenge-002/nick-logan/perl6/ch-2.p6 @@ -1,3 +1,5 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + my @ARGV = do { sub eval { chomp &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; my ($state, $result, $dict, $base35) = (1, "", {}, @ARGV[0]); $dict{$_} = $_ for "1".."9"; diff --git a/challenge-002/nick-logan/perl6/to-base35.p6 b/challenge-002/nick-logan/perl6/to-base35.p6 index 683acda914..e4f7e98a95 100644 --- a/challenge-002/nick-logan/perl6/to-base35.p6 +++ b/challenge-002/nick-logan/perl6/to-base35.p6 @@ -1,3 +1,5 @@ +# WARNING: this polyglot breaks best practices of both Perl 5 and Perl 6 in order to run on both + # bin/to-base35 sub to_int($_) { my @i = split(/"."/, $_[0]); @i[0] }; my @ARGV = do { sub eval { chomp &EVAL(@_) }; eval( ("0" and q|@*ARGS| or q|@ARGV|) ) }; @@ -5,7 +7,7 @@ my ($result, $dict, $base10) = ("", {}, @ARGV[0]); $dict{$_} = $_ for "1".."9"; $dict{ord($_) - 55} = $_ for "A".."Y"; while ($base10 > 0) { - $result = join("", $dict{to_int($base10 % 35)}, $result); - $base10 = to_int($base10 / 35); + $result = join("", $dict{to_int($base10 % 35)}, $result); + $base10 = to_int($base10 / 35); } print("$result\n"); -- cgit From 387c67e9aee8e4404ea00513e32dc4e57706e9f0 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Thu, 11 Apr 2019 11:07:57 +0100 Subject: - Updated chart stats. --- stats/pwc-current.json | 129 +++++++++++++++++++++++++------------------ stats/pwc-summary-1-30.json | 86 ++++++++++++++--------------- stats/pwc-summary-31-60.json | 98 ++++++++++++++++---------------- stats/pwc-summary-61-90.json | 26 ++++----- stats/pwc-summary.json | 44 +++++++-------- 5 files changed, 201 insertions(+), 182 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index d4f86bb296..ace9fbb43f 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,20 +1,26 @@ { - "plotOptions" : { - "series" : { - "dataLabels" : { - "enabled" : 1, - "format" : "{point.y}" - }, - "borderWidth" : 0 + "legend" : { + "enabled" : 0 + }, + "xAxis" : { + "type" : "category" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" } }, + "title" : { + "text" : "Perl Weekly Challenge - CURRENT" + }, "series" : [ { + "name" : "Champions", "data" : [ { "y" : 1, - "drilldown" : "Clive Holloway", - "name" : "Clive Holloway" + "name" : "Clive Holloway", + "drilldown" : "Clive Holloway" }, { "name" : "Francis Whittle", @@ -23,61 +29,63 @@ }, { "y" : 1, - "drilldown" : "Gustavo Chaves", - "name" : "Gustavo Chaves" + "name" : "Gustavo Chaves", + "drilldown" : "Gustavo Chaves" }, { + "drilldown" : "Dr James A. Smith", "name" : "Dr James A. Smith", - "y" : 4, - "drilldown" : "Dr James A. Smith" + "y" : 4 }, { - "y" : 2, "drilldown" : "Khalid", - "name" : "Khalid" + "name" : "Khalid", + "y" : 2 }, { - "y" : 2, + "name" : "Lars Balker", "drilldown" : "Lars Balker", - "name" : "Lars Balker" + "y" : 2 + }, + { + "y" : 4, + "name" : "Nick Logan", + "drilldown" : "Nick Logan" }, { + "y" : 2, "name" : "Chenyf", - "drilldown" : "Chenyf", - "y" : 2 + "drilldown" : "Chenyf" }, { + "name" : "Robert Gratza", "drilldown" : "Robert Gratza", - "y" : 2, - "name" : "Robert Gratza" + "y" : 2 }, { - "y" : 2, + "name" : "Sergio Iglesias", "drilldown" : "Sergio Iglesias", - "name" : "Sergio Iglesias" + "y" : 2 }, { "drilldown" : "Simon Proctor", - "y" : 2, - "name" : "Simon Proctor" + "name" : "Simon Proctor", + "y" : 2 } ], - "name" : "Champions", "colorByPoint" : 1 } ], + "chart" : { + "type" : "column" + }, "subtitle" : { - "text" : "[Champions: 10] Last updated at 2019-04-10 16:27:08 GMT" + "text" : "[Champions: 11] Last updated at 2019-04-11 10:07:18 GMT" }, "tooltip" : { - "pointerFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", "followPointer" : 1, - "headerFormat" : "{series.name}
" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "pointerFormat" : "{point.name}: {point.y:f}
" }, "drilldown" : { "series" : [ @@ -93,22 +101,22 @@ }, { "name" : "Francis Whittle", + "id" : "Francis Whittle", "data" : [ [ "Perl 6", 2 ] - ], - "id" : "Francis Whittle" + ] }, { - "id" : "Gustavo Chaves", "data" : [ [ "Perl 5", 1 ] ], + "id" : "Gustavo Chaves", "name" : "Gustavo Chaves" }, { @@ -126,33 +134,47 @@ ] }, { + "id" : "Khalid", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Khalid", "name" : "Khalid" }, { - "name" : "Lars Balker", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Lars Balker" + "id" : "Lars Balker", + "name" : "Lars Balker" }, { + "name" : "Nick Logan", + "id" : "Nick Logan", "data" : [ + [ + "Perl 5", + 2 + ], [ "Perl 6", 2 ] - ], + ] + }, + { "id" : "Chenyf", + "data" : [ + [ + "Perl 6", + 2 + ] + ], "name" : "Chenyf" }, { @@ -166,37 +188,34 @@ "name" : "Robert Gratza" }, { + "id" : "Sergio Iglesias", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Sergio Iglesias", "name" : "Sergio Iglesias" }, { "name" : "Simon Proctor", - "id" : "Simon Proctor", "data" : [ [ "Perl 6", 2 ] - ] + ], + "id" : "Simon Proctor" } ] }, - "chart" : { - "type" : "column" - }, - "title" : { - "text" : "Perl Weekly Challenge - CURRENT" - }, - "xAxis" : { - "type" : "category" - }, - "legend" : { - "enabled" : 0 + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } } } diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json index 33f33238da..382192bd72 100644 --- a/stats/pwc-summary-1-30.json +++ b/stats/pwc-summary-1-30.json @@ -1,40 +1,9 @@ { - "chart" : { - "type" : "column" - }, - "xAxis" : { - "categories" : [ - "Abigail", - "Adam Russell", - "Ailbhe Tweedie", - "Alex Daniel", - "Alexander Karelas", - "Alexey Melezhik", - "Andrezgz", - "Antonio Gamiz", - "Arne Sommer", - "Arpad Toth", - "Athanasius", - "Aubrey Quarcoo", - "Bill Palmer", - "Bob Kleemann", - "Clive Holloway", - "Daniel Mantovani", - "Dave Cross", - "Dave Jacoby", - "David Kayal", - "Doug Schrag", - "Duncan C. White", - "Eddy HS", - "Finley", - "Francis Whittle", - "Fred Zinn", - "Freddie B", - "Gustavo Chaves", - "Jacques Guinnebault", - "Jaime Corchado", - "Jaldhar H. Vyas" - ] + "yAxis" : { + "min" : 0, + "title" : { + "text" : "" + } }, "title" : { "text" : "Perl Weekly Challenge - 2019" @@ -43,12 +12,6 @@ "shared" : 1, "pointFormat" : "{series.name}: {point.y}
" }, - "yAxis" : { - "title" : { - "text" : "" - }, - "min" : 0 - }, "series" : [ { "name" : "Perl 5", @@ -121,8 +84,45 @@ "name" : "Perl 6" } ], + "xAxis" : { + "categories" : [ + "Abigail", + "Adam Russell", + "Ailbhe Tweedie", + "Alex Daniel", + "Alexander Karelas", + "Alexey Melezhik", + "Andrezgz", + "Antonio Gamiz", + "Arne Sommer", + "Arpad Toth", + "Athanasius", + "Aubrey Quarcoo", + "Bill Palmer", + "Bob Kleemann", + "Clive Holloway", + "Daniel Mantovani", + "Dave Cross", + "Dave Jacoby", + "David Kayal", + "Doug Schrag", + "Duncan C. White", + "Eddy HS", + "Finley", + "Francis Whittle", + "Fred Zinn", + "Freddie B", + "Gustavo Chaves", + "Jacques Guinnebault", + "Jaime Corchado", + "Jaldhar H. Vyas" + ] + }, "subtitle" : { - "text" : "[Champions: 30] Last updated at 2019-04-10 16:27:27 GMT" + "text" : "[Champions: 30] Last updated at 2019-04-11 10:07:29 GMT" + }, + "chart" : { + "type" : "column" }, "plotOptions" : { "column" : { diff --git a/stats/pwc-summary-31-60.json b/stats/pwc-summary-31-60.json index 8017f3a57d..30cc74b4e5 100644 --- a/stats/pwc-summary-31-60.json +++ b/stats/pwc-summary-31-60.json @@ -1,6 +1,37 @@ { - "chart" : { - "type" : "column" + "xAxis" : { + "categories" : [ + "Dr James A. Smith", + "Jeff", + "Jeremy Carman", + "Jim Bacon", + "JJ Merelo", + "Jo Christian Oterhals", + "Joelle Maslak", + "John Barrett", + "Juan Caballero", + "Khalid", + "Kian-Meng Ang", + "Kivanc Yazan", + "Lars Balker", + "Laurent Rosenfeld", + "Magnus Woldrich", + "Mark Senn", + "Martin Mugeni", + "Matt Latusek", + "Maxim Kolodyazhny", + "Michael Schaap", + "Neil Bowers", + "Nick Logan", + "Chenyf", + "Oleskii Tsvitenov", + "Ozzy", + "Pavel Jurca", + "Pete Houston", + "Philippe Bruhat", + "Prajith P", + "Robert Gratza" + ] }, "series" : [ { @@ -27,7 +58,7 @@ 2, 0, 2, - 4, + 6, 0, 2, 0, @@ -62,7 +93,7 @@ 0, 0, 0, - 4, + 6, 4, 0, 4, @@ -74,59 +105,28 @@ ] } ], - "subtitle" : { - "text" : "[Champions: 30] Last updated at 2019-04-10 16:27:27 GMT" - }, - "plotOptions" : { - "column" : { - "stacking" : "percent" - } - }, - "xAxis" : { - "categories" : [ - "Dr James A. Smith", - "Jeff", - "Jeremy Carman", - "Jim Bacon", - "JJ Merelo", - "Jo Christian Oterhals", - "Joelle Maslak", - "John Barrett", - "Juan Caballero", - "Khalid", - "Kian-Meng Ang", - "Kivanc Yazan", - "Lars Balker", - "Laurent Rosenfeld", - "Magnus Woldrich", - "Mark Senn", - "Martin Mugeni", - "Matt Latusek", - "Maxim Kolodyazhny", - "Michael Schaap", - "Neil Bowers", - "Nick Logan", - "Chenyf", - "Oleskii Tsvitenov", - "Ozzy", - "Pavel Jurca", - "Pete Houston", - "Philippe Bruhat", - "Prajith P", - "Robert Gratza" - ] + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" }, "title" : { "text" : "Perl Weekly Challenge - 2019" }, - "tooltip" : { - "pointFormat" : "{series.name}: {point.y}
", - "shared" : 1 - }, "yAxis" : { "min" : 0, "title" : { "text" : "" } + }, + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, + "chart" : { + "type" : "column" + }, + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2019-04-11 10:07:29 GMT" } } diff --git a/stats/pwc-summary-61-90.json b/stats/pwc-summary-61-90.json index e02d315b05..71fe1cbff3 100644 --- a/stats/pwc-summary-61-90.json +++ b/stats/pwc-summary-61-90.json @@ -1,7 +1,15 @@ { + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, "chart" : { "type" : "column" }, + "subtitle" : { + "text" : "[Champions: 12] Last updated at 2019-04-11 10:07:29 GMT" + }, "series" : [ { "name" : "Perl 5", @@ -21,6 +29,7 @@ ] }, { + "name" : "Perl 6", "data" : [ 2, 3, @@ -34,17 +43,12 @@ 0, 0, 0 - ], - "name" : "Perl 6" + ] } ], - "plotOptions" : { - "column" : { - "stacking" : "percent" - } - }, - "subtitle" : { - "text" : "[Champions: 12] Last updated at 2019-04-10 16:27:27 GMT" + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" }, "xAxis" : { "categories" : [ @@ -65,10 +69,6 @@ "title" : { "text" : "Perl Weekly Challenge - 2019" }, - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" - }, "yAxis" : { "title" : { "text" : "" diff --git a/stats/pwc-summary.json b/stats/pwc-summary.json index 50fe22ab2c..fbb1fdbed7 100644 --- a/stats/pwc-summary.json +++ b/stats/pwc-summary.json @@ -1,6 +1,19 @@ { + "tooltip" : { + "shared" : 1, + "pointFormat" : "{series.name}: {point.y}
" + }, + "subtitle" : { + "text" : "[Champions: 72] Last updated at 2019-04-11 10:07:18 GMT" + }, + "plotOptions" : { + "column" : { + "stacking" : "percent" + } + }, "series" : [ { + "name" : "Perl 5", "data" : [ 0, 4, @@ -53,7 +66,7 @@ 2, 0, 2, - 4, + 6, 0, 2, 0, @@ -74,10 +87,10 @@ 2, 3, 1 - ], - "name" : "Perl 5" + ] }, { + "name" : "Perl 6", "data" : [ 0, 0, @@ -130,7 +143,7 @@ 0, 0, 0, - 4, + 6, 4, 0, 4, @@ -151,21 +164,14 @@ 0, 0, 0 - ], - "name" : "Perl 6" + ] } ], - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" - }, - "subtitle" : { - "text" : "[Champions: 72] Last updated at 2019-04-10 16:27:08 GMT" + "chart" : { + "type" : "column" }, - "plotOptions" : { - "column" : { - "stacking" : "percent" - } + "title" : { + "text" : "Perl Weekly Challenge - 2019" }, "xAxis" : { "categories" : [ @@ -243,12 +249,6 @@ "William Gilmore" ] }, - "title" : { - "text" : "Perl Weekly Challenge - 2019" - }, - "chart" : { - "type" : "column" - }, "yAxis" : { "min" : 0, "title" : { -- cgit From 2b600f4df613ed8830773979650d9fe550ab51d5 Mon Sep 17 00:00:00 2001 From: Daniel Mantovani Date: Thu, 11 Apr 2019 18:49:19 -0300 Subject: for ch-003 ch-1.pl --- challenge-003/daniel-mantovani/perl5/ch1-pl | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 challenge-003/daniel-mantovani/perl5/ch1-pl diff --git a/challenge-003/daniel-mantovani/perl5/ch1-pl b/challenge-003/daniel-mantovani/perl5/ch1-pl new file mode 100644 index 0000000000..fa23ce0075 --- /dev/null +++ b/challenge-003/daniel-mantovani/perl5/ch1-pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +use strict; +use warnings; +use v5.10; + +my $q = $ARGV[0]; + +die + "Usage: perl $0 \n\nwhere is the (integer) quantity of hamming numbers you ask" + unless $q && $q =~ /^\d+$/; + +my @primes = (2, 3, 5); + +# for each prime, we will define one vector (array), whith just one element [1] +# note that [1] will be first hamming code inside each array! + +my %vec; +$vec{$_} = [1] for @primes; + +for my $i (1 .. $q) { + +# just look for the min value from the head of v2, v3 or v5 +# (without using List::Util, as the challenge encourages no to use external modules) + my $h; + map { $h = $vec{$_}[0] unless $h && $h < $vec{$_}[0] } @primes; + + # and we just got the next hamming number! + say "$i\t", $h; + + for my $f (@primes) { # now for every prime factor + # remove this value on each vector where it is present + shift @{$vec{$f}} if $vec{$f}[0] == $h; + + # and finally calculate and insert new values to each vector + # note that new pushed value is higer than any previous value in each vector + push @{$vec{$f}}, $h * $f; + } +} -- cgit From 3bec37a83e713fe5ffbd78d283ecda03f8e2f0a6 Mon Sep 17 00:00:00 2001 From: agimenez Date: Fri, 12 Apr 2019 09:02:57 -0300 Subject: challenge-003 andrezgz solution --- challenge-003/andrezgz/perl5/ch-1.pl | 17 +++++++++++++++++ challenge-003/andrezgz/perl5/ch-2.pl | 27 +++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 challenge-003/andrezgz/perl5/ch-1.pl create mode 100644 challenge-003/andrezgz/perl5/ch-2.pl diff --git a/challenge-003/andrezgz/perl5/ch-1.pl b/challenge-003/andrezgz/perl5/ch-1.pl new file mode 100644 index 0000000000..cec1731d72 --- /dev/null +++ b/challenge-003/andrezgz/perl5/ch-1.pl @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-003/ +# Challenge #1 +# Create a script to generate 5-smooth numbers, whose prime divisors are less or equal to 5. +# They are also called Hamming/Regular/Ugly numbers. +# For more information, please check this wikipedia. https://en.wikipedia.org/wiki/Regular_number + +use strict; + +my $last = shift || 20; + +foreach my $n ( 1 .. $last ) { + my $r = $n; + for (2,3,5) { $r /= $_ until ($r % $_) } + print $n.$/ if ($r == 1); +} diff --git a/challenge-003/andrezgz/perl5/ch-2.pl b/challenge-003/andrezgz/perl5/ch-2.pl new file mode 100644 index 0000000000..3d9d8e208a --- /dev/null +++ b/challenge-003/andrezgz/perl5/ch-2.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl + +# https://perlweeklychallenge.org/blog/perl-weekly-challenge-003/ +# Challenge #2 +# Create a script that generates Pascal Triangle. Accept number of rows from the command line. +# The Pascal Triangle should have at least 3 rows. +# For more information about Pascal Triangle, check this wikipedia page. https://en.wikipedia.org/wiki/Pascal%27s_triangle + +use strict; +use warnings; + +my $rows = $ARGV[0] || 0; + +if ($rows < 3) { + print "The Pascal Triangle should have at least 3 rows\n"; + $rows = 3; +} + +my @row = (1); + +while ($rows) { + print join(' ',@row) .$/; + $rows--; + @row = map {$row[$_] += $row[$_+1]} 0..@row-2; + unshift @row, 1; + push @row, 1; +} -- cgit From 8acda7a92b5bc1288eafe4ef1a027c7a765b5b99 Mon Sep 17 00:00:00 2001 From: Steve Rogerson Date: Fri, 12 Apr 2019 15:43:21 +0100 Subject: Add my solution to week3 problem 1 perl5 --- challenge-003/steve-rogerson/ch-1.pl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 challenge-003/steve-rogerson/ch-1.pl diff --git a/challenge-003/steve-rogerson/ch-1.pl b/challenge-003/steve-rogerson/ch-1.pl new file mode 100755 index 0000000000..e1378eaec3 --- /dev/null +++ b/challenge-003/steve-rogerson/ch-1.pl @@ -0,0 +1,29 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use List::Util 'min'; +use Const::Fast; +use 5.010; + + +sub hamming { + my ($arg) = @_; + $arg ||= 0; # pass 1 to restart. + state %s; + if (! %s or $arg ==1 ) { + %s = (1=>1); # 1 is the first hamming number. + } + my $next = min (keys %s); + delete $s{$next}; + for (2,3,5) { + $s{$next * $_} = 1; + } + return $next; +} + +my $i =0; +++$i, print hamming(), " " until $i > 20; +print "...\n"; + +++$i, hamming() until $i == 1690; +print ++$i, "-th: ", hamming(), "\n"; -- cgit From 4775f9d2416fc907d40c3cf14908dff3fe479631 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Fri, 12 Apr 2019 15:49:32 +0100 Subject: - Renamed solution script name. --- challenge-003/daniel-mantovani/perl5/ch-1.pl | 38 ++++++++++++++++++++++++++++ challenge-003/daniel-mantovani/perl5/ch1-pl | 38 ---------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 challenge-003/daniel-mantovani/perl5/ch-1.pl delete mode 100644 challenge-003/daniel-mantovani/perl5/ch1-pl diff --git a/challenge-003/daniel-mantovani/perl5/ch-1.pl b/challenge-003/daniel-mantovani/perl5/ch-1.pl new file mode 100644 index 0000000000..fa23ce0075 --- /dev/null +++ b/challenge-003/daniel-mantovani/perl5/ch-1.pl @@ -0,0 +1,38 @@ +#!/usr/bin/perl +use strict; +use warnings; +use v5.10; + +my $q = $ARGV[0]; + +die + "Usage: perl $0 \n\nwhere is the (integer) quantity of hamming numbers you ask" + unless $q && $q =~ /^\d+$/; + +my @primes = (2, 3, 5); + +# for each prime, we will define one vector (array), whith just one element [1] +# note that [1] will be first hamming code inside each array! + +my %vec; +$vec{$_} = [1] for @primes; + +for my $i (1 .. $q) { + +# just look for the min value from the head of v2, v3 or v5 +# (without using List::Util, as the challenge encourages no to use external modules) + my $h; + map { $h = $vec{$_}[0] unless $h && $h < $vec{$_}[0] } @primes; + + # and we just got the next hamming number! + say "$i\t", $h; + + for my $f (@primes) { # now for every prime factor + # remove this value on each vector where it is present + shift @{$vec{$f}} if $vec{$f}[0] == $h; + + # and finally calculate and insert new values to each vector + # note that new pushed value is higer than any previous value in each vector + push @{$vec{$f}}, $h * $f; + } +} diff --git a/challenge-003/daniel-mantovani/perl5/ch1-pl b/challenge-003/daniel-mantovani/perl5/ch1-pl deleted file mode 100644 index fa23ce0075..0000000000 --- a/challenge-003/daniel-mantovani/perl5/ch1-pl +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/perl -use strict; -use warnings; -use v5.10; - -my $q = $ARGV[0]; - -die - "Usage: perl $0 \n\nwhere is the (integer) quantity of hamming numbers you ask" - unless $q && $q =~ /^\d+$/; - -my @primes = (2, 3, 5); - -# for each prime, we will define one vector (array), whith just one element [1] -# note that [1] will be first hamming code inside each array! - -my %vec; -$vec{$_} = [1] for @primes; - -for my $i (1 .. $q) { - -# just look for the min value from the head of v2, v3 or v5 -# (without using List::Util, as the challenge encourages no to use external modules) - my $h; - map { $h = $vec{$_}[0] unless $h && $h < $vec{$_}[0] } @primes; - - # and we just got the next hamming number! - say "$i\t", $h; - - for my $f (@primes) { # now for every prime factor - # remove this value on each vector where it is present - shift @{$vec{$f}} if $vec{$f}[0] == $h; - - # and finally calculate and insert new values to each vector - # note that new pushed value is higer than any previous value in each vector - push @{$vec{$f}}, $h * $f; - } -} -- cgit From cd228221a4df3c051541f3ca72e9f440693ad648 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Fri, 12 Apr 2019 15:53:25 +0100 Subject: - Updated chart stats. --- stats/pwc-current.json | 146 ++++++++++++++++++++++++++----------------- stats/pwc-summary-1-30.json | 42 ++++++------- stats/pwc-summary-31-60.json | 98 ++++++++++++++--------------- stats/pwc-summary-61-90.json | 30 ++++----- stats/pwc-summary.json | 44 ++++++------- 5 files changed, 195 insertions(+), 165 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index ace9fbb43f..280ed9698c 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,26 +1,48 @@ { - "legend" : { - "enabled" : 0 - }, "xAxis" : { "type" : "category" }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "tooltip" : { + "pointerFormat" : "{point.name}: {point.y:f}
", + "followPointer" : 1, + "headerFormat" : "{series.name}
" }, "title" : { - "text" : "Perl Weekly Challenge - CURRENT" + "text" : "Perl Weekly Challenge - 003" + }, + "subtitle" : { + "text" : "[Champions: 13] Last updated at 2019-04-12 14:53:01 GMT" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } + }, + "legend" : { + "enabled" : 0 }, "series" : [ { "name" : "Champions", "data" : [ { - "y" : 1, + "name" : "Andrezgz", + "drilldown" : "Andrezgz", + "y" : 2 + }, + { "name" : "Clive Holloway", - "drilldown" : "Clive Holloway" + "drilldown" : "Clive Holloway", + "y" : 1 + }, + { + "drilldown" : "Daniel Mantovani", + "name" : "Daniel Mantovani", + "y" : 1 }, { "name" : "Francis Whittle", @@ -29,18 +51,18 @@ }, { "y" : 1, - "name" : "Gustavo Chaves", - "drilldown" : "Gustavo Chaves" + "drilldown" : "Gustavo Chaves", + "name" : "Gustavo Chaves" }, { - "drilldown" : "Dr James A. Smith", "name" : "Dr James A. Smith", + "drilldown" : "Dr James A. Smith", "y" : 4 }, { + "y" : 2, "drilldown" : "Khalid", - "name" : "Khalid", - "y" : 2 + "name" : "Khalid" }, { "name" : "Lars Balker", @@ -48,9 +70,9 @@ "y" : 2 }, { - "y" : 4, + "drilldown" : "Nick Logan", "name" : "Nick Logan", - "drilldown" : "Nick Logan" + "y" : 4 }, { "y" : 2, @@ -58,37 +80,44 @@ "drilldown" : "Chenyf" }, { + "y" : 2, "name" : "Robert Gratza", - "drilldown" : "Robert Gratza", - "y" : 2 + "drilldown" : "Robert Gratza" }, { - "name" : "Sergio Iglesias", + "y" : 2, "drilldown" : "Sergio Iglesias", - "y" : 2 + "name" : "Sergio Iglesias" }, { - "drilldown" : "Simon Proctor", + "y" : 2, "name" : "Simon Proctor", - "y" : 2 + "drilldown" : "Simon Proctor" } ], "colorByPoint" : 1 } ], + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, "chart" : { "type" : "column" }, - "subtitle" : { - "text" : "[Champions: 11] Last updated at 2019-04-11 10:07:18 GMT" - }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "followPointer" : 1, - "pointerFormat" : "{point.name}: {point.y:f}
" - }, "drilldown" : { "series" : [ + { + "name" : "Andrezgz", + "data" : [ + [ + "Perl 5", + 2 + ] + ], + "id" : "Andrezgz" + }, { "id" : "Clive Holloway", "data" : [ @@ -100,28 +129,37 @@ "name" : "Clive Holloway" }, { - "name" : "Francis Whittle", - "id" : "Francis Whittle", + "data" : [ + [ + "Perl 5", + 1 + ] + ], + "id" : "Daniel Mantovani", + "name" : "Daniel Mantovani" + }, + { "data" : [ [ "Perl 6", 2 ] - ] + ], + "id" : "Francis Whittle", + "name" : "Francis Whittle" }, { + "id" : "Gustavo Chaves", "data" : [ [ "Perl 5", 1 ] ], - "id" : "Gustavo Chaves", "name" : "Gustavo Chaves" }, { "name" : "Dr James A. Smith", - "id" : "Dr James A. Smith", "data" : [ [ "Perl 5", @@ -131,7 +169,8 @@ "Perl 6", 2 ] - ] + ], + "id" : "Dr James A. Smith" }, { "id" : "Khalid", @@ -144,17 +183,16 @@ "name" : "Khalid" }, { + "name" : "Lars Balker", "data" : [ [ "Perl 5", 2 ] ], - "id" : "Lars Balker", - "name" : "Lars Balker" + "id" : "Lars Balker" }, { - "name" : "Nick Logan", "id" : "Nick Logan", "data" : [ [ @@ -165,57 +203,49 @@ "Perl 6", 2 ] - ] + ], + "name" : "Nick Logan" }, { + "name" : "Chenyf", "id" : "Chenyf", "data" : [ [ "Perl 6", 2 ] - ], - "name" : "Chenyf" + ] }, { + "name" : "Robert Gratza", "data" : [ [ "Perl 6", 2 ] ], - "id" : "Robert Gratza", - "name" : "Robert Gratza" + "id" : "Robert Gratza" }, { - "id" : "Sergio Iglesias", + "name" : "Sergio Iglesias", "data" : [ [ "Perl 5", 2 ] ], - "name" : "Sergio Iglesias" + "id" : "Sergio Iglesias" }, { - "name" : "Simon Proctor", "data" : [ [ "Perl 6", 2 ] ], - "id" : "Simon Proctor" + "id" : "Simon Proctor", + "name" : "Simon Proctor" } ] - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } } } diff --git a/stats/pwc-summary-1-30.json b/stats/pwc-summary-1-30.json index 382192bd72..d138ff5c04 100644 --- a/stats/pwc-summary-1-30.json +++ b/stats/pwc-summary-1-30.json @@ -1,17 +1,4 @@ { - "yAxis" : { - "min" : 0, - "title" : { - "text" : "" - } - }, - "title" : { - "text" : "Perl Weekly Challenge - 2019" - }, - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" - }, "series" : [ { "name" : "Perl 5", @@ -22,7 +9,7 @@ 0, 0, 0, - 4, + 6, 0, 0, 4, @@ -31,7 +18,7 @@ 0, 4, 1, - 2, + 3, 2, 1, 4, @@ -84,6 +71,19 @@ "name" : "Perl 6" } ], + "tooltip" : { + "pointFormat" : "{series.name}: {point.y}
", + "shared" : 1 + }, + "subtitle" : { + "text" : "[Champions: 30] Last updated at 2019-04-12 14:53:02 GMT" + }, + "chart" : { + "type" : "column" + }, + "title" : { + "text" : "Perl Weekly Challenge - 2019" + }, "xAxis" : { "categories" : [ "Abigail", @@ -118,15 +118,15 @@ "Jaldhar H. Vyas" ] }, - "subtitle" : { - "text" : "[Champions: 30] Last updated at 2019-04-11 10:07:29 GMT" - }, - "chart" : { - "type" : "column" - }, "plotOptions" : { "column" : { "stacking" : "percent" } + }, + "yAxis" : { + "title" : { + "text" : "" + }, + "min" : 0 } } diff --git a/stats/pwc-summary-31-60.json b/stats/pwc-summary-31-60.json index 30cc74b4e5..93f9a5a8b5 100644 --- a/stats/pwc-summary-31-60.json +++ b/stats/pwc-summary-31-60.json @@ -1,37 +1,7 @@ { - "xAxis" : { - "categories" : [ - "Dr James A. Smith", - "Jeff", - "Jeremy Carman", - "Jim Bacon", - "JJ Merelo", - "Jo Christian Oterhals", - "Joelle Maslak", - "John Barrett", - "Juan Caballero", - "Khalid", - "Kian-Meng Ang", - "Kivanc Yazan", - "Lars Balker", - "Laurent Rosenfeld", - "Magnus Woldrich", - "Mark Senn", - "Martin Mugeni", - "Matt Latusek", - "Maxim Kolodyazhny", - "Michael Schaap", - "Neil Bowers", - "Nick Logan", - "Chenyf", - "Oleskii Tsvitenov", - "Ozzy", - "Pavel Jurca", - "Pete Houston", - "Philippe Bruhat", - "Prajith P", - "Robert Gratza" - ] + "tooltip" : { + "pointFormat" : "{series.name}: {point.y}
", + "shared" : 1 }, "series" : [ { @@ -70,7 +40,6 @@ ] }, { - "name" : "Perl 6", "data" : [ 6, 0, @@ -102,31 +71,62 @@ 0, 0, 2 - ] + ], + "name" : "Perl 6" } ], - "tooltip" : { - "shared" : 1, - "pointFormat" : "{series.name}: {point.y}
" + "subtitle" : { + "text" : "[Champions: 30]