From 19e0735e7ba137750237e2e0ca905d12aaa8cdc5 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 08:18:22 +0200 Subject: Task 1 done --- challenge-216/luca-ferrari/raku/ch-1.p6 | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 challenge-216/luca-ferrari/raku/ch-1.p6 diff --git a/challenge-216/luca-ferrari/raku/ch-1.p6 b/challenge-216/luca-ferrari/raku/ch-1.p6 new file mode 100644 index 0000000000..bdef28ee4d --- /dev/null +++ b/challenge-216/luca-ferrari/raku/ch-1.p6 @@ -0,0 +1,25 @@ +#!raku + +# +# Perl Weekly Challenge 216 +# Task 1 +# +# See +# + +sub MAIN( *@strings is copy ) { + my @registration-code = @strings.pop.comb; + + # first implementation + for @strings -> $word { + my @result.push: @registration-code.grep( $_ ) for $word.comb; + say $word if @result.join ~~ $word; + } + + # second implementation + my $sorted-registration-code = @registration-code.sort.join; + for @strings -> $word { + say $word if ( $sorted-registration-code ~~ / ^ { $word.comb.sort.join } / ); + } + +} -- cgit From 9318b7bed015211d743f030caeccd84dd533a2fe Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 09:15:28 +0200 Subject: Task2 done --- challenge-216/luca-ferrari/raku/ch-2.p6 | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 challenge-216/luca-ferrari/raku/ch-2.p6 diff --git a/challenge-216/luca-ferrari/raku/ch-2.p6 b/challenge-216/luca-ferrari/raku/ch-2.p6 new file mode 100644 index 0000000000..9544e801f6 --- /dev/null +++ b/challenge-216/luca-ferrari/raku/ch-2.p6 @@ -0,0 +1,34 @@ +#!raku + +# +# Perl Weekly Challenge 216 +# Task 2 +# +# See +# + +sub MAIN( *@strings is copy ) { + my $letters = BagHash.new: @strings.pop.comb; + my %stickers; + my $loop = 0; + + while ( $letters.values.grep( * >= 1 ) ) { + $loop++; + + for $letters.keys -> $needle { + next if ! $letters{ $needle }; + my $found = False; + for @strings -> $word { + if ( $word.comb.grep( $needle ) ) { + $letters{ $needle }--; + %stickers{ $word }{ $loop }.push: $needle; + $found = True; + } + } + + say "Cannot find $needle in any word!" and exit if ! $found; + } + } + + "$_ used { %stickers{ $_ }.keys.elems } times".say for %stickers.keys; +} -- cgit From 225504876e6d28b67ed457544cdabf3dd812e0b8 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 09:38:38 +0200 Subject: Task 1 plperl done --- challenge-216/luca-ferrari/postgresql/ch-1.plperl | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-216/luca-ferrari/postgresql/ch-1.plperl diff --git a/challenge-216/luca-ferrari/postgresql/ch-1.plperl b/challenge-216/luca-ferrari/postgresql/ch-1.plperl new file mode 100644 index 0000000000..e254eb6d7b --- /dev/null +++ b/challenge-216/luca-ferrari/postgresql/ch-1.plperl @@ -0,0 +1,26 @@ +-- +-- Perl Weekly Challenge 216 +-- Task 1 +-- See +-- + +CREATE SCHEMA IF NOT EXISTS pwc216; + +CREATE OR REPLACE FUNCTION +pwc216.task1_plperl( text, text[]) +RETURNS SETOF text +AS $CODE$ + my ( $registration_code, $strings ) = @_; + for my $word ( $strings->@* ) { + my $matches = 0; + for my $needle ( split( //, $word ) ) { + $matches++ if ( grep( { $needle eq $_ } split( //, $registration_code ) ) ); + } + + return_next( $word ) if ( $matches == length( $word ) ); + } + +return undef; + +$CODE$ +LANGUAGE plperl; -- cgit From 6c57247b72e69defedabf3d79baf38dec58416ec Mon Sep 17 00:00:00 2001 From: Mark <53903062+andemark@users.noreply.github.com> Date: Mon, 8 May 2023 08:10:27 +0000 Subject: Challenge 216 Solutions (Raku) --- challenge-216/mark-anderson/raku/ch-1.raku | 12 ++++++++++++ challenge-216/mark-anderson/raku/ch-2.raku | 26 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 challenge-216/mark-anderson/raku/ch-1.raku create mode 100644 challenge-216/mark-anderson/raku/ch-2.raku diff --git a/challenge-216/mark-anderson/raku/ch-1.raku b/challenge-216/mark-anderson/raku/ch-1.raku new file mode 100644 index 0000000000..135b6a47c2 --- /dev/null +++ b/challenge-216/mark-anderson/raku/ch-1.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku +use Test; + +is-deeply reg-num(, "AB1 2CD"), ("abcd",); +is-deeply reg-num(, "007 JB"), ; +is-deeply reg-num(, "C7 RA2"), ; + +sub reg-num($words, $reg) +{ + my $r = $reg.comb(//)>>.lc; + $words.Slip.grep({ .comb (>=) $r }) +} diff --git a/challenge-216/mark-anderson/raku/ch-2.raku b/challenge-216/mark-anderson/raku/ch-2.raku new file mode 100644 index 0000000000..ca3cbd6f42 --- /dev/null +++ b/challenge-216/mark-anderson/raku/ch-2.raku @@ -0,0 +1,26 @@ +#!/usr/bin/env raku +use Test; + +is word-stickers(, ), 2; +is word-stickers(, ), 3; +is word-stickers(, ), 4; +is word-stickers(, ), 0; +is word-stickers(, ), 1; +is word-stickers(, ), 18; +is word-stickers(, ), 12; +is word-stickers(, ), 15; + +sub word-stickers($s, $w) +{ + return 0 if $w.comb (-) $s.comb(//); + + my @stickers = $s>>.comb>>.Bag; + my $word = $w.comb.BagHash; + + .elems given gather while $word + { + my $i = @stickers.map({ ($_ (&) $word).total }).maxpairs.head.key + andthen .take; + $word.remove(@stickers[$i].kxxv) + } +} -- cgit From 3466eb55a5bb931e95ef764861b6aa29fd2a7095 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 10:31:58 +0200 Subject: Task 2 plperl --- challenge-216/luca-ferrari/postgresql/ch-2.plperl | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 challenge-216/luca-ferrari/postgresql/ch-2.plperl diff --git a/challenge-216/luca-ferrari/postgresql/ch-2.plperl b/challenge-216/luca-ferrari/postgresql/ch-2.plperl new file mode 100644 index 0000000000..5316537322 --- /dev/null +++ b/challenge-216/luca-ferrari/postgresql/ch-2.plperl @@ -0,0 +1,50 @@ +-- +-- Perl Weekly Challenge 216 +-- Task 2 +-- See +-- + +CREATE SCHEMA IF NOT EXISTS pwc216; + +CREATE OR REPLACE FUNCTION +pwc216.task2_plperl( text, text[] ) +RETURNS TABLE ( sticker text, run int, letter text ) +AS $CODE$ + my ( $needle, $words ) = @_; + my $searching_for = {}; + + # create the bag + for ( split //, $needle ) { + $searching_for->{ $_ }++; + } + + elog(INFO, "Valori? " . grep( { $_ >= 1 } values( $searching_for->%* ) ) ); + my $run = 0; + while ( grep( { $_ >= 1 } values( $searching_for->%* ) ) ) { + $run++; + my $found = 0; + + for my $letter ( keys $searching_for->%* ) { + next if ! $searching_for->{ $letter }; + for my $word ( $words->@* ) { + if ( grep( { $_ eq $letter } split( //, $word ) ) ) { + $searching_for->{ $letter }--; + return_next( { run => $run, sticker => $word, letter => $letter } ); + $found++; + last; + } + } + + + } + + if ( ! $found ) { + elog(INFO, "Cannot find match with letter $letter in any word!" ); + return undef; + } + } + +return undef; + +$CODE$ +LANGUAGE plperl; -- cgit From aa4c667437e5674d217fc9f008ad2430a3caece1 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 10:54:32 +0200 Subject: Task 1 plpgsql --- challenge-216/luca-ferrari/postgresql/ch-1.sql | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 challenge-216/luca-ferrari/postgresql/ch-1.sql diff --git a/challenge-216/luca-ferrari/postgresql/ch-1.sql b/challenge-216/luca-ferrari/postgresql/ch-1.sql new file mode 100644 index 0000000000..b929a9a3fb --- /dev/null +++ b/challenge-216/luca-ferrari/postgresql/ch-1.sql @@ -0,0 +1,33 @@ +-- +-- Perl Weekly Challenge 216 +-- Task 1 +-- +-- See +-- + +CREATE SCHEMA IF NOT EXISTS pwc216; + +CREATE OR REPLACE FUNCTION +pwc216.task1_plpgsql( rc text, strings text[] ) +RETURNS SETOF TEXT +AS $CODE$ +DECLARE + current_word text; + matches int; +BEGIN + FOREACH current_word IN ARRAY strings LOOP + SELECT count(*) + INTO matches + FROM regexp_split_to_table( rc, '' ) r + , regexp_split_to_table( current_word, '' ) w + WHERE r = w; + + IF matches = length( current_word ) THEN + RETURN NEXT current_word; + END IF; + END LOOP; + +RETURN; +END +$CODE$ +LANGUAGE plpgsql; -- cgit From a6a67dc89ec8bd9cc6a008e1dc953b57778c265a Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 11:10:31 +0200 Subject: Task 2 plpgsql done --- challenge-216/luca-ferrari/postgresql/ch-2.plperl | 1 - challenge-216/luca-ferrari/postgresql/ch-2.sql | 67 +++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 challenge-216/luca-ferrari/postgresql/ch-2.sql diff --git a/challenge-216/luca-ferrari/postgresql/ch-2.plperl b/challenge-216/luca-ferrari/postgresql/ch-2.plperl index 5316537322..de9b5baafd 100644 --- a/challenge-216/luca-ferrari/postgresql/ch-2.plperl +++ b/challenge-216/luca-ferrari/postgresql/ch-2.plperl @@ -18,7 +18,6 @@ AS $CODE$ $searching_for->{ $_ }++; } - elog(INFO, "Valori? " . grep( { $_ >= 1 } values( $searching_for->%* ) ) ); my $run = 0; while ( grep( { $_ >= 1 } values( $searching_for->%* ) ) ) { $run++; diff --git a/challenge-216/luca-ferrari/postgresql/ch-2.sql b/challenge-216/luca-ferrari/postgresql/ch-2.sql new file mode 100644 index 0000000000..ceca3277e2 --- /dev/null +++ b/challenge-216/luca-ferrari/postgresql/ch-2.sql @@ -0,0 +1,67 @@ +-- +-- Perl Weekly Challenge 216 +-- Task 2 +-- +-- See +-- + +CREATE SCHEMA IF NOT EXISTS pwc216; + +CREATE OR REPLACE FUNCTION +pwc216.task2_plpgsql( word text, stickers text[] ) +RETURNS TABLE ( sticker text, run int, letter text ) +AS $CODE$ +DECLARE + cl text; + current_sticker text; + m int; +BEGIN + CREATE TEMPORARY TABLE IF NOT EXISTS letters( l text, c int DEFAULT 1, s text ); + TRUNCATE letters; + + INSERT INTO letters( l, c ) + SELECT ll, count(*) + FROM regexp_split_to_table( word, '' ) ll + GROUP BY ll; + + FOUND := true; + run := 0; + WHILE FOUND LOOP + run := run + 1; + + PERFORM count(*) + FROM letters + WHERE c > 0; + + IF NOT FOUND THEN + RETURN; + END IF; + + FOR cl IN SELECT l FROM letters WHERE c > 0 LOOP + FOREACH current_sticker IN ARRAY stickers LOOP + SELECT count(*) + INTO m + FROM regexp_split_to_table( current_sticker, '' ) s + WHERE s = cl; + + + IF m <= 0 THEN + CONTINUE; + END IF; + + UPDATE letters + SET c = c - m + , s = s || ', ' || current_sticker; + + sticker := current_sticker; + letter := cl; + + RETURN NEXT; + EXIT; + END LOOP; + END LOOP; + END LOOP; + +END +$CODE$ +LANGUAGE plpgsql; -- cgit From a968331f2dff08bab0825c6137148a6d3a12ad39 Mon Sep 17 00:00:00 2001 From: Luca Ferrari Date: Mon, 8 May 2023 11:52:21 +0200 Subject: Blog references --- challenge-216/luca-ferrari/blog-1.txt | 1 + challenge-216/luca-ferrari/blog-2.txt | 1 + challenge-216/luca-ferrari/blog-3.txt | 1 + challenge-216/luca-ferrari/blog-4.txt | 1 + challenge-216/luca-ferrari/blog-5.txt | 1 + challenge-216/luca-ferrari/blog-6.txt | 1 + 6 files changed, 6 insertions(+) create mode 100644 challenge-216/luca-ferrari/blog-1.txt create mode 100644 challenge-216/luca-ferrari/blog-2.txt create mode 100644 challenge-216/luca-ferrari/blog-3.txt create mode 100644 challenge-216/luca-ferrari/blog-4.txt create mode 100644 challenge-216/luca-ferrari/blog-5.txt create mode 100644 challenge-216/luca-ferrari/blog-6.txt diff --git a/challenge-216/luca-ferrari/blog-1.txt b/challenge-216/luca-ferrari/blog-1.txt new file mode 100644 index 0000000000..bc60db2e40 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-1.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task1 diff --git a/challenge-216/luca-ferrari/blog-2.txt b/challenge-216/luca-ferrari/blog-2.txt new file mode 100644 index 0000000000..a17a747527 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-2.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task2 diff --git a/challenge-216/luca-ferrari/blog-3.txt b/challenge-216/luca-ferrari/blog-3.txt new file mode 100644 index 0000000000..e26b6dc467 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-3.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task1plperl diff --git a/challenge-216/luca-ferrari/blog-4.txt b/challenge-216/luca-ferrari/blog-4.txt new file mode 100644 index 0000000000..8d03a8fda7 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-4.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task2plperl diff --git a/challenge-216/luca-ferrari/blog-5.txt b/challenge-216/luca-ferrari/blog-5.txt new file mode 100644 index 0000000000..2aeb4b3370 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-5.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task1plpgsql diff --git a/challenge-216/luca-ferrari/blog-6.txt b/challenge-216/luca-ferrari/blog-6.txt new file mode 100644 index 0000000000..de0f0ae486 --- /dev/null +++ b/challenge-216/luca-ferrari/blog-6.txt @@ -0,0 +1 @@ +https://fluca1978.github.io/2023/05/08/PerlWeeklyChallenge216.html#task2plpgsql -- cgit From 21822c27d35f4472b29174740f233cc1378827b5 Mon Sep 17 00:00:00 2001 From: Leo Manfredi Date: Mon, 8 May 2023 14:08:23 +0000 Subject: Perl and Python Solutions for Task #1 --- challenge-216/manfredi/perl/ch-1.pl | 50 +++++++++++++++++++++++++++++++++++ challenge-216/manfredi/python/ch-1.py | 39 +++++++++++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100755 challenge-216/manfredi/perl/ch-1.pl create mode 100755 challenge-216/manfredi/python/ch-1.py diff --git a/challenge-216/manfredi/perl/ch-1.pl b/challenge-216/manfredi/perl/ch-1.pl new file mode 100755 index 0000000000..9bcf6ef831 --- /dev/null +++ b/challenge-216/manfredi/perl/ch-1.pl @@ -0,0 +1,50 @@ +#!/usr/bin/env perl + +use v5.36; + +say "challenge-216-task1"; + +# Task 1: Registration Number +# You are given a list of words and a random registration number. +# Write a script to find all the words in the given list that has every letter in the given registration number. + +# Example 1 +# Input: @words = ('abc', 'abcd', 'bcd'), $reg = 'AB1 2CD' +# Output: ('abcd') + +# Example 2 +# Input: @words = ('job', 'james', 'bjorg'), $reg = '007 JB' +# Output: ('job', 'bjorg') + +# Example 3 +# Input: @words = ('crack', 'road', 'rac'), $reg = 'C7 RA2' +# Output: ('crack', 'rac') + +sub registration_number { + my $reg = shift; + my @words = @{+shift}; + my @out = (); + say "Input: \@words = (@words) , \$reg = '$reg'"; + my %hreg = (); + my @hreg = grep { /[a-z]/ } split //, lc $reg; + $hreg{$_} = 1 for @hreg; + for my $word (@words) { + my %hword = (); + $hword{$_} = 1 for (split //, lc $word); + my @i = grep { exists $hreg{$_} } keys %hword; + push @out, $word if $#i == $#hreg; + } + say "Output: (@out)\n"; +} + +while () { + chomp; + my ($reg, @words) = split ','; + registration_number($reg, \@words); +} + + +__DATA__ +AB1 2CD,abc,abcd,bcd +007 JB,job,james,bjorg +C7 RA2,crack,road,rac diff --git a/challenge-216/manfredi/python/ch-1.py b/challenge-216/manfredi/python/ch-1.py new file mode 100755 index 0000000000..fcee0dbc5d --- /dev/null +++ b/challenge-216/manfredi/python/ch-1.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# Python 3.9.2 on Debian GNU/Linux 11 (bullseye) + +print('challenge-216-task1') + +# Task 1: Registration Number +# You are given a list of words and a random registration number. +# Write a script to find all the words in the given list that has every letter in the given registration number. + +# Example 1 +# Input: @words = ('abc', 'abcd', 'bcd'), $reg = 'AB1 2CD' +# Output: ('abcd') + +# Example 2 +# Input: @words = ('job', 'james', 'bjorg'), $reg = '007 JB' +# Output: ('job', 'bjorg') + +# Example 3 +# Input: @words = ('crack', 'road', 'rac'), $reg = 'C7 RA2' +# Output: ('crack', 'rac') + +def registration_number(reg: str, words: list[str]) -> list[str]: + out = [] + print(f"Input: words = ({words}), reg = '{reg}'") + r = set( [ i for i in reg.lower() if i.isalpha() ]) + for word in words: + w = set(word.lower()) + if r.issubset(w): out.append(word) + return out + + +def main(): + print("Output: ", registration_number('AB1 2CD', ['abc', 'abcd', 'bcd']), "\n") + print("Output: ", registration_number('007 JB', ['job', 'james', 'bjorg']), "\n") + print("Output: ", registration_number('C7 RA2', ['crack', 'road', 'rac']), "\n") + + +if __name__ == '__main__': + main() -- cgit From fe1428043b97c65bc87d9a68a10defb68d86f620 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 00:08:53 +0100 Subject: Create ch-1.pl --- challenge-216/james-smith/perl/ch-1.pl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 challenge-216/james-smith/perl/ch-1.pl diff --git a/challenge-216/james-smith/perl/ch-1.pl b/challenge-216/james-smith/perl/ch-1.pl new file mode 100644 index 0000000000..46a4379d72 --- /dev/null +++ b/challenge-216/james-smith/perl/ch-1.pl @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use feature qw(say); +use Test::More; +use Benchmark qw(cmpthese); + +my @TESTS = ( + [ ['AB1 2CD', qw(abc abcd bcd )], 'abcd' ], + [ ['007 JB', qw(job james bjorg)], 'job bjorg' ], + [ ['C7 RA2', qw(crack road rac )], 'crack rac' ], +); + +sub reg_number { + my (%l,%x) = map { /[a-z]/ ? ($_=>1) : () } + split //, + lc + shift; + grep { + %x=%l; + delete $x{$_} for split//; + !%x; + } @_ +} + +is( "@{[ reg_number( @{$_->[0]} ) ]}", $_->[1] ) for @TESTS1; +done_testing(); -- cgit From 72733d3f1f0feb438d74edbca4073bf8874b9345 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 00:10:01 +0100 Subject: Create ch-2.pl --- challenge-216/james-smith/perl/ch-2.pl | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 challenge-216/james-smith/perl/ch-2.pl diff --git a/challenge-216/james-smith/perl/ch-2.pl b/challenge-216/james-smith/perl/ch-2.pl new file mode 100644 index 0000000000..62fa4d7a69 --- /dev/null +++ b/challenge-216/james-smith/perl/ch-2.pl @@ -0,0 +1,58 @@ +#!/usr/local/bin/perl + +use strict; +use warnings; +use feature qw(say); +use Test::More; +use Benchmark qw(cmpthese); + +my @TESTS = ( + [ [qw(peon perl raku python)], 2 ], + [ [qw(goat love hate angry )], 3 ], + [ [qw(accommodation come nation delta )], 4 ], + [ [qw(accommodation come country delta )], 0 ], +); + +sub word_stickers { + my( %f, %s, $k, $n, $l, $x ); + $f{$_}++ for split //, shift; + my @q = [ 1, 0, my %t = %f ]; + map { delete $t{$_} } split // for @_; + return 0 if keys %t; + while( ( $n, $l, %f ) = @{ shift @q } ) { + push @q, map { + $x = 0, %t = %f; + exists $t{$_} && ( $x=1, --$t{$_} || delete $t{$_} ) + for split//, $_[$_]; + !%t ? return $n : $x ? [ $n+1, $_, %t ] : () + } $l..$#_; + } +} + +is( word_stickers( @{$_->[0]} ) , $_->[1] ) for @TESTS2; +done_testing(); + +sub word_stickers_with_comments { + my( %f, %s, $k, $n, $l, $x ); + $f{$_}++ for split //, shift; # count for letters + my %t = %f; # Check all letters on stickers + # Initialise queue - no stickers, initial freq. + my @q = [ 1, 0, my %t = %f ]; # Check can solve? + map { delete $t{$_} } split // for @_; + return 0 if keys %t; # if not return 0 + my @q = [ 1, 0, %f ]; # [ $no+1, $last, %freqs ] + while( ($n,$l,%f) = @{ shift @q } ) { + push @q, map { + # Make copy of frequencies, set flag ($x) + # true once we use a letter on sticker, + # remove letters we have used up + $x = 0, %t = %f; + exists $t{$_} && ( $x=1, --$t{$_} || delete $t{$_} ) + for split//, $_[$_]; + # If none left return $n OR push entry onto + # queue, increasing count and setting new last + !%t ? return $n : $x ? [ $n+1, $_, %t ] : () + # Loop from last used to remove duplicates + } $l..$#_; + } +} -- cgit From cfdfbe98a7960255f7c6e4aeb9d7dff5d9189bdb Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 00:21:37 +0100 Subject: Update ch-1.pl --- challenge-216/james-smith/perl/ch-1.pl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/challenge-216/james-smith/perl/ch-1.pl b/challenge-216/james-smith/perl/ch-1.pl index 46a4379d72..ecaaa24257 100644 --- a/challenge-216/james-smith/perl/ch-1.pl +++ b/challenge-216/james-smith/perl/ch-1.pl @@ -24,5 +24,6 @@ sub reg_number { } @_ } -is( "@{[ reg_number( @{$_->[0]} ) ]}", $_->[1] ) for @TESTS1; +is( "@{[ reg_number( @{$_->[0]} ) ]}", $_->[1] ) for @TESTS; + done_testing(); -- cgit From 111a80fe927d2d0596fa6a4ea2aed024f37103c4 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 01:28:36 +0100 Subject: Update README.md --- challenge-216/james-smith/README.md | 125 ++++++++++++++++++------------------ 1 file changed, 63 insertions(+), 62 deletions(-) diff --git a/challenge-216/james-smith/README.md b/challenge-216/james-smith/README.md index 12dc6c8035..1518a7f6e6 100644 --- a/challenge-216/james-smith/README.md +++ b/challenge-216/james-smith/README.md @@ -1,7 +1,7 @@ -[< Previous 214](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-214/james-smith) | -[Next 216 >](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-216/james-smith) +[< Previous 215](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-215/james-smith) | +[Next 217 >](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-217/james-smith) -# The Weekly Challenge 215 +# The Weekly Challenge 216 You can find more information about this weeks, and previous weeks challenges at: @@ -13,84 +13,85 @@ submit solutions in whichever language you feel comfortable with. You can find the solutions here on github at: -https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-215/james-smith +https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-216/james-smith -# TASK #1: Odd one Out +# TASK #1: Registration Number -***You are given a list of words (alphabetic characters only) of same size. Write a script to remove all words not sorted alphabetically and print the number of words in the list that are not alphabetically sorted.*** +***You are given a list of words and a random registration number. Write a script to find all the words in the given list that has every letter in the given registration number.*** ## Solution -To solve this problem we loop though each string to make sure the letters in alphabetical order. - -We note that if the words are 1 character long then they will be default in alphabetical order so we return 0. - -Looping through the letters - we just see if one is greater than or equal to the previous one - if it isn't we update the counter and move on to the next word. - -Note we use a ternary to replace this `if`/`else` for compactness. - -```perl -sub non_alpha { - return 0 if length $_[0] <2; - my($c,$f)=0; - for(@_) { - $f=''; - $f gt $_ ? ($c++,last) : ($f=$_) for split //; - } - $c -} -``` - -We can compact this by converting the inner `for` into a `map` - note the `last` was on the inner loop - and is the same as a `next` on the outer loop... So here we have to now use `next` not `laat` - ```perl -sub non_alpha_compact { - return 0 if length $_[0] <2; - my($c,$f)=0; - $f='', map { $f gt $_ ? ($c++,next) : ($f=$_) } split // for @_; - $c +sub reg_number { + my (%l,%x) = map { /[a-z]/ ? ($_=>1) : () } + split //, + lc + shift; + grep { + %x=%l; + delete $x{$_} for split//; + !%x + } @_ } ``` -# TASK #2: Number Placement +Firstly we get a list of the lower-cased letters in the number plate. Then for each word in turn we: + * copy this hash into a temporary hash; + * remove any letters from hash which rea in the word; + * Check to see if the hash is now empty - if it is we include the word. -***You are given a list of numbers having just 0 and 1. You are also given placement count (>=1). Write a script to find out if it is possible to replace 0 with 1 in the given list. The only condition is that you can only replace when there is no 1 on either side. Print 1 if it is possible otherwise 0.*** +# TASK #2: Word Stickers -*Question - there are two intepretations o the question - whether the placements are done simultaneously or one after the other* - -*In the former case any run of 3+ zeros can have `n-2` updates, but if it is the former it `(n-1)/2` +***You are given a list of word stickers and a target word. Write a script to find out how many word stickers is needed to make up the given target word.*** ## Solution -Both solutions are the same except for the calculation at the heart to compute the count. +Interestingly this task uses the trick - copy hash and delete elements - within it's core. -We loop through the numbers if we see a 1 we check to see how many previous 0's we've had and compute the number of insertions. If it is 0 we increment the count of 0's in a row. Note to make sure we include any last sequence of 0's we add a 1 on to the end of the list we are search. +We note: + * We are looking for fewest stickers - well this suggests a solution based on a queue as we want to do a depth based search. ```perl -sub insert_zero { - my($s,$c) = (0,shift); - $_ ? ( $c-= $s>2 && int(($s-1)/2), $s=0 ) : $s++ for @_,1; - $c>0?0:1; -} - -sub insert_zero_simultaneous { - my($s,$c) = (0,shift); - $_ ? ( $c-= $s>2 && $s-2, $s=0 ) : $s++ for @_,1; - $c>0?0:1 +sub word_stickers { + my( %f, %s, $n, $l, $x ); + $f{$_}++ for split //, shift; + my @q = [ 1, 0, my %t = %f ]; + map { delete $t{$_} } split // for @_; + return 0 if keys %t; + while( ( $n, $l, %f ) = @{ shift @q } ) { + push @q, map { + $x = 0, %t = %f; + exists $t{$_} && ( $x=1, --$t{$_} || delete $t{$_} ) + for split//, $_[$_]; + !%t ? return $n : $x ? [ $n+1, $_, %t ] : () + } $l..$#_; + } } ``` -We can get some performance improvements by short cutting the loop, by checking the value of $c at each stage rather than just at the end. This is most important if the number of inserts is relatively low in comparison to the size of the list. - ```perl -sub insert_zero_shortcut { - my($s,$c) = (0,shift); - $_ ? ( $c-= $s>2 && int(($s-1)/2), $s=0, $c>0 || return 1 ) : $s++ for @_,1; - 0; -} - -sub insert_zero_simultaneous_shortcut { - my($s,$c) = (0,shift); - $_ ? ( $c-= $s>2 && $s-2, $s=0, $c>0 || return 1 ) : $s++ for @_,1; - 0; +sub word_stickers { + my( %f, %s, $n, $l, $x ); + $f{$_}++ for split //, shift; # count for letters + my %t = %f; # Check all letters on stickers + # Initialise queue - no stickers, initial freq. + my @q = [ 1, 0, my %t = %f ]; # Check can solve? + map { delete $t{$_} } split // for @_; + return 0 if keys %t; # if not return 0 + my @q = [ 1, 0, %f ]; # [ $no+1, $last, %freqs ] + while( ($n,$l,%f) = @{ shift @q } ) { + push @q, map { + # Make copy of frequencies, set flag ($x) + # true once we use a letter on sticker, + # remove letters we have used up + $x = 0, %t = %f; + exists $t{$_} && ( $x=1, --$t{$_} || delete $t{$_} ) + for split//, $_[$_]; + # If none left return $n OR push entry onto + # queue, increasing count and setting new last + !%t ? return $n : $x ? [ $n+1, $_, %t ] : () + # Loop from last used to remove duplicates + } $l..$#_; + } } +``` -- cgit From ff37fe408cc094e08dfca21054962a0e993adf79 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 06:39:23 +0100 Subject: Update README.md --- challenge-216/james-smith/README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/challenge-216/james-smith/README.md b/challenge-216/james-smith/README.md index 1518a7f6e6..4935e8816d 100644 --- a/challenge-216/james-smith/README.md +++ b/challenge-216/james-smith/README.md @@ -48,8 +48,29 @@ Firstly we get a list of the lower-cased letters in the number plate. Then for e Interestingly this task uses the trick - copy hash and delete elements - within it's core. -We note: - * We are looking for fewest stickers - well this suggests a solution based on a queue as we want to do a depth based search. +We note we: + * are looking for fewest stickers so: + * this suggests a depth first solution; + * once we have found a solution it is by definition the best one; + * queue solutions work well in these cases; + * use a count based solution + * we count every letter in the target word; + * check that all of these are available on the sticker: + * if not we return a "0" value + * initialise the queue with an element: + * where we have not used any stickers; + * the last sticker we have "chosen" is the first one; + * the counts are the inital counts we calculated above + * for every element of the queue: + * we loop through the stickers; + * for each sticker we loop through the letters; + * and if we need that letter we make a note we have removed a letter and reduce the count of that letter by one (if the count goes to zero we remove it); + * if the counts array is empty we return the size + * if we have removed a letter we push the new values back on to the queue; + * **Note** when looping through the stickers we start with the last one we used and loop to the end. This avoids duplicates and greatly reduces the search space. + * we loop till the queue is empty - actually we don't because we will exit the loop with the count array check above before we exhaust the queue. + +Here is the code that the describes.... ```perl sub word_stickers { @@ -69,6 +90,8 @@ sub word_stickers { } ``` +And to know what bit does what - here it is with comments: + ```perl sub word_stickers { my( %f, %s, $n, $l, $x ); -- cgit From 29be1077987fb3c25bce2dfc7ab9437a66462fae Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 06:40:27 +0100 Subject: Create blog.txt --- challenge-216/james-smith/blog.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 challenge-216/james-smith/blog.txt diff --git a/challenge-216/james-smith/blog.txt b/challenge-216/james-smith/blog.txt new file mode 100644 index 0000000000..98f2ed1be4 --- /dev/null +++ b/challenge-216/james-smith/blog.txt @@ -0,0 +1 @@ +https://github.com/manwar/perlweeklychallenge-club/blob/master/challenge-216/james-smith/blog.txt -- cgit From b694499118075a855250c0634386a09d0c7f5c78 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 9 May 2023 06:40:52 +0100 Subject: Update README.md --- challenge-216/james-smith/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenge-216/james-smith/README.md b/challenge-216/james-smith/README.md index 4935e8816d..d686150756 100644 --- a/challenge-216/james-smith/README.md +++ b/challenge-216/james-smith/README.md @@ -1,7 +1,7 @@ [< Previous 215](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-215/james-smith) | [Next 217 >](https://github.com/drbaggy/perlweeklychallenge-club/tree/master/challenge-217/james-smith) -# The Weekly Challenge 216 +# The Weekly Challenge 6^3 You can find more information about this weeks, and previous weeks challenges at: -- cgit From e84337881f9e8c5c4d40919d597a15bf1c825cc7 Mon Sep 17 00:00:00 2001 From: 冯昶 Date: Tue, 9 May 2023 13:50:11 +0800 Subject: challenge 216, raku solutions --- challenge-216/feng-chang/raku/ch-1.raku | 6 ++++++ challenge-216/feng-chang/raku/ch-2.raku | 33 +++++++++++++++++++++++++++++++++ challenge-216/feng-chang/raku/test.raku | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100755 challenge-216/feng-chang/raku/ch-1.raku create mode 100755 challenge-216/feng-chang/raku/ch-2.raku create mode 100755 challenge-216/feng-chang/raku/test.raku diff --git a/challenge-216/feng-chang/raku/ch-1.raku b/challenge-216/feng-chang/raku/ch-1.raku new file mode 100755 index 0000000000..c72f5c47a9 --- /dev/null +++ b/challenge-216/feng-chang/raku/ch-1.raku @@ -0,0 +1,6 @@ +#!/bin/env raku + +unit sub MAIN(*@words); + +my $regs = @words.pop.lc.comb.grep(/<[a..z]>/).Set; +put @words.grep({ .comb.Set (>=) $regs }).map({ "'$_'" }).join(', '); diff --git a/challenge-216/feng-chang/raku/ch-2.raku b/challenge-216/feng-chang/raku/ch-2.raku new file mode 100755 index 0000000000..1c7bc23331 --- /dev/null +++ b/challenge-216/feng-chang/raku/ch-2.raku @@ -0,0 +1,33 @@ +#!/bin/env raku + +unit sub MAIN(*@stickers); + +my %word-bag = @stickers.pop.comb.Bag; +my %bags = @stickers.map({ $_ => .comb.Bag }); + +if %word-bag.Set (-) ([(|)] %bags.values».Set) { + put 0; + exit; +} + +my @A = [%word-bag, @stickers.grep({ %bags{$_} (&) %word-bag }), []],; + +loop { + my @A_; + + for @A -> (%word-bag, @stickers, @history) { + for @stickers -> $s { + my %word-bag_ = %word-bag (-) %bags{$s}; + my @history_ = |@history, $s; + + if +%word-bag_ == 0 { + put +@history_; + exit 0; + } else { + @A_.push([%word-bag_, @stickers.grep({ %bags{$_} (&) %word-bag_ }), @history_]); + } + } + } + + @A = @A_; +} diff --git a/challenge-216/feng-chang/raku/test.raku b/challenge-216/feng-chang/raku/test.raku new file mode 100755 index 0000000000..af91516af2 --- /dev/null +++ b/challenge-216/feng-chang/raku/test.raku @@ -0,0 +1,32 @@ +#!/bin/env raku + +# The Weekly Challenge 216 +use Test; + +sub pwc-test(Str:D $script, *@input) { + my ($expect, $assertion) = @input.splice(*-2, 2); + my $p = run $script, |@input, :out; + is $p.out.slurp(:close).chomp, $expect, $assertion; +} + +# Task 1, Registration Number +pwc-test './ch-1.raku', + |, 'AB1 2CD', + "'abcd'", + "Registration Number: @words = ('abc', 'abcd', 'bcd'), \$reg = 'AB1 2CD' => 'abcd'"; +pwc-test './ch-1.raku', + |, '007 JB', + "'job', 'bjorg'", + "Registration Number: @words = ('job', 'james', 'bjorg'), \$reg = '007 JB' => 'job', 'bjorg'"; +pwc-test './ch-1.raku', + |, 'C7 RA2', + "'crack', 'rac'", + "Registration Number: @words = ('crack', 'road', 'rac'), \$reg = 'C7 RA2' => 'crack', 'rac'"; + +# Task 2, Word Stickers +pwc-test './ch-2.raku', |, 'peon', 2, 'Word Stickers: @stickers = ("perl","raku","python"), $word = "peon" => 2'; +pwc-test './ch-2.raku', |, 'goat', 3, 'Word Stickers: @stickers = ("love","hate","angry"), $word = "goat" => 3'; +pwc-test './ch-2.raku', |, 'accommodation', 4, 'Word Stickers: @stickers = ("come","nation","delta"), $word = "accommodation" => 4'; +pwc-test './ch-2.raku', |, 'accommodation', 0, 'Word Stickers: @stickers = ("come","country","delta"), $word = "accommodation" => 0'; + +done-testing; -- cgit From a1d9855b0219647655adae8b83ebbdbb3df5d607 Mon Sep 17 00:00:00 2001 From: Niels van Dijke Date: Tue, 9 May 2023 07:28:08 +0000 Subject: w216 - Task 1 --- challenge-216/perlboy1967/perl/ch1.pl | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 challenge-216/perlboy1967/perl/ch1.pl diff --git a/challenge-216/perlboy1967/perl/ch1.pl b/challenge-216/perlboy1967/perl/ch1.pl new file mode 100755 index 0000000000..6d62b56317 --- /dev/null +++ b/challenge-216/perlboy1967/perl/ch1.pl @@ -0,0 +1,48 @@ +#!/bin/perl + +=pod + +The Weekly Challenge - 216 +- https://theweeklychallenge.org/blog/perl-weekly-challenge-216 + +Author: Niels 'PerlBoy' van Dijke + +Task 1: Registration Number +Submitted by: Mohammad S Anwar + +You are given a list of words and a random registration number. + +Write a script to find all the words in the given list that has every letter in the +given registration number. + +=cut + +use v5.16; + +use common::sense; + +use Test::More; +use Test::Deep; + +sub registrationNumber ($\@) { + my $rnRE = sprintf '[%s]', + join('].*?[', + sort grep /[a-z]/,split //,lc shift); + map { $_->[0] } + grep { $_->[1] =~ /$rnRE/ } + map { [$_,join('',sort split //,lc)] } + @{$_[0]}; +} + +is_deeply([registrationNumber('AB1 2CD',@{[qw{abc abcd bcd}]})], + [qw{abcd}]); +is_deeply([registrationNumber('007 JB', @{[qw{job james bjorg}]})], + [qw{job bjorg}]); +is_deeply([registrationNumber('C7 RA2', @{[qw{crack road rac}]})], + [qw{crack rac}]); +is_deeply([registrationNumber('T7 RR9', @{[qw{tracker roadster rac}]})], + [qw{tracker roadster}]); +is_deeply([registrationNumber('P3R L58',@{[qw{perl raku}]})], + [qw{perl}]); + +done_testing; -- cgit From 126e144efbf6665a4c51f6f7492935d1f1f6a080 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Tue, 9 May 2023 21:23:07 +0100 Subject: - Added solutions by Mark Anderson. - Added solutions by Luca Ferrari. - Added solutions by Leo Manfredi. - Added solutions by James Smith. - Added solutions by Feng Chang. - Added solutions by Niels van Dijke. --- challenge-216/perlboy1967/perl/ch-1.pl | 48 + challenge-216/perlboy1967/perl/ch1.pl | 48 - stats/pwc-challenge-215.json | 699 +++++++++++++++ stats/pwc-current.json | 697 ++------------- stats/pwc-language-breakdown-summary.json | 60 +- stats/pwc-language-breakdown.json | 1357 +++++++++++++++-------------- stats/pwc-leaders.json | 708 +++++++-------- stats/pwc-summary-1-30.json | 118 +-- stats/pwc-summary-121-150.json | 54 +- stats/pwc-summary-151-180.json | 128 +-- stats/pwc-summary-181-210.json | 106 +-- stats/pwc-summary-211-240.json | 102 +-- stats/pwc-summary-241-270.json | 38 +- stats/pwc-summary-271-300.json | 104 +-- stats/pwc-summary-31-60.json | 106 +-- stats/pwc-summary-61-90.json | 40 +- stats/pwc-summary-91-120.json | 44 +- stats/pwc-summary.json | 648 +++++++------- 18 files changed, 2637 insertions(+), 2468 deletions(-) create mode 100755 challenge-216/perlboy1967/perl/ch-1.pl delete mode 100755 challenge-216/perlboy1967/perl/ch1.pl create mode 100644 stats/pwc-challenge-215.json diff --git a/challenge-216/perlboy1967/perl/ch-1.pl b/challenge-216/perlboy1967/perl/ch-1.pl new file mode 100755 index 0000000000..6d62b56317 --- /dev/null +++ b/challenge-216/perlboy1967/perl/ch-1.pl @@ -0,0 +1,48 @@ +#!/bin/perl + +=pod + +The Weekly Challenge - 216 +- https://theweeklychallenge.org/blog/perl-weekly-challenge-216 + +Author: Niels 'PerlBoy' van Dijke + +Task 1: Registration Number +Submitted by: Mohammad S Anwar + +You are given a list of words and a random registration number. + +Write a script to find all the words in the given list that has every letter in the +given registration number. + +=cut + +use v5.16; + +use common::sense; + +use Test::More; +use Test::Deep; + +sub registrationNumber ($\@) { + my $rnRE = sprintf '[%s]', + join('].*?[', + sort grep /[a-z]/,split //,lc shift); + map { $_->[0] } + grep { $_->[1] =~ /$rnRE/ } + map { [$_,join('',sort split //,lc)] } + @{$_[0]}; +} + +is_deeply([registrationNumber('AB1 2CD',@{[qw{abc abcd bcd}]})], + [qw{abcd}]); +is_deeply([registrationNumber('007 JB', @{[qw{job james bjorg}]})], + [qw{job bjorg}]); +is_deeply([registrationNumber('C7 RA2', @{[qw{crack road rac}]})], + [qw{crack rac}]); +is_deeply([registrationNumber('T7 RR9', @{[qw{tracker roadster rac}]})], + [qw{tracker roadster}]); +is_deeply([registrationNumber('P3R L58',@{[qw{perl raku}]})], + [qw{perl}]); + +done_testing; diff --git a/challenge-216/perlboy1967/perl/ch1.pl b/challenge-216/perlboy1967/perl/ch1.pl deleted file mode 100755 index 6d62b56317..0000000000 --- a/challenge-216/perlboy1967/perl/ch1.pl +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/perl - -=pod - -The Weekly Challenge - 216 -- https://theweeklychallenge.org/blog/perl-weekly-challenge-216 - -Author: Niels 'PerlBoy' van Dijke - -Task 1: Registration Number -Submitted by: Mohammad S Anwar - -You are given a list of words and a random registration number. - -Write a script to find all the words in the given list that has every letter in the -given registration number. - -=cut - -use v5.16; - -use common::sense; - -use Test::More; -use Test::Deep; - -sub registrationNumber ($\@) { - my $rnRE = sprintf '[%s]', - join('].*?[', - sort grep /[a-z]/,split //,lc shift); - map { $_->[0] } - grep { $_->[1] =~ /$rnRE/ } - map { [$_,join('',sort split //,lc)] } - @{$_[0]}; -} - -is_deeply([registrationNumber('AB1 2CD',@{[qw{abc abcd bcd}]})], - [qw{abcd}]); -is_deeply([registrationNumber('007 JB', @{[qw{job james bjorg}]})], - [qw{job bjorg}]); -is_deeply([registrationNumber('C7 RA2', @{[qw{crack road rac}]})], - [qw{crack rac}]); -is_deeply([registrationNumber('T7 RR9', @{[qw{tracker roadster rac}]})], - [qw{tracker roadster}]); -is_deeply([registrationNumber('P3R L58',@{[qw{perl raku}]})], - [qw{perl}]); - -done_testing; diff --git a/stats/pwc-challenge-215.json b/stats/pwc-challenge-215.json new file mode 100644 index 0000000000..b2ceb43809 --- /dev/null +++ b/stats/pwc-challenge-215.json @@ -0,0 +1,699 @@ +{ + "xAxis" : { + "type" : "category" + }, + "series" : [ + { + "colorByPoint" : 1, + "data" : [ + { + "name" : "Ali Moradi", + "y" : 4, + "drilldown" : "Ali Moradi" + }, + { + "name" : "Arne Sommer", + "y" : 3, + "drilldown" : "Arne Sommer" + }, + { + "drilldown" : "Athanasius", + "name" : "Athanasius", + "y" : 4 + }, + { + "drilldown" : "Avery Adams", + "name" : "Avery Adams", + "y" : 4 + }, + { + "drilldown" : "BarrOff", + "name" : "BarrOff", + "y" : 4 + }, + { + "drilldown" : "Bob Lied", + "y" : 3, + "name" : "Bob Lied" + }, + { + "name" : "Bruce Gray", + "y" : 2, + "drilldown" : "Bruce Gray" + }, + { + "name" : "Carlos Oliveira", + "y" : 2, + "drilldown" : "Carlos Oliveira" + }, + { + "drilldown" : "David Ferrone", + "y" : 2, + "name" : "David Ferrone" + }, + { + "drilldown" : "Duncan C. White", + "name" : "Duncan C. White", + "y" : 2 + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "drilldown" : "Feng Chang", + "y" : 2, + "name" : "Feng Chang" + }, + { + "drilldown" : "Flavio Poletti", + "y" : 6, + "name" : "Flavio Poletti" + }, + { + "y" : 5, + "name" : "Jaldhar H. Vyas", + "drilldown" : "Jaldhar H. Vyas" + }, + { + "y" : 3, + "name" : "James Smith", + "drilldown" : "James Smith" + }, + { + "drilldown" : "Jan Krnavek", + "y" : 2, + "name" : "Jan Krnavek" + }, + { + "drilldown" : "Jorg Sommrey", + "y" : 2, + "name" : "Jorg Sommrey" + }, + { + "drilldown" : "Lance Wicks", + "y" : 1, + "name" : "Lance Wicks" + }, + { + "name" : "Laurent Rosenfeld", + "y" : 5, + "drilldown" : "Laurent Rosenfeld" + }, + { + "y" : 1, + "name" : "Leo Manfredi", + "drilldown" : "Leo Manfredi" + }, + { + "y" : 2, + "name" : "Lubos Kolouch", + "drilldown" : "Lubos Kolouch" + }, + { + "name" : "Luca Ferrari", + "y" : 8, + "drilldown" : "Luca Ferrari" + }, + { + "y" : 2, + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson" + }, + { + "y" : 2, + "name" : "Niels van Dijke", + "drilldown" : "Niels van Dijke" + }, + { + "drilldown" : "Paulo Custodio", + "y" : 2, + "name" : "Paulo Custodio" + }, + { + "name" : "Peter Campbell Smith", + "y" : 3, + "drilldown" : "Peter Campbell Smith" + }, + { + "y" : 2, + "name" : "RibTips", + "drilldown" : "RibTips" + }, + { + "y" : 3, + "name" : "Robbie Hatley", + "drilldown" : "Robbie Hatley" + }, + { + "drilldown" : "Robert DiCicco", + "y" : 4, + "name" : "Robert DiCicco" + }, + { + "name" : "Robert Ransbottom", + "y" : 2, + "drilldown" : "Robert Ransbottom" + }, + { + "drilldown" : "Roger Bell_West", + "y" : 5, + "name" : "Roger Bell_West" + }, + { + "name" : "Simon Green", + "y" : 3, + "drilldown" : "Simon Green" + }, + { + "drilldown" : "Solathian", + "name" : "Solathian", + "y" : 2 + }, + { + "y" : 3, + "name" : "Stephen G. Lynn", + "drilldown" : "Stephen G. Lynn" + }, + { + "y" : 4, + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler" + }, + { + "drilldown" : "Ulrich Rieke", + "name" : "Ulrich Rieke", + "y" : 4 + }, + { + "drilldown" : "W. Luis Mochan", + "y" : 3, + "name" : "W. Luis Mochan" + } + ], + "name" : "The Weekly Challenge - 215" + } + ], + "drilldown" : { + "series" : [ + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Arne Sommer", + "name" : "Arne Sommer" + }, + { + "id" : "Athanasius", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "name" : "Athanasius" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Avery Adams", + "name" : "Avery Adams" + }, + { + "name" : "BarrOff", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "BarrOff" + }, + { + "name" : "Bob Lied", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Bob Lied" + }, + { + "name" : "Bruce Gray", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Bruce Gray" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Carlos Oliveira", + "name" : "Carlos Oliveira" + }, + { + "name" : "David Ferrone", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "David Ferrone" + }, + { + "id" : "Duncan C. White", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "Duncan C. White" + }, + { + "name" : "E. Choroba", + "id" : "E. Choroba", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Feng Chang", + "id" : "Feng Chang", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Flavio Poletti", + "name" : "Flavio Poletti" + }, + { + "name" : "Jaldhar H. Vyas", + "id" : "Jaldhar H. Vyas", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "name" : "James Smith", + "id" : "James Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "name" : "Jorg Sommrey", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Jorg Sommrey" + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "id" : "Lance Wicks", + "name" : "Lance Wicks" + }, + { + "name" : "Laurent Rosenfeld", + "id" : "Laurent Rosenfeld", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ] + }, + { + "data" : [ + [ + "Perl", + 1 + ] + ], + "id" : "Leo Manfredi", + "name" : "Leo Manfredi" + }, + { + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "data" : [ + [ + "Raku", + 2 + ], + [ + "Blog", + 6 + ] + ], + "id" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "name" : "Mark Anderson", + "id" : "Mark Anderson", + "data" : [ + [ + "Raku", + 2 + ] + ] + }, + { + "name" : "Niels van Dijke", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Niels van Dijke" + }, + { + "name" : "Paulo Custodio", + "data" : [ + [ + "Perl", + 2 + ] + ], + "id" : "Paulo Custodio" + }, + { + "id" : "Peter Campbell Smith", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "Peter Campbell Smith" + }, + { + "id" : "RibTips", + "data" : [ + [ + "Perl", + 2 + ] + ], + "name" : "RibTips" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Robbie Hatley", + "name" : "Robbie Hatley" + }, + { + "id" : "Robert DiCicco", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "name" : "Robert DiCicco" + }, + { + "name" : "Robert Ransbottom", + "data" : [ + [ + "Raku", + 2 + ] + ], + "id" : "Robert Ransbottom" + }, + { + "name" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Roger Bell_West" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Simon Green", + "name" : "Simon Green" + }, + { + "name" : "Solathian", + "id" : "Solathian", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { + "name" : "Stephen G. Lynn", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "id" : "Stephen G. Lynn" + }, + { + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 2 + ] + ], + "id" : "Thomas Kohler", + "name" : "Thomas Kohler" + }, + { + "name" : "Ulrich Rieke", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Ulrich Rieke" + }, + { + "id" : "W. Luis Mochan", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Blog", + 1 + ] + ], + "name" : "W. Luis Mochan" + } + ] + }, + "title" : { + "text" : "The Weekly Challenge - 215" + }, + "tooltip" : { + "pointFormat" : "{point.name}: {point.y:f}
", + "followPointer" : 1, + "headerFormat" : "{series.name}
" + }, + "legend" : { + "enabled" : 0 + }, + "chart" : { + "type" : "column" + }, + "subtitle" : { + "text" : "[Champions: 37] Last updated at 2023-05-09 20:18:11 GMT" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "plotOptions" : { + "series" : { + "borderWidth" : 0, + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + } + } + } +} diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 4eca65d473..af1b112af2 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,269 +1,84 @@ { "title" : { - "text" : "The Weekly Challenge - 215" - }, - "xAxis" : { - "type" : "category" - }, - "tooltip" : { - "pointFormat" : "{point.name}: {point.y:f}
", - "headerFormat" : "{series.name}
", - "followPointer" : 1 - }, - "legend" : { - "enabled" : 0 + "text" : "The Weekly Challenge - 216" }, + "series" : [ + { + "data" : [ + { + "y" : 2, + "name" : "Feng Chang", + "drilldown" : "Feng Chang" + }, + { + "name" : "James Smith", + "y" : 3, + "drilldown" : "James Smith" + }, + { + "y" : 1, + "name" : "Leo Manfredi", + "drilldown" : "Leo Manfredi" + }, + { + "name" : "Luca Ferrari", + "y" : 8, + "drilldown" : "Luca Ferrari" + }, + { + "y" : 2, + "name" : "Mark Anderson", + "drilldown" : "Mark Anderson" + }, + { + "name" : "Niels van Dijke", + "y" : 1, + "drilldown" : "Niels van Dijke" + } + ], + "name" : "The Weekly Challenge - 216", + "colorByPoint" : 1 + } + ], "yAxis" : { "title" : { "text" : "Total Solutions" } }, - "subtitle" : { - "text" : "[Champions: 37] Last updated at 2023-05-08 05:40:15 GMT" + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } }, "drilldown" : { "series" : [ - { - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "id" : "Ali Moradi", - "name" : "Ali Moradi" - }, - { - "name" : "Arne Sommer", - "id" : "Arne Sommer", - "data" : [ - [ - "Raku", - 2 - ], - [ - "Blog", - 1 - ] - ] - }, - { - "name" : "Athanasius", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "id" : "Athanasius" - }, - { - "name" : "Avery Adams", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 2 - ] - ], - "id" : "Avery Adams" - }, - { - "id" : "BarrOff", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Raku", - 2 - ] - ], - "name" : "BarrOff" - }, - { - "name" : "Bob Lied", - "data" : [ - [ - "Perl", - 2 - ], - [ - "Blog", - 1 - ] - ], - "id" : "Bob Lied" - }, - { - "data" : [ - [ - "Raku", - 2 - ] - ], - "id" : "Bruce Gray", - "name" : "Bruce Gray" - }, - { - "name" : "Carlos Oliveira", - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "Carlos Oliveira" - }, - { - "name" : "David Ferrone", - "id" : "David Ferrone", - "data" : [ - [ - "Perl", - 2 - ] - ] - }, - { - "name" : "Duncan C. White", - "data" : [ - [ - "Perl", - 2 - ] - ], - "id" : "Duncan C. White" - }, - { - "id" : "E. Choroba", - "data" : [ - [ - "Perl", - 2 - ] - ], -