From cbfdd589185f2e68e08b3542e519cd35578e7724 Mon Sep 17 00:00:00 2001 From: Alexander Pankoff Date: Mon, 5 Oct 2020 14:14:03 +0200 Subject: reset README --- challenge-081/alexander-pankoff/README | 9 --------- 1 file changed, 9 deletions(-) diff --git a/challenge-081/alexander-pankoff/README b/challenge-081/alexander-pankoff/README index a74e2fd1ec..41f67807ac 100644 --- a/challenge-081/alexander-pankoff/README +++ b/challenge-081/alexander-pankoff/README @@ -1,10 +1 @@ Solution by Alexander Pankoff - -# Run the Haskell solution - -With a `ghc` installation you can run the haskell solution with `runghc` - -``` -$ runghc haskell/ch-1.hs 1 2 3 -1 4 -5 -``` -- cgit From 8968a5ff21e13aecd34c6a0697358cfe1fd30a4d Mon Sep 17 00:00:00 2001 From: boblied Date: Tue, 6 Oct 2020 07:26:56 -0500 Subject: Set up challenge 081 --- challenge-081/bob-lied/README | 4 +- challenge-081/bob-lied/perl/ch-1.pl | 46 ++++++++++++++++++++++ challenge-081/bob-lied/perl/ch-2.pl | 46 ++++++++++++++++++++++ .../bob-lied/perl/lib/CommonBaseString.pm | 39 ++++++++++++++++++ challenge-081/bob-lied/perl/lib/FrequencySort.pm | 39 ++++++++++++++++++ challenge-081/bob-lied/perl/t/CommonBaseString.t | 16 ++++++++ challenge-081/bob-lied/perl/t/FrequencySort.t | 16 ++++++++ challenge-081/bob-lied/perl/t/input | 13 ++++++ 8 files changed, 217 insertions(+), 2 deletions(-) create mode 100755 challenge-081/bob-lied/perl/ch-1.pl create mode 100755 challenge-081/bob-lied/perl/ch-2.pl create mode 100644 challenge-081/bob-lied/perl/lib/CommonBaseString.pm create mode 100644 challenge-081/bob-lied/perl/lib/FrequencySort.pm create mode 100644 challenge-081/bob-lied/perl/t/CommonBaseString.t create mode 100644 challenge-081/bob-lied/perl/t/FrequencySort.t create mode 100644 challenge-081/bob-lied/perl/t/input diff --git a/challenge-081/bob-lied/README b/challenge-081/bob-lied/README index 026576bd98..e698fa656a 100644 --- a/challenge-081/bob-lied/README +++ b/challenge-081/bob-lied/README @@ -1,3 +1,3 @@ -Solutions to weekly challenge 79 by Bob Lied. +Solutions to weekly challenge 81 by Bob Lied. -https://perlweeklychallenge.org/blog/perl-weekly-challenge-079/ +https://perlweeklychallenge.org/blog/perl-weekly-challenge-081/ diff --git a/challenge-081/bob-lied/perl/ch-1.pl b/challenge-081/bob-lied/perl/ch-1.pl new file mode 100755 index 0000000000..3aa9ff13fe --- /dev/null +++ b/challenge-081/bob-lied/perl/ch-1.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-1.pl +#============================================================================= +# Copyright (c) 2020, Bob Lied +#============================================================================= +# Perl Weekly Challenge 081 Task #1 > Common Base String +#============================================================================= +# You are given 2 strings, $A and $B. +# Write a script to find out common base strings in $A and $B. +# A substring of a string $S is called base string if repeated concatenation +# of the substring results in the string. +# Example 1: Input: $A = "abcdabcd" +# $B = "abcdabcdabcdabcd" +# Output: ("abcd", "abcdabcd") +# +# Example 2: Input: $A = "aaa" +# $B = "aa" +# Output: ("a") + +use strict; +use warnings; +use v5.30; + +use feature qw/ signatures /; +no warnings qw/ experimental::signatures /; + +use Getopt::Long; + +use lib "lib"; +use CommonBaseString; + +sub Usage { "Usage: $0 astring bstring" }; + +my $Verbose = 0; +GetOptions('verbose' => \$Verbose); + +my (@A, @B) = @ARGV; + +die Usage() unless $A; +die Usage() unless $B; + +my $cbs = CommonBaseString->new($A, $B); +my $result = $cbs->run(); +say $result; diff --git a/challenge-081/bob-lied/perl/ch-2.pl b/challenge-081/bob-lied/perl/ch-2.pl new file mode 100755 index 0000000000..5ed37221ff --- /dev/null +++ b/challenge-081/bob-lied/perl/ch-2.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# ch-2.pl +#============================================================================= +# Copyright (c) 2020, Bob Lied +#============================================================================= +# Perl Weekly Challenge 081 Task #2 > Frequency Sort +#============================================================================= +# You are given file named input. +# Write a script to find the frequency of all the words. +# It should print the result as first column of each line should be the +# frequency of the the word followed by all the words of that frequency +# arranged in lexicographical order. Also sort the words in the ascending +# order of frequency. +# For the sake of this task, please ignore the following in the input file: +# . " ( ) , 's -- +# Keep hyphenated words and contractions, but reduce possessives to their base +# (e.g., "award-winning" and "doesn't" are words, but "Joe's" becomes "Joe" + +use strict; +use warnings; +use v5.30; + +use feature qw/ signatures /; +no warnings qw/ experimental::signatures /; + +use Getopt::Long; + +use lib "lib"; +use FrequencySort; + +sub Usage { "Usage: $0 args" }; + +my $Verbose = 0; +GetOptions('verbose' => \$Verbose); + +my $arg = shift; +my @list = @ARGV; + +die Usage() unless $arg; +die Usage() unless @list; + +my $task = FrequencySort->new(); +my $result = $task->run(); +say $result; diff --git a/challenge-081/bob-lied/perl/lib/CommonBaseString.pm b/challenge-081/bob-lied/perl/lib/CommonBaseString.pm new file mode 100644 index 0000000000..b67ecfa948 --- /dev/null +++ b/challenge-081/bob-lied/perl/lib/CommonBaseString.pm @@ -0,0 +1,39 @@ +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# CommonBaseString.pm +#============================================================================= +# Copyright (c) 2020, Bob Lied +#============================================================================= +# Description: +#============================================================================= + +package CommonBaseString; + +use strict; +use warnings; +use v5.30; + +use feature qw/ signatures /; +no warnings qw/ experimental::signatures /; + +require Exporter; +our @ISA = qw(Exporter); +our @EXPORT = qw(); +our @EXPORT_OK = qw(); + +sub new($class, $name1) +{ + $class = ref($class) || $class; + my $self = { + _name1 => $name1, + }; + bless $self, $class; + return $self; +} + +sub run($self) +{ + return undef; +} + +1; diff --git a/challenge-081/bob-lied/perl/lib/FrequencySort.pm b/challenge-081/bob-lied/perl/lib/FrequencySort.pm new file mode 100644 index 0000000000..177e28ace9 --- /dev/null +++ b/challenge-081/bob-lied/perl/lib/FrequencySort.pm @@ -0,0 +1,39 @@ +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# FrequencySort.pm +#============================================================================= +# Copyright (c) 2020, Bob Lied +#============================================================================= +# Description: +#============================================================================= + +package FrequencySort; + +use strict; +use warnings; +use v5.30; + +use feature qw/ signatures /; +no warnings qw/ experimental::signatures /; + +require Exporter; +our @ISA = qw(Exporter); +our @EXPORT = qw(); +our @EXPORT_OK = qw(); + +sub new($class, $name1) +{ + $class = ref($class) || $class; + my $self = { + _name1 => $name1, + }; + bless $self, $class; + return $self; +} + +sub run($self) +{ + return undef; +} + +1; diff --git a/challenge-081/bob-lied/perl/t/CommonBaseString.t b/challenge-081/bob-lied/perl/t/CommonBaseString.t new file mode 100644 index 0000000000..81d4345b76 --- /dev/null +++ b/challenge-081/bob-lied/perl/t/CommonBaseString.t @@ -0,0 +1,16 @@ +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +# +#=============================================================================== +# FILE: CommonBaseString.t +# DESCRIPTION: Unit test for CommonBaseString +#=============================================================================== + +use strict; +use warnings; +use v5.30; + +use Test2::V0; + +use CommonBaseString; + +done_testing(); diff --git a/challenge-081/bob-lied/perl/t/FrequencySort.t b/challenge-081/bob-lied/perl/t/FrequencySort.t new file mode 100644 index 0000000000..794fd04750 --- /dev/null +++ b/challenge-081/bob-lied/perl/t/FrequencySort.t @@ -0,0 +1,16 @@ +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +# +#=============================================================================== +# FILE: FrequencySort.t +# DESCRIPTION: Unit test for FrequencySort +#=============================================================================== + +use strict; +use warnings; +use v5.30; + +use Test2::V0; + +use FrequencySort; + +done_testing(); diff --git a/challenge-081/bob-lied/perl/t/input b/challenge-081/bob-lied/perl/t/input new file mode 100644 index 0000000000..5905c36971 --- /dev/null +++ b/challenge-081/bob-lied/perl/t/input @@ -0,0 +1,13 @@ +West Side Story + +The award-winning adaptation of the classic romantic tragedy "Romeo and +Juliet". The feuding families become two warring New York City gangs, the +white Jets led by Riff and the Latino Sharks, led by Bernardo. Their hatred +escalates to a point where neither can coexist with any form of understanding. +But when Riff's best friend (and former Jet) Tony and Bernardo's younger +sister Maria meet at a dance, no one can do anything to stop their love. Maria +and Tony begin meeting in secret, planning to run away. Then the Sharks and +Jets plan a rumble under the highway--whoever wins gains control of the +streets. Maria sends Tony to stop it, hoping it can end the violence. It goes +terribly wrong, and before the lovers know what's happened, tragedy strikes +and doesn't stop until the climactic and heartbreaking ending. -- cgit From 4b6202a6507cb1e1e3854fa643fc25714dc930a2 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Tue, 6 Oct 2020 19:34:55 -0400 Subject: perl solution to challenge 81 task 1 --- challenge-081/walt-mankowski/perl/ch-1.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 challenge-081/walt-mankowski/perl/ch-1.pl diff --git a/challenge-081/walt-mankowski/perl/ch-1.pl b/challenge-081/walt-mankowski/perl/ch-1.pl new file mode 100644 index 0000000000..9a91c9d8db --- /dev/null +++ b/challenge-081/walt-mankowski/perl/ch-1.pl @@ -0,0 +1,28 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use feature qw(:5.32); +use experimental qw(signatures); +use List::Util qw(min); + +# You are given 2 strings, $A and $B. +# +# Write a script to find out common base strings in $A and $B. +# +# A substring of a string $S is called base string if repeated +# concatenation of the substring results in the string. + +my ($A, $B) = @ARGV; +my $max_base_len = min(length($A), length($B)); + +for my $i (1 .. $max_base_len) { + if (is_base(substr($A, 0, $i), $A) && is_base(substr($B, 0, $i), $B)) { + say substr($A, 0, $i); + } +} + +sub is_base($prefix, $s) { + my $cnt = length($s) / length($prefix); + return $prefix x $cnt eq $s; +} + -- cgit From 6c58dba68670dfc7c703bb4a39455196eb3dbd97 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Tue, 6 Oct 2020 19:40:07 -0400 Subject: cleaned up the code a bit --- challenge-081/walt-mankowski/perl/ch-1.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/challenge-081/walt-mankowski/perl/ch-1.pl b/challenge-081/walt-mankowski/perl/ch-1.pl index 9a91c9d8db..130a121916 100644 --- a/challenge-081/walt-mankowski/perl/ch-1.pl +++ b/challenge-081/walt-mankowski/perl/ch-1.pl @@ -16,8 +16,9 @@ my ($A, $B) = @ARGV; my $max_base_len = min(length($A), length($B)); for my $i (1 .. $max_base_len) { - if (is_base(substr($A, 0, $i), $A) && is_base(substr($B, 0, $i), $B)) { - say substr($A, 0, $i); + my $prefix = substr($A, 0, $i); + if (is_base($prefix, $A) && is_base($prefix, $B)) { + say $prefix; } } -- cgit From fb9bee1b7c989e55ca10b43bc2553700f558aabd Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Tue, 6 Oct 2020 19:57:20 -0400 Subject: perl code for challenge 81 task 2 --- challenge-081/walt-mankowski/perl/ch-2.pl | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 challenge-081/walt-mankowski/perl/ch-2.pl diff --git a/challenge-081/walt-mankowski/perl/ch-2.pl b/challenge-081/walt-mankowski/perl/ch-2.pl new file mode 100644 index 0000000000..68e2900945 --- /dev/null +++ b/challenge-081/walt-mankowski/perl/ch-2.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use feature qw(:5.32); +use experimental qw(signatures); + +# You are given file named input. +# +# Write a script to find the frequency of all the words. +# +# It should print the result as first column of each line should be +# the frequency of the the word followed by all the words of that +# frequency arranged in lexicographical order. Also sort the words in +# the ascending order of frequency. +# +# For the sake of this task, please ignore the following in the input file: +# +# . " ( ) , 's -- + +my %h; + +while (<>) { + chomp; + s/--/ /; + my @tok = split / /; + for my $tok (@tok) { + $tok =~ s/[."(),]//g; + $tok =~ s/'s$//; + $h{$tok}++; + } +} + +my $last = 0; +for my $k (sort { $h{$a} <=> $h{$b} || $a cmp $b } keys %h) { + if ($h{$k} != $last) { + print "\n" unless $last == 0; + print $h{$k}; + $last = $h{$k}; + } + print " $k"; +} + +print "\n"; + -- cgit From 7af4d2a5a2c40a060f78972bd974af2ee836c631 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Tue, 6 Oct 2020 19:57:27 -0400 Subject: input file for challenge 81 task 2 --- challenge-081/walt-mankowski/perl/input.txt | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 challenge-081/walt-mankowski/perl/input.txt diff --git a/challenge-081/walt-mankowski/perl/input.txt b/challenge-081/walt-mankowski/perl/input.txt new file mode 100644 index 0000000000..649cf57770 --- /dev/null +++ b/challenge-081/walt-mankowski/perl/input.txt @@ -0,0 +1,15 @@ +West Side Story + +The award-winning adaptation of the classic romantic tragedy "Romeo +and Juliet". The feuding families become two warring New York City +gangs, the white Jets led by Riff and the Latino Sharks, led by +Bernardo. Their hatred escalates to a point where neither can coexist +with any form of understanding. But when Riff's best friend (and +former Jet) Tony and Bernardo's younger sister Maria meet at a dance, +no one can do anything to stop their love. Maria and Tony begin +meeting in secret, planning to run away. Then the Sharks and Jets plan +a rumble under the highway--whoever wins gains control of the +streets. Maria sends Tony to stop it, hoping it can end the +violence. It goes terribly wrong, and before the lovers know what's +happened, tragedy strikes and doesn't stop until the climactic and +heartbreaking ending. -- cgit From 293c72bd0be6f09dba088d564d92d6820357bb3e Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Tue, 6 Oct 2020 21:08:46 -0400 Subject: python solutions to challenge 81 --- challenge-081/walt-mankowski/python/ch-1.py | 13 +++++++++++++ challenge-081/walt-mankowski/python/ch-2.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 challenge-081/walt-mankowski/python/ch-1.py create mode 100644 challenge-081/walt-mankowski/python/ch-2.py diff --git a/challenge-081/walt-mankowski/python/ch-1.py b/challenge-081/walt-mankowski/python/ch-1.py new file mode 100644 index 0000000000..a268b371f5 --- /dev/null +++ b/challenge-081/walt-mankowski/python/ch-1.py @@ -0,0 +1,13 @@ +from sys import argv + +def is_base(prefix, s): + cnt = int(len(s) / len(prefix)) + return prefix * cnt == s + +a, b = argv[1:] +max_base_len = min(len(a), len(b)) + +for i in range(1, max_base_len+1): + prefix = a[0:i] + if is_base(prefix, a) and is_base(prefix, b): + print(prefix) diff --git a/challenge-081/walt-mankowski/python/ch-2.py b/challenge-081/walt-mankowski/python/ch-2.py new file mode 100644 index 0000000000..2b6c400b45 --- /dev/null +++ b/challenge-081/walt-mankowski/python/ch-2.py @@ -0,0 +1,29 @@ +from sys import argv +from collections import defaultdict +import re + +d = defaultdict(int) +fname = argv[1] +with open(fname) as f: + for line in f: + line = line.rstrip() + line = re.sub('--', ' ', line) + if line == '': + continue + toks = line.split(' ') + for tok in toks: + tok = re.sub('[."(),]', '', tok); + tok = re.sub("'s$", '', tok) + d[tok] += 1 + +last = 0 +for k in sorted(d, key=lambda k:(d[k], k)): + if d[k] != last: + if last != 0: + print() + print(d[k], end='') + last = d[k] + print(f" {k}", end = '') + +print() + -- cgit From d0579dfc12bbc9d3878bd2aab8525e9b3140824b Mon Sep 17 00:00:00 2001 From: boblied Date: Fri, 9 Oct 2020 15:34:05 -0500 Subject: Solutions for PWC 081 --- challenge-081/bob-lied/perl/ch-1.pl | 4 +- challenge-081/bob-lied/perl/ch-2.pl | 49 ++++++++++++++++------ .../bob-lied/perl/lib/CommonBaseString.pm | 48 +++++++++++++++++++-- challenge-081/bob-lied/perl/lib/FrequencySort.pm | 39 ----------------- challenge-081/bob-lied/perl/t/CommonBaseString.t | 12 +++++- challenge-081/bob-lied/perl/t/FrequencySort.t | 16 ------- 6 files changed, 93 insertions(+), 75 deletions(-) delete mode 100644 challenge-081/bob-lied/perl/lib/FrequencySort.pm delete mode 100644 challenge-081/bob-lied/perl/t/FrequencySort.t diff --git a/challenge-081/bob-lied/perl/ch-1.pl b/challenge-081/bob-lied/perl/ch-1.pl index 3aa9ff13fe..032b1efc8d 100755 --- a/challenge-081/bob-lied/perl/ch-1.pl +++ b/challenge-081/bob-lied/perl/ch-1.pl @@ -36,11 +36,11 @@ sub Usage { "Usage: $0 astring bstring" }; my $Verbose = 0; GetOptions('verbose' => \$Verbose); -my (@A, @B) = @ARGV; +my ($A, $B) = @ARGV; die Usage() unless $A; die Usage() unless $B; my $cbs = CommonBaseString->new($A, $B); my $result = $cbs->run(); -say $result; +say "@$result"; diff --git a/challenge-081/bob-lied/perl/ch-2.pl b/challenge-081/bob-lied/perl/ch-2.pl index 5ed37221ff..76c3ba067d 100755 --- a/challenge-081/bob-lied/perl/ch-2.pl +++ b/challenge-081/bob-lied/perl/ch-2.pl @@ -25,22 +25,45 @@ use v5.30; use feature qw/ signatures /; no warnings qw/ experimental::signatures /; -use Getopt::Long; +use File::Slurper qw/ read_text /; -use lib "lib"; -use FrequencySort; -sub Usage { "Usage: $0 args" }; +sub Usage { "Usage: $0 filename" }; -my $Verbose = 0; -GetOptions('verbose' => \$Verbose); +my $InFile = shift; -my $arg = shift; -my @list = @ARGV; +# It would be friendlier to allow stdin, but the spec says use a file. +die Usage() unless $InFile; -die Usage() unless $arg; -die Usage() unless @list; +# Slurp input file into one long string. +my $input = read_text($InFile); + +# Split on word separators, and convienently get rid of them. +# That might leave some empty strings, so filter those. +my @words = grep !/^$/, split(/\s|[\n\r."(),]/, $input); + +# These next two cleanups could be chained to make one pass, +# but let's keep it readable for now. +# +# Phrases separated by long dashes turn into multiple words. +@words = map { if (/--/) { split(/--/) } else { $_ } } @words; + +# Possessives reduce to the base noun. +@words = map { s/'s//; $_ } @words; + +my %counts; +$counts{$_}++ foreach @words; + +# Invert the hash to have counts as keys to lists of words. +my %countList; +for my $word ( keys %counts ) +{ + push @{$countList{ $counts{$word} }}, $word; +} + +# Numeric sort ascending on the counts. +for my $n ( sort { $a <=> $b } keys %countList ) +{ + say "$n\t", join " ", sort @{$countList{$n}} +} -my $task = FrequencySort->new(); -my $result = $task->run(); -say $result; diff --git a/challenge-081/bob-lied/perl/lib/CommonBaseString.pm b/challenge-081/bob-lied/perl/lib/CommonBaseString.pm index b67ecfa948..4c6f98901c 100644 --- a/challenge-081/bob-lied/perl/lib/CommonBaseString.pm +++ b/challenge-081/bob-lied/perl/lib/CommonBaseString.pm @@ -19,21 +19,61 @@ no warnings qw/ experimental::signatures /; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(); -our @EXPORT_OK = qw(); +our @EXPORT_OK = qw(commonPrefix); -sub new($class, $name1) +sub new($class, $a, $b) { $class = ref($class) || $class; my $self = { - _name1 => $name1, + _a => $a, + _b => $b, }; bless $self, $class; return $self; } +# +sub commonPrefix($s, $t) +{ + my @s1 = split("", $s); + my @s2 = split("", $t); + my $prefix = ""; + my @possiblePrefixes = (); + + while ( @s1 && @s2 && ($s = shift @s1) eq ($t = shift @s2) ) + { + $prefix .= $s; + push @possiblePrefixes, $prefix; + } + return \@possiblePrefixes; +} + sub run($self) { - return undef; + my ($A, $B) = @{$self}{qw(_a _b)}; + my ($lenA, $lenB) = ( length($A), length($B) ); + my @thisWorks = (); + + my $prefixes = commonPrefix($A, $B); + + for my $prefix ( @$prefixes ) + { + my $lenP = length($prefix); + # Only prefixes that can be repeated to the length of both strings + # are candidates. + next unless $lenA % $lenP == 0; + next unless $lenB % $lenP == 0; + + # Number of repetitions required for each string. + my $repA = $lenA / $lenP; + my $repB = $lenB / $lenP; + + my $buildsA = ( ($prefix x $repA) eq $A ); + my $buildsB = ( ($prefix x $repB) eq $B ); + push @thisWorks, $prefix if ( $buildsA && $buildsB ); + } + + return \@thisWorks; } 1; diff --git a/challenge-081/bob-lied/perl/lib/FrequencySort.pm b/challenge-081/bob-lied/perl/lib/FrequencySort.pm deleted file mode 100644 index 177e28ace9..0000000000 --- a/challenge-081/bob-lied/perl/lib/FrequencySort.pm +++ /dev/null @@ -1,39 +0,0 @@ -# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: -#============================================================================= -# FrequencySort.pm -#============================================================================= -# Copyright (c) 2020, Bob Lied -#============================================================================= -# Description: -#============================================================================= - -package FrequencySort; - -use strict; -use warnings; -use v5.30; - -use feature qw/ signatures /; -no warnings qw/ experimental::signatures /; - -require Exporter; -our @ISA = qw(Exporter); -our @EXPORT = qw(); -our @EXPORT_OK = qw(); - -sub new($class, $name1) -{ - $class = ref($class) || $class; - my $self = { - _name1 => $name1, - }; - bless $self, $class; - return $self; -} - -sub run($self) -{ - return undef; -} - -1; diff --git a/challenge-081/bob-lied/perl/t/CommonBaseString.t b/challenge-081/bob-lied/perl/t/CommonBaseString.t index 81d4345b76..8c7108c572 100644 --- a/challenge-081/bob-lied/perl/t/CommonBaseString.t +++ b/challenge-081/bob-lied/perl/t/CommonBaseString.t @@ -10,7 +10,17 @@ use warnings; use v5.30; use Test2::V0; +use lib "lib"; + +use CommonBaseString qw/ commonPrefix /; + +is( commonPrefix("abc", "def"), [ ], "commonPrefix length 0" ); +is( commonPrefix("aaa", "abc"), [ "a" ], "commonPrefix length 1" ); +is( commonPrefix("aaa", "aac"), [ "a", "aa" ], "commonPrefix length 2" ); +is( commonPrefix("abab", "abababab"), [ "a", "ab", "aba", "abab" ], "commonPrefix 2 possibilities" ); + +is( CommonBaseString->new("abcdabcd", "abcdabcdabcdabcd")->run, [ "abcd", "abcdabcd" ], "Example 1"); +is( CommonBaseString->new("aaa", "a")->run, [ "a" ], "Example 2"); -use CommonBaseString; done_testing(); diff --git a/challenge-081/bob-lied/perl/t/FrequencySort.t b/challenge-081/bob-lied/perl/t/FrequencySort.t deleted file mode 100644 index 794fd04750..0000000000 --- a/challenge-081/bob-lied/perl/t/FrequencySort.t +++ /dev/null @@ -1,16 +0,0 @@ -# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: -# -#=============================================================================== -# FILE: FrequencySort.t -# DESCRIPTION: Unit test for FrequencySort -#=============================================================================== - -use strict; -use warnings; -use v5.30; - -use Test2::V0; - -use FrequencySort; - -done_testing(); -- cgit From d37a9263d9436a4f38818bd2afccdc1d4623a5e8 Mon Sep 17 00:00:00 2001 From: PerlMonk Athanasius Date: Sat, 10 Oct 2020 18:54:35 +1000 Subject: Perl & Raku solutions to Tasks 1 & 2 of the Perl Weekly Challenge #081 On branch branch-for-challenge-081 Changes to be committed: new file: challenge-081/athanasius/perl/WestSideStory.txt new file: challenge-081/athanasius/perl/ch-1.pl new file: challenge-081/athanasius/perl/ch-2.pl new file: challenge-081/athanasius/raku/WestSideStory.txt new file: challenge-081/athanasius/raku/ch-1.raku new file: challenge-081/athanasius/raku/ch-2.raku --- challenge-081/athanasius/perl/WestSideStory.txt | 3 + challenge-081/athanasius/perl/ch-1.pl | 130 ++++++++++++++++++ challenge-081/athanasius/perl/ch-2.pl | 174 ++++++++++++++++++++++++ challenge-081/athanasius/raku/WestSideStory.txt | 3 + challenge-081/athanasius/raku/ch-1.raku | 138 +++++++++++++++++++ challenge-081/athanasius/raku/ch-2.raku | 148 ++++++++++++++++++++ 6 files changed, 596 insertions(+) create mode 100644 challenge-081/athanasius/perl/WestSideStory.txt create mode 100644 challenge-081/athanasius/perl/ch-1.pl create mode 100644 challenge-081/athanasius/perl/ch-2.pl create mode 100644 challenge-081/athanasius/raku/WestSideStory.txt create mode 100644 challenge-081/athanasius/raku/ch-1.raku create mode 100644 challenge-081/athanasius/raku/ch-2.raku diff --git a/challenge-081/athanasius/perl/WestSideStory.txt b/challenge-081/athanasius/perl/WestSideStory.txt new file mode 100644 index 0000000000..37001629ad --- /dev/null +++ b/challenge-081/athanasius/perl/WestSideStory.txt @@ -0,0 +1,3 @@ +West Side Story + +The award-winning adaptation of the classic romantic tragedy "Romeo and Juliet". The feuding families become two warring New York City gangs, the white Jets led by Riff and the Latino Sharks, led by Bernardo. Their hatred escalates to a point where neither can coexist with any form of understanding. But when Riff's best friend (and former Jet) Tony and Bernardo's younger sister Maria meet at a dance, no one can do anything to stop their love. Maria and Tony begin meeting in secret, planning to run away. Then the Sharks and Jets plan a rumble under the highway--whoever wins gains control of the streets. Maria sends Tony to stop it, hoping it can end the violence. It goes terribly wrong, and before the lovers know what's happened, tragedy strikes and doesn't stop until the climactic and heartbreaking ending. diff --git a/challenge-081/athanasius/perl/ch-1.pl b/challenge-081/athanasius/perl/ch-1.pl new file mode 100644 index 0000000000..d3e22ee5f6 --- /dev/null +++ b/challenge-081/athanasius/perl/ch-1.pl @@ -0,0 +1,130 @@ +#!perl + +############################################################################### +=comment + +Perl Weekly Challenge 081 +========================= + +Task #1 +------- +*Common Base String* + +Submitted by: Mohammad S Anwar + +You are given 2 strings, $A and $B. + +Write a script to find out common base strings in $A and $B. + + A substring of a string $S is called base string if repeated concatenation + of the substring results in the string. + +Example 1: + + Input: + $A = "abcdabcd" + $B = "abcdabcdabcdabcd" + + Output: + ("abcd", "abcdabcd") + +Example 2: + + Input: + $A = "aaa" + $B = "aa" + + Output: + ("a") + +=cut +############################################################################### + +#--------------------------------------# +# Copyright © 2020 PerlMonk Athanasius # +#--------------------------------------# + + # Exports: +use strict; +use warnings; +use Const::Fast; # const() +use Math::Prime::Util qw( divisors ); +use Set::Scalar; # infix "*" (overloaded for set inter- + # section), members(), new() + +const my $USAGE => +"Usage: + perl $0 + + First string + Second string\n"; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + $| = 1; + print "\nChallenge 081, Task #1: Common Base String (Perl)\n\n"; +} + +#============================================================================== +MAIN: +#============================================================================== +{ + my ($A, $B) = parse_command_line(); + + # (1) Display the input + + print qq[Input:\n \$A = "$A"\n \$B = "$B"\n\n]; + + # (2) Find the *lengths* of all possible base strings common to $A and $B + + my $A_lengths = Set::Scalar->new( divisors(length $A) ); + my $B_lengths = Set::Scalar->new( divisors(length $B) ); + my @lengths = sort { $a <=> $b } ($A_lengths * $B_lengths)->members; + + # (3) Find the base strings common to $A and $B using the substring lengths + # just calculated + + my $A_bases = Set::Scalar->new( find_base_strings($A, \@lengths) ); + my $B_bases = Set::Scalar->new( find_base_strings($B, \@lengths) ); + my @bases = sort +($A_bases * $B_bases)->members; + + # (4) Display the common base strings + + printf "Output:\n (%s)\n", join ', ', map { qq["$_"] } @bases; +} + +#------------------------------------------------------------------------------ +sub find_base_strings +#------------------------------------------------------------------------------ +{ + my ($string, $lengths) = @_; + my $total_length = length $string; + my @base_strings; + + for my $length (@$lengths) + { + my $substring = substr $string, 0, $length; + my $new_string = $substring x int($total_length / $length); + + push @base_strings, $substring if $new_string eq $string; + } + + return @base_strings; +} + +#------------------------------------------------------------------------------ +sub parse_command_line +#------------------------------------------------------------------------------ +{ + my $args = scalar @ARGV; + + $args == 2 + or die "ERROR: Incorrect number ($args) of command-line arguments\n" . + $USAGE; + + return @ARGV; +} + +############################################################################### diff --git a/challenge-081/athanasius/perl/ch-2.pl b/challenge-081/athanasius/perl/ch-2.pl new file mode 100644 index 0000000000..c32157c2bb --- /dev/null +++ b/challenge-081/athanasius/perl/ch-2.pl @@ -0,0 +1,174 @@ +#!perl + +############################################################################### +=comment + +Perl Weekly Challenge 081 +========================= + +Task #2 +------- +*Frequency Sort* + +Submitted by: Mohammad S Anwar + +You are given file named input. + +Write a script to find the frequency of all the words. + +It should print the result as first column of each line should be the frequency +of the the word followed by all the words of that frequency arranged in lexico- +graphical order. Also sort the words in the ascending order of frequency. + +INPUT file + + West Side Story + + The award-winning adaptation of the classic romantic tragedy "Romeo and + Juliet". The feuding families become two warring New York City gangs, the + white Jets led by Riff and the Latino Sharks, led by Bernardo. Their hatred + escalates to a point where neither can coexist with any form of understanding. + But when Riff's best friend (and former Jet) Tony and Bernardo's younger + sister Maria meet at a dance, no one can do anything to stop their love. Maria + and Tony begin meeting in secret, planning to run away. Then the Sharks and + Jets plan a rumble under the highway--whoever wins gains control of the + streets. Maria sends Tony to stop it, hoping it can end the violence. It goes + terribly wrong, and before the lovers know what's happened, tragedy strikes + and doesn't stop until the climactic and heartbreaking ending. + +NOTE + +For the sake of this task, please ignore the following in the input file: + + . " ( ) , 's -- + +OUTPUT + + 1 But City It Jet Juliet Latino New Romeo Side Story Their Then West York + adaptation any anything at award-winning away become before begin best classic + climactic coexist control dance do doesn't end ending escalates families + feuding form former friend gains gangs goes happened hatred heartbreaking + highway hoping in know love lovers meet meeting neither no one plan planning + point romantic rumble run secret sends sister streets strikes terribly their + two under understanding until violence warring what when where white whoever + wins with wrong younger + + 2 Bernardo Jets Riff Sharks The by it led tragedy + + 3 Maria Tony a can of stop + + 4 to + + 9 and the + +=cut +############################################################################### + +#--------------------------------------# +# Copyright © 2020 PerlMonk Athanasius # +#--------------------------------------# + +use strict; +use warnings; +use Const::Fast; # Exports const() + +const my $DEFAULT_INPUT_FILE => 'WestSideStory.txt'; +const my $USAGE => +"Usage: + perl $0 [] + + [] Input file name\n"; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + $| = 1; + print "\nChallenge 081, Task #2: Frequency Sort (Perl)\n"; +} + +#============================================================================== +MAIN: +#============================================================================== +{ + # (1) Read in and edit the input text + + my $text = parse_command_line(); + + # The text is first edited by replacing trailing 's and _ with spaces, then + # any remaining apostrophes are converted to underscores. This is done + # because \w matches the underscore character but not the apostrophe: which + # makes it easy to identify "words" using the zero-width assertion \b that + # matches on word boundaries (\w\W and \W\w). Note: It is not necessary to + # remove the other non-word characters [."(),] from the text, as these are + # automatically excluded by the match logic of the regex. + + $text =~ s{ 's \b }{ }gx; + $text =~ s{ _ }{ }gx; + $text =~ s{ ' }{_}gx; + + # (2) Create a dictionary of words (keys) and their frequencies (values) + + my %by_word; + + for my $word ($text =~ m{ \b (\w+?) \b }gx) + { + # Once a word has been identified, its apostrophes (if any) are + # restored, then it is recorded in the dictionary + + $word =~ s{ _ }{'}gx; + + ++$by_word{ $word }; + } + + # (3) Create a reverse dictionary of frequencies (keys) and arrays of words + # (values) + + my %by_freq; # Reverse dictionary: frequency => array of words + + # From perlfaq4, "How do I look up a hash element by value?" + + while (my ($word, $freq) = each %by_word) + { + push $by_freq{ $freq }->@*, $word; + } + + # (4) Output frequencies (in ascending numerical order) together with their + # associated words (in ascending lexicographical order) + + for my $freq (sort { $a <=> $b } keys %by_freq) + { + printf "\n%d %s\n", $freq, join ' ', sort $by_freq{ $freq }->@*; + } +} + +#------------------------------------------------------------------------------ +sub parse_command_line +#------------------------------------------------------------------------------ +{ + my $args = scalar @ARGV; + my $input = $DEFAULT_INPUT_FILE; + + if ($args == 1) + { + $input = $ARGV[0]; + } + elsif ($args > 1) + { + die "ERROR: Too many ($args) command-line arguments\n$USAGE"; + } + + open(my $fh, '<', $input) + or die "ERROR: Cannot open file '$input' for reading\n$USAGE"; + + local $/; # Slurp mode + + my $text = <$fh>; + + close $fh + or die "ERROR: Cannot close file '$input', stopped"; + + return $text; +} + +############################################################################### diff --git a/challenge-081/athanasius/raku/WestSideStory.txt b/challenge-081/athanasius/raku/WestSideStory.txt new file mode 100644 index 0000000000..37001629ad --- /dev/null +++ b/challenge-081/athanasius/raku/WestSideStory.txt @@ -0,0 +1,3 @@ +West Side Story + +The award-winning adaptation of the classic romantic tragedy "Romeo and Juliet". The feuding families become two warring New York City gangs, the white Jets led by Riff and the Latino Sharks, led by Bernardo. Their hatred escalates to a point where neither can coexist with any form of understanding. But when Riff's best friend (and former Jet) Tony and Bernardo's younger sister Maria meet at a dance, no one can do anything to stop their love. Maria and Tony begin meeting in secret, planning to run away. Then the Sharks and Jets plan a rumble under the highway--whoever wins gains control of the streets. Maria sends Tony to stop it, hoping it can end the violence. It goes terribly wrong, and before the lovers know what's happened, tragedy strikes and doesn't stop until the climactic and heartbreaking ending. diff --git a/challenge-081/athanasius/raku/ch-1.raku b/challenge-081/athanasius/raku/ch-1.raku new file mode 100644 index 0000000000..ec0cb43a1a --- /dev/null +++ b/challenge-081/athanasius/raku/ch-1.raku @@ -0,0 +1,138 @@ +use v6d; + +############################################################################### +=begin comment + +Perl Weekly Challenge 081 +========================= + +Task #1 +------- +*Common Base String* + +Submitted by: Mohammad S Anwar + +You are given 2 strings, $A and $B. + +Write a script to find out common base strings in $A and $B. + + A substring of a string $S is called base string if repeated concatenation + of the substring results in the string. + +Example 1: + + Input: + $A = "abcdabcd" + $B = "abcdabcdabcdabcd" + + Output: + ("abcd", "abcdabcd") + +Example 2: + + Input: + $A = "aaa" + $B = "aa" + + Output: + ("a") + +=end comment +############################################################################### + +#--------------------------------------# +# Copyright © 2020 PerlMonk Athanasius # +#--------------------------------------# + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + "\nChallenge 081, Task #1: Common Base String (Raku)\n".put; +} + +##============================================================================= +sub MAIN +( + Str:D $A, #= First string + Str:D $B, #= Second string +) +##============================================================================= +{ + # (1) Display the input + + qq[Input:\n \$A = "$A"\n \$B = "$B"\n].put; + + # (2) Find the *lengths* of all possible base strings common to $A and $B + + my UInt @common-lengths = (find-divisors($A).Set ∩ + find-divisors($B).Set).keys.sort; + + # (3) Find the base strings common to $A and $B using the substring lengths + # just calculated + + my Str @common-bases = + (find-base-strings($A, @common-lengths).Set ∩ + find-base-strings($B, @common-lengths).Set).keys.sort; + + # (4) Display the common base strings + + "Output:\n (%s)\n".printf: @common-bases.map( { qq["$_"] } ).join: ', '; +} + +#------------------------------------------------------------------------------ +sub find-base-strings +( + Str:D $string, + Array:D[UInt:D] $lengths, +--> Array:D[Str:D] +) +#------------------------------------------------------------------------------ +{ + my UInt $total-length = $string.chars; + my Str @base-strings; + + for @$lengths -> UInt $length + { + my Str $substring = substr $string, 0, $length; + my Str $new-string = $substring x ($total-length / $length); + + @base-strings.push: $substring if $new-string eq $string; + } + + return @base-strings; +} + +#------------------------------------------------------------------------------ +sub find-divisors( Str:D $string --> Seq:D[UInt:D] ) +#------------------------------------------------------------------------------ +{ + my UInt $integer = $string.chars; + + my UInt @divisors = 1, $integer; + + for 2 .. $integer.sqrt.floor -> UInt $i + { + if $integer % $i == 0 + { + my UInt $j = ($integer / $i).floor; + + @divisors.push: $i; + @divisors.push: $j unless $j == $i; + } + } + + return @divisors.sort; +} + +#------------------------------------------------------------------------------ +sub USAGE() +#------------------------------------------------------------------------------ +{ + my Str $usage = $*USAGE; + + $usage ~~ s/ ($*PROGRAM-NAME) /raku $0/; + $usage.put; +} + +############################################################################## diff --git a/challenge-081/athanasius/raku/ch-2.raku b/challenge-081/athanasius/raku/ch-2.raku new file mode 100644 index 0000000000..c5d2bc7774 --- /dev/null +++ b/challenge-081/athanasius/raku/ch-2.raku @@ -0,0 +1,148 @@ +use v6d; + +############################################################################### +=begin comment + +Perl Weekly Challenge 081 +========================= + +Task #2 +------- +*Frequency Sort* + +Submitted by: Mohammad S Anwar + +You are given file named input. + +Write a script to find the frequency of all the words. + +It should print the result as first column of each line should be the frequency +of the the word followed by all the words of that frequency arranged in lexico- +graphical order. Also sort the words in the ascending order of frequency. + +INPUT file + + West Side Story + + The award-winning adaptation of the classic romantic tragedy "Romeo and + Juliet". The feuding families become two warring New York City gangs, the + white Jets led by Riff and the Latino Sharks, led by Bernardo. Their hatred + escalates to a point where neither can coexist with any form of understanding. + But when Riff's best friend (and former Jet) Tony and Bernardo's younger + sister Maria meet at a dance, no one can do anything to stop their love. Maria + and Tony begin meeting in secret, planning to run away. Then the Sharks and + Jets plan a rumble under the highway--whoever wins gains control of the + streets. Maria sends Tony to stop it, hoping it can end the violence. It goes + terribly wrong, and before the lovers know what's happened, tragedy strikes + and doesn't stop until the climactic and heartbreaking ending. + +NOTE + +For the sake of this task, please ignore the following in the input file: + + . " ( ) , 's -- + +OUTPUT + + 1 But City It Jet Juliet Latino New Romeo Side Story Their Then West York + adaptation any anything at award-winning away become before begin best classic + climactic coexist control dance do doesn't end ending escalates families + feuding form former friend gains gangs goes happened hatred heartbreaking + highway hoping in know love lovers meet meeting neither no one plan planning + point romantic rumble run secret sends sister streets strikes terribly their + two under understanding until violence warring what when where white whoever + wins with wrong younger + + 2 Bernardo Jets Riff Sharks The by it led tragedy + + 3 Maria Tony a can of stop + + 4 to + + 9 and the + +=end comment +############################################################################### + +#--------------------------------------# +# Copyright © 2020 PerlMonk Athanasius # +#--------------------------------------# + +my constant $DEFAULT-INPUT-FILE = 'WestSideStory.txt'; + +#------------------------------------------------------------------------------ +BEGIN +#------------------------------------------------------------------------------ +{ + "\nChallenge 081, Task #2: Frequency Sort (Raku)".put; +} + +##============================================================================= +sub MAIN +( + Str:D $input where *.IO.f = $DEFAULT-INPUT-FILE #= Input file name +) +##============================================================================= +{ + # (1) Read in and edit the input text + + my Str $text = $input.IO.slurp; + + # The text is first edited by replacing trailing 's and _ with spaces, then + # any remaining apostrophes are converted to underscores. This is done + # because \w matches the underscore character but not the apostrophe: which + # makes it easy to identify "words" using the zero-width assertions « and » + # that match on word boundaries (\W\w and \w\W). Note: It is not necessary + # to remove the other non-word characters [."(),] from the text, as these + # are automatically excluded by the match logic of the regex below. + + $text ~~ s:g/ \'s » / /; + $text ~~ s:g/ _ / /; + $text ~~ s:g/ \' /_/; + + # (2) Create a dictionary of words (keys) and their frequencies (values) + + my UInt %by-word; + + for $text ~~ m:g/ « (\w+?) » / -> Match $match + { + my Str $word = $match.Str; + + # Once a word has been identified, its apostrophes (if any) are + # restored, then it is recorded in the dictionary + + $word ~~ s:g/ _ /'/; + + ++%by-word{ $word }; + } + + # (3) Create a reverse dictionary of frequencies (keys) and arrays of words + # (values) + + my Array[Str] %by-freq; + + for %by-word.kv -> Str $word, UInt $freq + { + %by-freq{ $freq }.push: $word; + } + + # (4) Output frequencies (in ascending numerical order) together with their + # associated words (in ascending lexicographical order) + + for %by-freq.keys.map( { .UInt }).sort -> UInt $freq + { + "\n%d %s\n".printf: $freq, %by-freq{ $freq }.sort.join: ' '; + } +} + +#------------------------------------------------------------------------------ +sub USAGE() +#------------------------------------------------------------------------------ +{ + my Str $usage = $*USAGE; + + $usage ~~ s/ ($*PROGRAM-NAME) /raku $0/; + $usage.put; +} + +############################################################################### -- cgit From 1eb42f282637a8fcddb97ceb1df1818b92513626 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sat, 10 Oct 2020 20:34:20 +0100 Subject: - Added solutions by Athanasius. --- stats/pwc-current.json | 239 +++--- stats/pwc-language-breakdown-summary.json | 66 +- stats/pwc-language-breakdown.json | 1206 ++++++++++++++--------------- stats/pwc-leaders.json | 434 +++++------ stats/pwc-summary-1-30.json | 110 +-- stats/pwc-summary-121-150.json | 38 +- stats/pwc-summary-151-180.json | 44 +- stats/pwc-summary-181-210.json | 36 +- stats/pwc-summary-31-60.json | 110 +-- stats/pwc-summary-61-90.json | 46 +- stats/pwc-summary-91-120.json | 38 +- stats/pwc-summary.json | 440 +++++------ 12 files changed, 1413 insertions(+), 1394 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 1f081181fc..ef85f7923f 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,31 +1,49 @@ { - "chart" : { - "type" : "column" + "xAxis" : { + "type" : "category" + }, + "subtitle" : { + "text" : "[Champions: 24] Last updated at 2020-10-10 19:34:00 GMT" + }, + "title" : { + "text" : "Perl Weekly Challenge - 081" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } }, "series" : [ { - "name" : "Perl Weekly Challenge - 081", - "colorByPoint" : 1, "data" : [ { "drilldown" : "Andinus", - "y" : 4, - "name" : "Andinus" + "name" : "Andinus", + "y" : 4 + }, + { + "drilldown" : "Athanasius", + "name" : "Athanasius", + "y" : 4 }, { - "name" : "Dave Jacoby", "y" : 2, + "name" : "Dave Jacoby", "drilldown" : "Dave Jacoby" }, { + "name" : "E. Choroba", "y" : 2, - "drilldown" : "E. Choroba", - "name" : "E. Choroba" + "drilldown" : "E. Choroba" }, { + "drilldown" : "Flavio Poletti", "name" : "Flavio Poletti", - "y" : 4, - "drilldown" : "Flavio Poletti" + "y" : 4 }, { "name" : "James Smith", @@ -33,19 +51,19 @@ "drilldown" : "James Smith" }, { + "drilldown" : "Jorg Sommrey", "name" : "Jorg Sommrey", - "y" : 2, - "drilldown" : "Jorg Sommrey" + "y" : 2 }, { + "y" : 2, "name" : "Jose Luis", - "drilldown" : "Jose Luis", - "y" : 2 + "drilldown" : "Jose Luis" }, { + "drilldown" : "Julio de Castro", "name" : "Julio de Castro", - "y" : 4, - "drilldown" : "Julio de Castro" + "y" : 4 }, { "drilldown" : "Kang-min Liu", @@ -54,53 +72,53 @@ }, { "name" : "Lars Thegler", - "drilldown" : "Lars Thegler", - "y" : 2 + "y" : 2, + "drilldown" : "Lars Thegler" }, { "y" : 2, - "drilldown" : "Lubos Kolouch", - "name" : "Lubos Kolouch" + "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch" }, { - "drilldown" : "Mark Anderson", "y" : 2, - "name" : "Mark Anderson" + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson" }, { - "drilldown" : "Markus Holzer", + "name" : "Markus Holzer", "y" : 2, - "name" : "Markus Holzer" + "drilldown" : "Markus Holzer" }, { - "name" : "Mohammad S Anwar", "y" : 1, + "name" : "Mohammad S Anwar", "drilldown" : "Mohammad S Anwar" }, { "y" : 6, - "drilldown" : "Myoungjin Jeon", - "name" : "Myoungjin Jeon" + "name" : "Myoungjin Jeon", + "drilldown" : "Myoungjin Jeon" }, { + "drilldown" : "Niels van Dijke", "name" : "Niels van Dijke", - "y" : 2, - "drilldown" : "Niels van Dijke" + "y" : 2 }, { "y" : 2, - "drilldown" : "Nuno Vieira", - "name" : "Nuno Vieira" + "name" : "Nuno Vieira", + "drilldown" : "Nuno Vieira" }, { - "y" : 2, "drilldown" : "Pete Houston", + "y" : 2, "name" : "Pete Houston" }, { "drilldown" : "Roger Bell_West", - "y" : 5, - "name" : "Roger Bell_West" + "name" : "Roger Bell_West", + "y" : 5 }, { "name" : "Shawn Wagner", @@ -109,24 +127,31 @@ }, { "name" : "Simon Green", - "drilldown" : "Simon Green", - "y" : 3 + "y" : 3, + "drilldown" : "Simon Green" }, { - "y" : 2, "drilldown" : "Simon Proctor", + "y" : 2, "name" : "Simon Proctor" }, { - "name" : "Ulrich Rieke", "drilldown" : "Ulrich Rieke", - "y" : 2 + "y" : 2, + "name" : "Ulrich Rieke" } - ] + ], + "name" : "Perl Weekly Challenge - 081", + "colorByPoint" : 1 } ], - "legend" : { - "enabled" : 0 + "chart" : { + "type" : "column" + }, + "tooltip" : { + "followPointer" : 1, + "headerFormat" : "{series.name}
", + "pointFormat" : "{point.name}: {point.y:f}
" }, "drilldown" : { "series" : [ @@ -145,26 +170,41 @@ "name" : "Andinus" }, { - "name" : "Dave Jacoby", - "id" : "Dave Jacoby", "data" : [ [ "Perl", 2 + ], + [ + "Raku", + 2 ] - ] + ], + "id" : "Athanasius", + "name" : "Athanasius" }, { - "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], - "name" : "E. Choroba" + "id" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { + "id" : "E. Choroba", + "name" : "E. Choroba", + "data" : [ + [ + "Perl", + 2 + ] + ] }, { + "id" : "Flavio Poletti", "name" : "Flavio Poletti", "data" : [ [ @@ -175,28 +215,27 @@ "Blog", 2 ] - ], - "id" : "Flavio Poletti" + ] }, { + "id" : "James Smith", + "name" : "James Smith", "data" : [ [ "Perl", 2 ] - ], - "id" : "James Smith", - "name" : "James Smith" + ] }, { + "id" : "Jorg Sommrey", + "name" : "Jorg Sommrey", "data" : [ [ "Perl", 2 ] - ], - "id" : "Jorg Sommrey", - "name" : "Jorg Sommrey" + ] }, { "data" : [ @@ -205,11 +244,10 @@ 2 ] ], - "id" : "Jose Luis", - "name" : "Jose Luis" + "name" : "Jose Luis", + "id" : "Jose Luis" }, { - "name" : "Julio de Castro", "data" : [ [ "Perl", @@ -220,16 +258,17 @@ 2 ] ], - "id" : "Julio de Castro" + "id" : "Julio de Castro", + "name" : "Julio de Castro" }, { - "id" : "Kang-min Liu", "data" : [ [ "Raku", 2 ] ], + "id" : "Kang-min Liu", "name" : "Kang-min Liu" }, { @@ -243,28 +282,28 @@ "name" : "Lars Thegler" }, { - "name" : "Lubos Kolouch", "data" : [ [ "Perl", 2 ] ], + "name" : "Lubos Kolouch", "id" : "Lubos Kolouch" }, { - "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson" + "name" : "Mark Anderson", + "id" : "Mark Anderson" }, { - "name" : "Markus Holzer", "id" : "Markus Holzer", + "name" : "Markus Holzer", "data" : [ [ "Raku", @@ -273,17 +312,18 @@ ] }, { - "name" : "Mohammad S Anwar", - "id" : "Mohammad S Anwar", "data" : [ [ "Perl", 1 ] - ] + ], + "name" : "Mohammad S Anwar", + "id" : "Mohammad S Anwar" }, { "id" : "Myoungjin Jeon", + "name" : "Myoungjin Jeon", "data" : [ [ "Perl", @@ -297,42 +337,39 @@ "Blog", 2 ] - ], - "name" : "Myoungjin Jeon" + ] }, { "name" : "Niels van Dijke", + "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ], - "id" : "Niels van Dijke" + ] }, { - "name" : "Nuno Vieira", - "id" : "Nuno Vieira", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Nuno Vieira", + "id" : "Nuno Vieira" }, { - "name" : "Pete Houston", - "id" : "Pete Houston", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Pete Houston", + "name" : "Pete Houston" }, { - "name" : "Roger Bell_West", - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -346,20 +383,21 @@ "Blog", 1 ] - ] + ], + "id" : "Roger Bell_West", + "name" : "Roger Bell_West" }, { + "id" : "Shawn Wagner", "name" : "Shawn Wagner", "data" : [ [ "Perl", 2 ] - ], - "id" : "Shawn Wagner" + ] }, { - "id" : "Simon Green", "data" : [ [ "Perl", @@ -370,20 +408,20 @@ 1 ] ], - "name" : "Simon Green" + "name" : "Simon Green", + "id" : "Simon Green" }, { - "id" : "Simon Proctor", "data" : [ [ "Raku", 2 ] ], - "name" : "Simon Proctor" + "name" : "Simon Proctor", + "id" : "Simon Proctor" }, { - "id" : "Ulrich Rieke", "data" : [ [ "Perl", @@ -394,32 +432,13 @@ 1 ] ], + "id" : "Ulrich Rieke", "name" : "Ulrich Rieke" } ] }, - "xAxis" : { - "type" : "category" - }, - "tooltip" : { - "followPointer" : 1, - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "title" : { - "text" : "Perl Weekly Challenge - 081" - }, - "subtitle" : { - "text" : "[Champions: 23] Last updated at 2020-10-09 10:50:47 GMT" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } + "legend" : { + "enabled" : 0 }, "yAxis" : { "title" : { diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 9300755ce1..6a9703584b 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,18 +1,34 @@ { "yAxis" : { - "min" : 0, "title" : { "text" : null - } + }, + "min" : 0 }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + "legend" : { + "enabled" : "false" }, - "subtitle" : { - "text" : "Last updated at 2020-10-09 10:50:47 GMT" + "tooltip" : { + "pointFormat" : "{point.y:.0f}" + }, + "chart" : { + "type" : "column" }, "series" : [ { + "name" : "Contributions", + "dataLabels" : { + "y" : 10, + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + }, + "color" : "#FFFFFF", + "format" : "{point.y:.0f}", + "align" : "right", + "rotation" : -90, + "enabled" : "true" + }, "data" : [ [ "Blog", @@ -20,44 +36,28 @@ ], [ "Perl", - 3497 + 3499 ], [ "Raku", - 2237 + 2239 ] - ], - "name" : "Contributions", - "dataLabels" : { - "y" : 10, - "format" : "{point.y:.0f}", - "align" : "right", - "color" : "#FFFFFF", - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "enabled" : "true", - "rotation" : -90 - } + ] } ], - "legend" : { - "enabled" : "false" + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, - "chart" : { - "type" : "column" + "subtitle" : { + "text" : "Last updated at 2020-10-10 19:34:00 GMT" }, "xAxis" : { + "type" : "category", "labels" : { "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" } - }, - "type" : "category" - }, - "tooltip" : { - "pointFormat" : "{point.y:.0f}" + } } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 9f75228e49..108bda7f94 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,426 +1,16 @@ { - "chart" : { - "type" : "column" - }, - "series" : [ - { - "name" : "Perl Weekly Challenge Languages", - "data" : [ - { - "y" : 144, - "drilldown" : "001", - "name" : "#001" - }, - { - "name" : "#002", - "y" : 113, - "drilldown" : "002" - }, - { - "name" : "#003", - "drill