From 75e69f0ee7e74f2121c38521cf4041d00f6e4353 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 4 Jan 2021 19:37:01 +0100 Subject: Readme --- challenge-094/abigail/README.md | 77 +++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 46 deletions(-) diff --git a/challenge-094/abigail/README.md b/challenge-094/abigail/README.md index ce16bd000c..b9a451dcbd 100644 --- a/challenge-094/abigail/README.md +++ b/challenge-094/abigail/README.md @@ -1,70 +1,55 @@ # Solution by Abigail -## Task 1: Max Points +## Task 1: Group Anagrams -You are given set of co-ordinates `@N`. +You are given an array of strings `@S`. -Write a script to count maximum points on a straight line when given -co-ordinates plotted on 2-d plane. +Write a script to group Anagrams together in any random order. ### Examples -~~~~ -| -| x -| x -| x -+ _ _ _ _ - -Input: (1,1), (2,2), (3,3) -Output: 3 - -| -| -| x x -| x -| x x -+ _ _ _ _ _ +#### Example 1 +~~~~ +Input: ("opt", "bat", "saw", "tab", "pot", "top", "was") +Output: [ ("bat", "tab"), + ("saw", "was"), + ("top", "pot", "opt") ] +~~~~ -Input: (1,1), (2,2), (3,1), (1,3), (5,3) -Output: 3 +#### Example 2 +~~~~ +Input: ("x") +Output: [ ("x") ] ~~~~ + ### Solutions -* [Perl](perl/ch-1.pl) -## Task 2: Sum Path +## Task 2: Binary Tree to Linked List -You are given binary tree containing numbers `0-9` only. +You are given a binary tree. -Write a script to sum all possible paths from root to leaf. +Write a script to represent the given binary tree as an object and +flatten it to a linked list object. Finally print the linked list +object. ### Examples -~~~~ -Input: - 1 - / - 2 - / \ - 3 4 - -Output: 13 -~~~~ -as sum two paths (1->2->3) and (1->2->4) +#### Example 1 ~~~~ Input: - 1 - / \ - 2 3 - / / \ - 4 5 6 - -Output: 26 + 1 + / \ + 2 3 + / \ +4 5 + / \ + 6 7 + +Output: + 1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 3 ~~~~ -as sum three paths (1->2->4), (1->3->5) and (1->3->6) ### Solutions -* [Perl](perl/ch-2.pl) -- cgit From 33e8a5ad2843da4b0006851a42380c4b90b30106 Mon Sep 17 00:00:00 2001 From: Abigail Date: Mon, 4 Jan 2021 19:49:13 +0100 Subject: Perl solution for week 94/part 1 --- challenge-094/abigail/README.md | 1 + challenge-094/abigail/perl/ch-1.pl | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 challenge-094/abigail/perl/ch-1.pl diff --git a/challenge-094/abigail/README.md b/challenge-094/abigail/README.md index b9a451dcbd..0fc0441af3 100644 --- a/challenge-094/abigail/README.md +++ b/challenge-094/abigail/README.md @@ -24,6 +24,7 @@ Output: [ ("x") ] ### Solutions +* [Perl](perl/ch-1.pl) diff --git a/challenge-094/abigail/perl/ch-1.pl b/challenge-094/abigail/perl/ch-1.pl new file mode 100644 index 0000000000..bccd80afaa --- /dev/null +++ b/challenge-094/abigail/perl/ch-1.pl @@ -0,0 +1,34 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +while (<>) { + my %anagrams; + # + # Iterate over the words. We're assuming all the words are on + # a single line, and the words don't contain a double quote. + # (If we can't assume this, we could use a CSV parser instead). + # + foreach my $word (/"([^"]+)"/g) { + # + # Normalize each word: split into characters, sort them, join them. + # + my $normalized = join "" => sort split // => $word; + push @{$anagrams {$normalized}} => $word; + } + # + # Print them. We make this deterministic, so we can easily write tests + # + foreach my $key (sort keys %anagrams) { + say join ", " => map {qq {"$_"}} @{$anagrams {$key}}; + } +} + +__END__ -- cgit From 5c8f6c9abe4b4af1b5916924c2794d9214d8a6cd Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 02:28:23 +0100 Subject: Examples for challenge 1 --- challenge-094/abigail/t/input-1-1 | 1 + challenge-094/abigail/t/input-1-2 | 1 + challenge-094/abigail/t/output-1-1.exp | 3 +++ challenge-094/abigail/t/output-1-2.exp | 1 + 4 files changed, 6 insertions(+) create mode 100644 challenge-094/abigail/t/input-1-1 create mode 100644 challenge-094/abigail/t/input-1-2 create mode 100644 challenge-094/abigail/t/output-1-1.exp create mode 100644 challenge-094/abigail/t/output-1-2.exp diff --git a/challenge-094/abigail/t/input-1-1 b/challenge-094/abigail/t/input-1-1 new file mode 100644 index 0000000000..b2536d46f1 --- /dev/null +++ b/challenge-094/abigail/t/input-1-1 @@ -0,0 +1 @@ +"opt", "bat", "saw", "tab", "pot", "top", "was" diff --git a/challenge-094/abigail/t/input-1-2 b/challenge-094/abigail/t/input-1-2 new file mode 100644 index 0000000000..92232f694a --- /dev/null +++ b/challenge-094/abigail/t/input-1-2 @@ -0,0 +1 @@ +"x" diff --git a/challenge-094/abigail/t/output-1-1.exp b/challenge-094/abigail/t/output-1-1.exp new file mode 100644 index 0000000000..b0b271a69f --- /dev/null +++ b/challenge-094/abigail/t/output-1-1.exp @@ -0,0 +1,3 @@ +"bat", "tab" +"saw", "was" +"opt", "pot", "top" diff --git a/challenge-094/abigail/t/output-1-2.exp b/challenge-094/abigail/t/output-1-2.exp new file mode 100644 index 0000000000..92232f694a --- /dev/null +++ b/challenge-094/abigail/t/output-1-2.exp @@ -0,0 +1 @@ +"x" -- cgit From a2cce72927966dfa716005651cb051ac91667075 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 02:29:03 +0100 Subject: Test configuration --- challenge-094/abigail/t/ctest.ini | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 challenge-094/abigail/t/ctest.ini diff --git a/challenge-094/abigail/t/ctest.ini b/challenge-094/abigail/t/ctest.ini new file mode 100644 index 0000000000..7884211cf0 --- /dev/null +++ b/challenge-094/abigail/t/ctest.ini @@ -0,0 +1,3 @@ +[names] +1-1 = Example 1 +1-2 = Example 2 -- cgit From baead4f7da7e805466f6961bf24531f0190e7fbe Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 02:29:29 +0100 Subject: Node solution for week 94/part 1. --- challenge-094/abigail/node/ch-1.js | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 challenge-094/abigail/node/ch-1.js diff --git a/challenge-094/abigail/node/ch-1.js b/challenge-094/abigail/node/ch-1.js new file mode 100644 index 0000000000..d790d52c0a --- /dev/null +++ b/challenge-094/abigail/node/ch-1.js @@ -0,0 +1,44 @@ +// +// Call as "node ch-1.js < ../t/input-1-X", for suitable X. +// + require ("fs") +. readFileSync (0) // Read all. +. toString () // Turn it into a string. +. split ("\n") // Split on newlines. +. filter (_ => _ . length) // Filter out empty lines. + // + // Split each line on ', ', and remove the double quotes. + // We now have a list of words. + // +. map (_ => _ . split (/,\s*/) + . map (_ => _ . replace (/"/g, '')) + ) + // + // Iterate over the list of words, find the canonical representation + // of each word (characters sorted), and store the words in a hash, + // keyed by their canonical representation. + // +. map (_ => _ . reduce ((hash, word) => { + let key = word . split ("") + . sort () + . join (""); + hash [key] = hash [key] || []; + hash [key] . push (word); + return (hash); + }, {}) + ) + // + // Print the results: sorted by key, the words in the order + // of the input. Each word will be surrounded by double quotes + // and separated by commas. + // +. map (hash => Object . keys (hash) + . sort () + . forEach (_ => { + console . log ( + hash [_] . map (_ => '"' + _ + '"') + . join (", ") + ) + }) + ) +; -- cgit From 67a06243a81dbc68d16ef92db92488d783b49522 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 21:31:35 +0100 Subject: Add some notes. But in a disclaimer you may get unexpected results if the input contains accented letters and/or combining characters. We're blaming the specification. (Or lack thereof). --- challenge-094/abigail/perl/ch-1.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/challenge-094/abigail/perl/ch-1.pl b/challenge-094/abigail/perl/ch-1.pl index bccd80afaa..c2fd0ddf8a 100644 --- a/challenge-094/abigail/perl/ch-1.pl +++ b/challenge-094/abigail/perl/ch-1.pl @@ -19,6 +19,10 @@ while (<>) { foreach my $word (/"([^"]+)"/g) { # # Normalize each word: split into characters, sort them, join them. + # Note that we're splitting on characters, not graphemes, nor + # do we normalize the input. This may lead to unexpected results + # when using accented letters and/or combining characters. But + # that's what you get when using poor specifications. # my $normalized = join "" => sort split // => $word; push @{$anagrams {$normalized}} => $word; -- cgit From d1ca62e9dbc5598062dea7547dcc419f313ec5a4 Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 21:33:08 +0100 Subject: Test case for challenge 2. --- challenge-094/abigail/t/ctest.ini | 1 + challenge-094/abigail/t/input-2-1 | 1 + challenge-094/abigail/t/output-2-1.exp | 1 + 3 files changed, 3 insertions(+) create mode 100644 challenge-094/abigail/t/input-2-1 create mode 100644 challenge-094/abigail/t/output-2-1.exp diff --git a/challenge-094/abigail/t/ctest.ini b/challenge-094/abigail/t/ctest.ini index 7884211cf0..a103f94dae 100644 --- a/challenge-094/abigail/t/ctest.ini +++ b/challenge-094/abigail/t/ctest.ini @@ -1,3 +1,4 @@ [names] 1-1 = Example 1 1-2 = Example 2 +2-1 = Example 1 diff --git a/challenge-094/abigail/t/input-2-1 b/challenge-094/abigail/t/input-2-1 new file mode 100644 index 0000000000..7684932fbb --- /dev/null +++ b/challenge-094/abigail/t/input-2-1 @@ -0,0 +1 @@ +[[[[] 4 []] 2 [[[] 6 []] 5 [[] 7 []]]] 1 [[] 3 []]] diff --git a/challenge-094/abigail/t/output-2-1.exp b/challenge-094/abigail/t/output-2-1.exp new file mode 100644 index 0000000000..cfb75dc579 --- /dev/null +++ b/challenge-094/abigail/t/output-2-1.exp @@ -0,0 +1 @@ +1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 3 -- cgit From 3ea96534f109f61030d7b3c6972cecd0b9205dde Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 19:49:14 +0100 Subject: Perl solution for week 94/part 2 --- challenge-094/abigail/perl/ch-2.pl | 123 +++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 challenge-094/abigail/perl/ch-2.pl diff --git a/challenge-094/abigail/perl/ch-2.pl b/challenge-094/abigail/perl/ch-2.pl new file mode 100644 index 0000000000..a05c21f735 --- /dev/null +++ b/challenge-094/abigail/perl/ch-2.pl @@ -0,0 +1,123 @@ +#!/opt/perl/bin/perl + +use 5.032; + +use strict; +use warnings; +no warnings 'syntax'; + +use experimental 'signatures'; +use experimental 'lexical_subs'; + +# +# Run as "perl ch-2.pl < ../t/input-2-X", for suitable X. +# + +# +# A bit of a silly exercise to turn a tree into a linked list, then just +# print the linked list. The linked list feels like a pointless detour; +# traversing the tree inorderly leads to the same result. +# + +my $T_LEFT = 0; +my $T_VALUE = 1; +my $T_RIGHT = 2; +my $L_VALUE = 0; +my $L_NEXT = 1; + +# +# Turn the tree into a linked list; returns the head and end of the linked list. +# +sub inorder ($tree) { + return unless @$tree; # Leaf, so no list. + + # + # Recurse + # + my ($left_head, $left_tail) = inorder ($$tree [$T_LEFT]); + my ($right_head, $right_tail) = inorder ($$tree [$T_RIGHT]); + + # + # Create head of list; let tail point to this. + # + my $head = []; + $$head [$L_VALUE] = $$tree [$T_VALUE]; + my $tail = $head; + + # + # If either child is non-empty, add this to the list; update + # the tail if necessary. + # + if ($left_head) { + $$tail [$L_NEXT] = $left_head; + $tail = $left_tail; + } + if ($right_head) { + $$tail [$L_NEXT] = $right_head; + $tail = $right_tail; + } + + # + # Return head and tail + # + ($head, $tail); +} + +# +# Flatten a linked list, recursively. +# +sub flatten ($list) { + $list ? ($$list [$L_VALUE], flatten ($$list [$L_NEXT])) : (); +} + +# +# Print the list: first flatten it, then print the result. +# +sub print_ll ($list) { + say join " -> " => flatten $list; +} + +# +# Did not want to parse the input as given in the example, it is not enough +# to deduce how the input looks like in general -- for instance, if we have +# a root with two children, which each has two children, how is it going to +# look? +# +# So, we're assuming the following grammar for a tree, in pseudo BNF: +# +# value = [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9] + +# tree = '[' [ ] ']' +# +# That is, leaf nodes look like '[]', and regular nodes consist of a tree, +# followed by a value, followed by a tree, all surrounded by brackets. +# + +while (<>) { + chomp; + my $count = 0; + my %cache; + # + # Parse the input, build a tree bottom to top. + # + # As long as we have something of the form: + # + # [] or + # [ Tnnn vvv Tmmm], where Tnnn/Tmmm are a "T" followed by a + # number, and vvv a value + # + # we replace it by Tppp, where ppp is the next available number. We also + # add an entry Tppp to a cache, where $cache {Tppp} = [] in the former case, + # and $cache {Tppp} = [$cache {Tnnn}, vvv, $cache {Tmmm}] in the latter. + # + 1 while s {\[ \s* (?:(T[0-9]+) \s+ ([0-9]+) \s+ (T[0-9]+))? \s* \]} + { $count ++; + $cache {"T$count"} = $1 ? [$cache {$1}, $2, $cache {$3}] : []; + "T$count"}ex; + # + # Final tree is now in the cache with key "T$count". + # + print_ll +(inorder $cache {"T$count"}) [0]; # Inorder returns two values, + # we need only the first one. +} + +__END__ -- cgit From f113a6741cc2e1b71148b82a1d5b27e2c4efca9d Mon Sep 17 00:00:00 2001 From: Abigail Date: Sat, 9 Jan 2021 21:59:36 +0100 Subject: Update README.md with links to solutions --- challenge-094/abigail/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/challenge-094/abigail/README.md b/challenge-094/abigail/README.md index 0fc0441af3..1ab213691e 100644 --- a/challenge-094/abigail/README.md +++ b/challenge-094/abigail/README.md @@ -24,6 +24,7 @@ Output: [ ("x") ] ### Solutions +* [Node](node/ch-1.js) * [Perl](perl/ch-1.pl) @@ -54,3 +55,4 @@ Output: ~~~~ ### Solutions +* [Perl](perl/ch-2.pl) -- cgit From a0094272479cacc7945bae03e42f7b2291643f32 Mon Sep 17 00:00:00 2001 From: Adam Russell Date: Sun, 10 Jan 2021 02:21:05 -0500 Subject: initial commit of challenge-094 solutions --- challenge-094/adam-russell/blog.txt | 0 challenge-094/adam-russell/blog1.txt | 0 challenge-094/adam-russell/perl/LinkedList.pm | 57 +++++++++++++++++++++++ challenge-094/adam-russell/perl/ch-1.pl | 66 +++++++++++++++++++++++++++ challenge-094/adam-russell/perl/ch-2.pl | 54 ++++++++++++++++++++++ challenge-094/adam-russell/prolog/ch-1.p | 56 +++++++++++++++++++++++ challenge-094/adam-russell/prolog/ch-2.p | 45 ++++++++++++++++++ 7 files changed, 278 insertions(+) create mode 100644 challenge-094/adam-russell/blog.txt create mode 100644 challenge-094/adam-russell/blog1.txt create mode 100644 challenge-094/adam-russell/perl/LinkedList.pm create mode 100644 challenge-094/adam-russell/perl/ch-1.pl create mode 100644 challenge-094/adam-russell/perl/ch-2.pl create mode 100644 challenge-094/adam-russell/prolog/ch-1.p create mode 100644 challenge-094/adam-russell/prolog/ch-2.p diff --git a/challenge-094/adam-russell/blog.txt b/challenge-094/adam-russell/blog.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/challenge-094/adam-russell/blog1.txt b/challenge-094/adam-russell/blog1.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/challenge-094/adam-russell/perl/LinkedList.pm b/challenge-094/adam-russell/perl/LinkedList.pm new file mode 100644 index 0000000000..e3e7c28dc0 --- /dev/null +++ b/challenge-094/adam-russell/perl/LinkedList.pm @@ -0,0 +1,57 @@ +use strict; +use warnings; +package LinkedList{ + use boolean; + use Tie::RefHash; + use Class::Struct; + package Node{ + use Class::Struct; + + struct( + data => q/$/, + next => q/Node/ + ); + } + + struct( + head => q/Node/ + ); + + sub stringify{ + my($self) = @_; + my $s = ""; + my $next = $self->head()->next(); + while($next && $next->next()){ + $s .= " -> " if $s; + $s = $s . $next->data(); + $next = $next->next(); + } + $s = $s . " -> " . $next->data() if $next->data(); + $s .= "\n"; + return $s; + } + + sub insert{ + my($self, $data, $previous) = @_; + if(!$previous){ + $previous=new Node(data => undef, next => undef); + $self->head($previous); + } + my $next=new Node(data => $data, next => undef); + $previous->next($next); + return $next; + } + + sub in_list{ + my($self, $k) = @_; + my $previous = $self->head(); + my $next = $self->head()->next(); + tie my %node_value, "Tie::RefHash"; + while($next){ + return true if($next->data() == $k); + $next = $next->next(); + } + return false; + } + true; +} diff --git a/challenge-094/adam-russell/perl/ch-1.pl b/challenge-094/adam-russell/perl/ch-1.pl new file mode 100644 index 0000000000..96e8508434 --- /dev/null +++ b/challenge-094/adam-russell/perl/ch-1.pl @@ -0,0 +1,66 @@ +use strict; +use warnings; +## +# You are given an array of strings @S. +# Write a script to group Anagrams together +# in any random order. +## +my %letter_factor = ( + e => 2, + t => 3, + a => 5, + o => 7, + i => 11, + n => 13, + s => 17, + h => 19, + r => 23, + d => 29, + l => 31, + c => 37, + u => 41, + m => 43, + w => 47, + f => 53, + g => 59, + y => 61, + p => 67, + b => 71, + v => 73, + k => 79, + j => 83, + x => 89, + q => 97, + z => 101 +); + +MAIN:{ + my $word; + my %anagrams; + while($word = ){ + chomp($word); + my @letters = split(//, $word); + my $word_product = 1; + map {$word_product *= $_} map{$letter_factor{$_}} @letters; + push @{$anagrams{$word_product}} , $word if $anagrams{$word_product}; + $anagrams{$word_product} = [$word] unless $anagrams{$word_product}; + } + close(DATA); + print "Organized anagrams:\n"; + for my $key (keys %anagrams){ + print " "; + for my $word (@{$anagrams{$key}}){ + print "$word "; + } + print "\n"; + } +} + +__DATA__ +opt +bat +saw +tab +pot +top +was diff --git a/challenge-094/adam-russell/perl/ch-2.pl b/challenge-094/adam-russell/perl/ch-2.pl new file mode 100644 index 0000000000..42b58780d9 --- /dev/null +++ b/challenge-094/adam-russell/perl/ch-2.pl @@ -0,0 +1,54 @@ +use strict; +use warnings; +## +# You are given a binary tree. Write a script to +# represent the given binary tree as an object and +# flatten it to a linked list object. +# Finally, print the linked list object. +## +use Graph; +use LinkedList; + +sub build_linked_list{ + my($tree) = @_; + my $linked_list = new LinkedList(); + my @paths = build_paths($tree); + my $root = $paths[0]->[0]; + my $next = $linked_list->insert($root, undef); + for my $path (@paths){ + for my $node (@{$path}){ + $next = $linked_list->insert($node, $next) if !$linked_list->in_list($node); + } + } + return $linked_list; +} + +sub build_paths { + my ($graph) = @_; + my @paths; + local *_helper = sub{ + my $v = $_[-1]; + my @successors = $graph->successors($v); + if(@successors){ + _helper(@_, $_) for @successors; + } + else{ + unshift @paths, [@_]; + } + }; + _helper($_) for $graph->source_vertices(); + return @paths; +} + +MAIN:{ + my $Tree; + $Tree = new Graph(); + $Tree->add_vertices(1, 2, 3, 4, 5, 6, 7); + $Tree->add_edge(1, 2); + $Tree->add_edge(1, 3); + $Tree->add_edge(2, 4); + $Tree->add_edge(2, 5); + $Tree->add_edge(5, 6); + $Tree->add_edge(5, 7); + print build_linked_list($Tree)->stringify(); +} diff --git a/challenge-094/adam-russell/prolog/ch-1.p b/challenge-094/adam-russell/prolog/ch-1.p new file mode 100644 index 0000000000..80a0c5341f --- /dev/null +++ b/challenge-094/adam-russell/prolog/ch-1.p @@ -0,0 +1,56 @@ +/* +* You are given a list of strings S. +* Write a script to group Anagrams together +* in any random order. +*/ +:-initialization(main). + +letter_factor(e, 2). +letter_factor(t, 3). +letter_factor(a, 5). +letter_factor(o, 7). +letter_factor(i, 11). +letter_factor(n, 13). +letter_factor(s, 17). +letter_factor(h, 19). +letter_factor(r, 23). +letter_factor(d, 29). +letter_factor(l, 31). +letter_factor(c, 37). +letter_factor(u, 41). +letter_factor(m, 43). +letter_factor(w, 47). +letter_factor(f, 53). +letter_factor(g, 59). +letter_factor(y, 61). +letter_factor(p, 67). +letter_factor(b, 71). +letter_factor(v, 73). +letter_factor(k, 79). +letter_factor(j, 83). +letter_factor(x, 89). +letter_factor(q, 97). +letter_factor(z, 101). + +chars_product([], 1). +chars_product([H|T], Product):- + letter_factor(H, Factor), + chars_product(T, Product0), + Product is Factor * Product0. + +word_product(Word, Product):- + atom_chars(Word, Chars), + chars_product(Chars, Product). + +organize([]):- + findall(Words, bagof(Word, word_product(Word-_), Words), WordsList), + write(WordsList). +organize([H|T]):- + word_product(H, P), + assertz(word_product(H-P)), + organize(T). + +main:- + Anagrams = [opt, bat, saw, tab, pot, top, was], + organize(Anagrams), nl, + halt. diff --git a/challenge-094/adam-russell/prolog/ch-2.p b/challenge-094/adam-russell/prolog/ch-2.p new file mode 100644 index 0000000000..d417c95188 --- /dev/null +++ b/challenge-094/adam-russell/prolog/ch-2.p @@ -0,0 +1,45 @@ +/* +* You are given a binary tree. Write a script to +* represent the given binary tree as an object and +* flatten it to a linked list object. +* Finally, print the linked list object. +*/ +:-initialization(main). + +dfs(Node, Graph, [Node|Path]):- + dfs(Node, Graph, Path, []). +dfs(_, _, [], _). +dfs(Node, Graph, [AdjNode|Path], Seen) :- + member(r(Node, Adjacent), Graph), + member(AdjNode, Adjacent), + \+ memberchk(AdjNode, Seen), + dfs(AdjNode, Graph, Path, [Node|Seen]). + +unseen_nodes(Nodes, NodeList, Unseen):- + unseen_nodes(Nodes, NodeList, [], Unseen). +unseen_nodes([], _, Unseen, Unseen). +unseen_nodes([H|T], NodeList, UnseenAccum, Unseen):- + \+ memberchk(H, NodeList), + unseen_nodes(T, NodeList, [H|UnseenAccum], Unseen). +unseen_nodes([H|T], NodeList, UnseenAccum, Unseen):- + memberchk(H, NodeList), + unseen_nodes(T, NodeList, UnseenAccum, Unseen). + +paths_list(Paths, List):- + paths_list(Paths, [], List). +paths_list([], List, List). +paths_list([H|T], ListAccum, List):- + unseen_nodes(H, ListAccum, Unseen), + append(ListAccum, Unseen, ListAccum0), + paths_list(T, ListAccum0, List). + +print_list([H|[]]):- + format("~d~n", [H]). +print_list([H|T]):- + format("~d -> ", [H]), + print_list(T). + +main:- + findall(Path0, dfs(1,[r(1,[2]),r(1,[3]),r(2,[4,5]),r(5,[6,7])], Path0), Paths0), + paths_list(Paths0, List), + print_list(List), halt. -- cgit From 52bd254fc3da53054d1b30f2a2dc9fe46506ddff Mon Sep 17 00:00:00 2001 From: Kang-min Liu Date: Sun, 10 Jan 2021 18:19:28 +0900 Subject: a naive solution to pwc 094.1 --- challenge-094/gugod/raku/ch-1.raku | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 challenge-094/gugod/raku/ch-1.raku diff --git a/challenge-094/gugod/raku/ch-1.raku b/challenge-094/gugod/raku/ch-1.raku new file mode 100644 index 0000000000..53ce4283e9 --- /dev/null +++ b/challenge-094/gugod/raku/ch-1.raku @@ -0,0 +1,26 @@ +sub MAIN { + my %g = group-anagrams( ['x'] ); + say %g.gist; + + %g = group-anagrams( ["opt", "bat", "saw", "tab", "pot", "top", "was"] ); + say %g.gist; +} + +sub group-anagrams (@S) { + my %groups; + for @S -> $s { + my $group = %groups.keys.first(-> $it { is-anagram($s, $it) }); + unless $group.defined { + $group = $s; + %groups{$group} = []; + } + %groups{$group}.push($s); + } + return %groups; +} + +sub is-anagram (Str $a, Str $b) { + return False unless $a.chars == $b.chars; + + return $a.comb.sort eq $b.comb.sort +} -- cgit From 09ece01f0d66a0d3a71e5a3132e2b8ea2ad74bda Mon Sep 17 00:00:00 2001 From: Jan Krňávek Date: Sun, 10 Jan 2021 10:44:46 +0100 Subject: solutions week 094 --- challenge-094/wambash/raku/ch-1.raku | 17 +++++++++++++++++ challenge-094/wambash/raku/ch-2.raku | 11 +++++++++++ 2 files changed, 28 insertions(+) create mode 100644 challenge-094/wambash/raku/ch-1.raku create mode 100644 challenge-094/wambash/raku/ch-2.raku diff --git a/challenge-094/wambash/raku/ch-1.raku b/challenge-094/wambash/raku/ch-1.raku new file mode 100644 index 0000000000..44057201fd --- /dev/null +++ b/challenge-094/wambash/raku/ch-1.raku @@ -0,0 +1,17 @@ +#!/usr/bin/env raku + +sub group-anagrams ( +@s ) { + @s + andthen .classify: *.comb.Bag +} + +multi MAIN (Bool :$test!) { + use Test; + is group-anagrams().values, ; + is-deeply group-anagrams().values.sort,(, , ).map(*.Array).sort; + done-testing +} + +multi MAIN ( *@s ) { + say group-anagrams(@s).values +} diff --git a/challenge-094/wambash/raku/ch-2.raku b/challenge-094/wambash/raku/ch-2.raku new file mode 100644 index 0000000000..c862844ba1 --- /dev/null +++ b/challenge-094/wambash/raku/ch-2.raku @@ -0,0 +1,11 @@ +#!/usr/bin/env raku + +sub binary-tree-to-linked-list ( @a ) { + gather { @a.deepmap: *.take } +} + +sub MAIN (Bool :$test!) { + use Test; + is-deeply binary-tree-to-linked-list( (1, (2,(4,(5,6,7))), 3) ), (1,2,4,5,6,7,3); + done-testing; +} -- cgit From dfe8a019307978e28ac02f01c383f54d78c7eebb Mon Sep 17 00:00:00 2001 From: Kang-min Liu Date: Sun, 10 Jan 2021 18:45:42 +0900 Subject: a naive solution to pwc 094.2 --- challenge-094/gugod/raku/ch-2.raku | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 challenge-094/gugod/raku/ch-2.raku diff --git a/challenge-094/gugod/raku/ch-2.raku b/challenge-094/gugod/raku/ch-2.raku new file mode 100644 index 0000000000..73ed60400d --- /dev/null +++ b/challenge-094/gugod/raku/ch-2.raku @@ -0,0 +1,77 @@ +class IntBinaryTree { + has Int $.payload; + has IntBinaryTree $.left-child; + has IntBinaryTree $.right-child; +} + +class IntLinkedList { + has Int $.payload; + has IntLinkedList $.next; + + method set-next (IntLinkedList $n) { + $!next = $n; + } +} + +sub MAIN { + my $tree = IntBinaryTree.new( + :payload(1), + :left-child( + IntBinaryTree.new( + :payload(2), + :left-child(IntBinaryTree.new(:payload(4))), + :right-child( + IntBinaryTree.new( + :payload(5), + :left-child(IntBinaryTree.new(:payload(6))), + :right-child(IntBinaryTree.new(:payload(7))), + ) + ) + ) + ), + :right-child( + IntBinaryTree.new(:payload(3)) + ) + ); + + my $x = binary-tree-to-linked-list($tree); + say preview($x); +} + +sub binary-tree-to-linked-list (IntBinaryTree $tree) { + my $head = IntLinkedList.new(:payload( $tree.payload )); + my $tail = $head; + + if $tree.left-child { + my $sub-list = binary-tree-to-linked-list($tree.left-child); + $tail.set-next: $sub-list; + + while $tail.next.defined { + $tail = $tail.next; + } + } + + if $tree.right-child { + my $sub-list = binary-tree-to-linked-list($tree.right-child); + $tail.set-next: $sub-list; + + while $tail.next.defined { + $tail = $tail.next; + } + } + + return $head; +} + +sub preview (IntLinkedList $s) { + my $it = $s; + + my $out = $it.payload; + $it = $it.next; + while $it.defined { + $out ~= "->" ~ $it.payload; + $it = $it.next; + } + return $out; +} + -- cgit From 5ce2cd05a7d8a22822bd24a5a751fb8c7b379aa5 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Sun, 10 Jan 2021 10:14:14 +0000 Subject: - Added solutions by Jan Krnavek. - Added solutions to week 7 by Paulo Custodio. --- stats/pwc-challenge-007.json | 265 ++++++----- stats/pwc-current.json | 343 +++++++------- stats/pwc-language-breakdown-summary.json | 54 +-- stats/pwc-language-breakdown.json | 750 +++++++++++++++--------------- stats/pwc-leaders.json | 372 +++++++-------- stats/pwc-summary-1-30.json | 106 ++--- stats/pwc-summary-121-150.json | 58 +-- stats/pwc-summary-151-180.json | 106 ++--- stats/pwc-summary-181-210.json | 42 +- stats/pwc-summary-211-240.json | 30 +- stats/pwc-summary-31-60.json | 102 ++-- stats/pwc-summary-61-90.json | 40 +- stats/pwc-summary-91-120.json | 24 +- stats/pwc-summary.json | 468 +++++++++---------- 14 files changed, 1395 insertions(+), 1365 deletions(-) diff --git a/stats/pwc-challenge-007.json b/stats/pwc-challenge-007.json index eb696d2642..e574606f0c 100644 --- a/stats/pwc-challenge-007.json +++ b/stats/pwc-challenge-007.json @@ -1,35 +1,16 @@ { - "xAxis" : { - "type" : "category" - }, - "plotOptions" : { - "series" : { - "borderWidth" : 0, - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - } - } - }, - "legend" : { - "enabled" : 0 - }, - "title" : { - "text" : "Perl Weekly Challenge - 007" - }, "series" : [ { - "name" : "Perl Weekly Challenge - 007", "colorByPoint" : 1, "data" : [ { "name" : "Adam Russell", - "drilldown" : "Adam Russell", - "y" : 3 + "y" : 3, + "drilldown" : "Adam Russell" }, { - "y" : 1, "drilldown" : "Alicia Bielsa", + "y" : 1, "name" : "Alicia Bielsa" }, { @@ -38,39 +19,39 @@ "name" : "Andrezgz" }, { + "drilldown" : "Arne Sommer", "y" : 3, - "name" : "Arne Sommer", - "drilldown" : "Arne Sommer" + "name" : "Arne Sommer" }, { - "y" : 2, + "name" : "Athanasius", "drilldown" : "Athanasius", - "name" : "Athanasius" + "y" : 2 }, { - "y" : 2, "drilldown" : "Daniel Mantovani", + "y" : 2, "name" : "Daniel Mantovani" }, { + "drilldown" : "Dave Jacoby", "y" : 4, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" + "name" : "Dave Jacoby" }, { - "drilldown" : "E. Choroba", "name" : "E. Choroba", - "y" : 3 + "y" : 3, + "drilldown" : "E. Choroba" }, { "y" : 2, - "name" : "Finley", - "drilldown" : "Finley" + "drilldown" : "Finley", + "name" : "Finley" }, { + "name" : "Francis Whittle", "y" : 2, - "drilldown" : "Francis Whittle", - "name" : "Francis Whittle" + "drilldown" : "Francis Whittle" }, { "name" : "Guillermo Ramos", @@ -79,13 +60,13 @@ }, { "y" : 2, - "name" : "Gustavo Chaves", - "drilldown" : "Gustavo Chaves" + "drilldown" : "Gustavo Chaves", + "name" : "Gustavo Chaves" }, { - "y" : 4, + "name" : "Jaldhar H. Vyas", "drilldown" : "Jaldhar H. Vyas", - "name" : "Jaldhar H. Vyas" + "y" : 4 }, { "name" : "Jo Christian Oterhals", @@ -94,22 +75,22 @@ }, { "name" : "Joelle Maslak", - "drilldown" : "Joelle Maslak", - "y" : 4 + "y" : 4, + "drilldown" : "Joelle Maslak" }, { - "y" : 3, "drilldown" : "Kian-Meng Ang", + "y" : 3, "name" : "Kian-Meng Ang" }, { - "y" : 6, + "name" : "Laurent Rosenfeld", "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" + "y" : 6 }, { - "drilldown" : "Luis F. Uceta", "name" : "Luis F. Uceta", + "drilldown" : "Luis F. Uceta", "y" : 2 }, { @@ -119,42 +100,77 @@ }, { "drilldown" : "Maxim Nechaev", - "name" : "Maxim Nechaev", - "y" : 2 + "y" : 2, + "name" : "Maxim Nechaev" }, { "y" : 1, - "name" : "Ozzy", - "drilldown" : "Ozzy" + "drilldown" : "Ozzy", + "name" : "Ozzy" + }, + { + "name" : "Paulo Custodio", + "drilldown" : "Paulo Custodio", + "y" : 2 }, { - "name" : "Ruben Westerberg", + "y" : 4, "drilldown" : "Ruben Westerberg", - "y" : 4 + "name" : "Ruben Westerberg" }, { - "name" : "Ryan Thompson", "drilldown" : "Ryan Thompson", - "y" : 2 + "y" : 2, + "name" : "Ryan Thompson" }, { "name" : "Simon Proctor", - "drilldown" : "Simon Proctor", - "y" : 1 + "y" : 1, + "drilldown" : "Simon Proctor" }, { - "y" : 2, "name" : "Stuart Little", - "drilldown" : "Stuart Little" + "drilldown" : "Stuart Little", + "y" : 2 } - ] + ], + "name" : "Perl Weekly Challenge - 007" } ], + "subtitle" : { + "text" : "[Champions: 26] Last updated at 2021-01-10 10:12:45 GMT" + }, + "tooltip" : { + "headerFormat" : "{series.name}
", + "followPointer" : 1, + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "enabled" : 1, + "format" : "{point.y}" + }, + "borderWidth" : 0 + } + }, + "chart" : { + "type" : "column" + }, + "xAxis" : { + "type" : "category" + }, + "title" : { + "text" : "Perl Weekly Challenge - 007" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, "drilldown" : { "series" : [ { - "id" : "Adam Russell", - "name" : "Adam Russell", "data" : [ [ "Perl", @@ -164,7 +180,9 @@ "Blog", 1 ] - ] + ], + "name" : "Adam Russell", + "id" : "Adam Russell" }, { "name" : "Alicia Bielsa", @@ -177,8 +195,8 @@ ] }, { - "id" : "Andrezgz", "name" : "Andrezgz", + "id" : "Andrezgz", "data" : [ [ "Perl", @@ -187,6 +205,8 @@ ] }, { + "name" : "Arne Sommer", + "id" : "Arne Sommer", "data" : [ [ "Raku", @@ -196,29 +216,27 @@ "Blog", 1 ] - ], - "id" : "Arne Sommer", - "name" : "Arne Sommer" + ] }, { + "name" : "Athanasius", + "id" : "Athanasius", "data" : [ [ "Perl", 2 ] - ], - "name" : "Athanasius", - "id" : "Athanasius" + ] }, { - "name" : "Daniel Mantovani", - "id" : "Daniel Mantovani", "data" : [ [ "Perl", 2 ] - ] + ], + "id" : "Daniel Mantovani", + "name" : "Daniel Mantovani" }, { "name" : "Dave Jacoby", @@ -235,6 +253,8 @@ ] }, { + "name" : "E. Choroba", + "id" : "E. Choroba", "data" : [ [ "Perl", @@ -244,9 +264,7 @@ "Blog", 1 ] - ], - "name" : "E. Choroba", - "id" : "E. Choroba" + ] }, { "data" : [ @@ -255,8 +273,8 @@ 2 ] ], - "name" : "Finley", - "id" : "Finley" + "id" : "Finley", + "name" : "Finley" }, { "data" : [ @@ -265,8 +283,8 @@ 2 ] ], - "id" : "Francis Whittle", - "name" : "Francis Whittle" + "name" : "Francis Whittle", + "id" : "Francis Whittle" }, { "data" : [ @@ -275,8 +293,8 @@ 1 ] ], - "id" : "Guillermo Ramos", - "name" : "Guillermo Ramos" + "name" : "Guillermo Ramos", + "id" : "Guillermo Ramos" }, { "data" : [ @@ -289,8 +307,6 @@ "name" : "Gustavo Chaves" }, { - "id" : "Jaldhar H. Vyas", - "name" : "Jaldhar H. Vyas", "data" : [ [ "Perl", @@ -300,7 +316,9 @@ "Raku", 2 ] - ] + ], + "id" : "Jaldhar H. Vyas", + "name" : "Jaldhar H. Vyas" }, { "data" : [ @@ -313,12 +331,10 @@ 1 ] ], - "id" : "Jo Christian Oterhals", - "name" : "Jo Christian Oterhals" + "name" : "Jo Christian Oterhals", + "id" : "Jo Christian Oterhals" }, { - "name" : "Joelle Maslak", - "id" : "Joelle Maslak", "data" : [ [ "Perl", @@ -328,9 +344,13 @@ "Raku", 2 ] - ] + ], + "name" : "Joelle Maslak", + "id" : "Joelle Maslak" }, { + "id" : "Kian-Meng Ang", + "name" : "Kian-Meng Ang", "data" : [ [ "Perl", @@ -340,9 +360,7 @@ "Blog", 2 ] - ], - "name" : "Kian-Meng Ang", - "id" : "Kian-Meng Ang" + ] }, { "data" : [ @@ -359,22 +377,22 @@ 2 ] ], - "name" : "Laurent Rosenfeld", - "id" : "Laurent Rosenfeld" + "id" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld" }, { - "name" : "Luis F. Uceta", - "id" : "Luis F. Uceta", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Luis F. Uceta", + "id" : "Luis F. Uceta" }, { - "id" : "Max Kossek", "name" : "Max Kossek", + "id" : "Max Kossek", "data" : [ [ "Perl", @@ -383,14 +401,14 @@ ] }, { + "name" : "Maxim Nechaev", + "id" : "Maxim Nechaev", "data" : [ [ "Perl", 2 ] - ], - "name" : "Maxim Nechaev", - "id" : "Maxim Nechaev" + ] }, { "id" : "Ozzy", @@ -403,8 +421,16 @@ ] }, { - "name" : "Ruben Westerberg", - "id" : "Ruben Westerberg", + "name" : "Paulo Custodio", + "id" : "Paulo Custodio", + "data" : [ + [ + "Perl", + 2 + ] + ] + }, + { "data" : [ [ "Perl", @@ -414,11 +440,11 @@ "Raku", 2 ] - ] + ], + "name" : "Ruben Westerberg", + "id" : "Ruben Westerberg" }, { - "id" : "Ryan Thompson", - "name" : "Ryan Thompson", "data" : [ [ "Perl", @@ -428,11 +454,13 @@ "Raku", 1 ] - ] + ], + "id" : "Ryan Thompson", + "name" : "Ryan Thompson" }, { - "id" : "Simon Proctor", "name" : "Simon Proctor", + "id" : "Simon Proctor", "data" : [ [ "Raku", @@ -441,31 +469,18 @@ ] }, { - "id" : "Stuart Little", - "name" : "Stuart Little", "data" : [ [ "Raku", 2 ] - ] + ], + "name" : "Stuart Little", + "id" : "Stuart Little" } ] }, - "subtitle" : { - "text" : "[Champions: 25] Last updated at 2020-11-26 21:47:34 GMT" - }, - "chart" : { - "type" : "column" - }, - "tooltip" : { - "pointFormat" : "{point.name}: {point.y:f}
", - "headerFormat" : "{series.name}
", - "followPointer" : 1 - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } + "legend" : { + "enabled" : 0 } } diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 8d55be9694..62daefe391 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -2,6 +2,19 @@ "xAxis" : { "type" : "category" }, + "tooltip" : { + "headerFormat" : "{series.name}
", + "followPointer" : 1, + "pointFormat" : "{point.name}: {point.y:f}
" + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "title" : { + "text" : "Perl Weekly Challenge - 094" + }, "plotOptions" : { "series" : { "dataLabels" : { @@ -11,138 +24,14 @@ "borderWidth" : 0 } }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 094", - "data" : [ - { - "name" : "Arne Sommer", - "drilldown" : "Arne Sommer", - "y" : 3 - }, - { - "drilldown" : "Cheok-Yin Fung", - "y" : 3, - "name" : "Cheok-Yin Fung" - }, - { - "y" : 3, - "drilldown" : "Dave Jacoby", - "name" : "Dave Jacoby" - }, - { - "drilldown" : "E. Choroba", - "y" : 2, - "name" : "E. Choroba" - }, - { - "drilldown" : "Flavio Poletti", - "y" : 4, - "name" : "Flavio Poletti" - }, - { - "name" : "Gustavo Chaves", - "drilldown" : "Gustavo Chaves", - "y" : 2 - }, - { - "name" : "James Smith", - "drilldown" : "James Smith", - "y" : 3 - }, - { - "name" : "Jorg Sommrey", - "y" : 2, - "drilldown" : "Jorg Sommrey" - }, - { - "y" : 5, - "drilldown" : "Laurent Rosenfeld", - "name" : "Laurent Rosenfeld" - }, - { - "name" : "Lubos Kolouch", - "y" : 2, - "drilldown" : "Lubos Kolouch" - }, - { - "drilldown" : "Luca Ferrari", - "y" : 4, - "name" : "Luca Ferrari" - }, - { - "name" : "Niels van Dijke", - "drilldown" : "Niels van Dijke", - "y" : 2 - }, - { - "name" : "Nuno Vieira", - "y" : 2, - "drilldown" : "Nuno Vieira" - }, - { - "name" : "Paulo Custodio", - "y" : 2, - "drilldown" : "Paulo Custodio" - }, - { - "name" : "Philip Hood", - "y" : 1, - "drilldown" : "Philip Hood" - }, - { - "y" : 5, - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West" - }, - { - "name" : "Simon Green", - "drilldown" : "Simon Green", - "y" : 3 - }, - { - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor", - "y" : 1 - }, - { - "drilldown" : "Stuart Little", - "y" : 2, - "name" : "Stuart Little" - }, - { - "drilldown" : "Ulrich Rieke", - "y" : 2, - "name" : "Ulrich Rieke" - }, - { - "drilldown" : "W. Luis Mochan", - "y" : 3, - "name" : "W. Luis Mochan" - } - ] - } - ], - "chart" : { - "type" : "column" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "legend" : { - "enabled" : 0 - }, "subtitle" : { - "text" : "[Champions: 21] Last updated at 2021-01-10 07:22:36 GMT" + "text" : "[Champions: 22] Last updated at 2021-01-10 10:13:32 GMT" }, "drilldown" : { "series" : [ { - "name" : "Arne Sommer", "id" : "Arne Sommer", + "name" : "Arne Sommer", "data" : [ [ "Raku", @@ -165,8 +54,8 @@ 1 ] ], - "id" : "Cheok-Yin Fung", - "name" : "Cheok-Yin Fung" + "name" : "Cheok-Yin Fung", + "id" : "Cheok-Yin Fung" }, { "data" : [ @@ -183,14 +72,14 @@ "id" : "Dave Jacoby" }, { + "id" : "E. Choroba", + "name" : "E. Choroba", "data" : [ [ "Perl", 2 ] - ], - "name" : "E. Choroba", - "id" : "E. Choroba" + ] }, { "data" : [ @@ -207,18 +96,18 @@ "id" : "Flavio Poletti" }, { - "name" : "Gustavo Chaves", - "id" : "Gustavo Chaves", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Gustavo Chaves", + "id" : "Gustavo Chaves" }, { - "id" : "James Smith", "name" : "James Smith", + "id" : "James Smith", "data" : [ [ "Perl", @@ -231,14 +120,24 @@ ] }, { + "id" : "Jan Krnavek", + "name" : "Jan Krnavek", "data" : [ [ - "Perl", + "Raku", 2 ] - ], + ] + }, + { + "id" : "Jorg Sommrey", "name" : "Jorg Sommrey", - "id" : "Jorg Sommrey" + "data" : [ + [ + "Perl", + 2 + ] + ] }, { "data" : [ @@ -283,14 +182,14 @@ ] }, { + "name" : "Niels van Dijke", + "id" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ], - "id" : "Niels van Dijke", - "name" : "Niels van Dijke" + ] }, { "data" : [ @@ -299,12 +198,12 @@ 2 ] ], - "id" : "Nuno Vieira", - "name" : "Nuno Vieira" + "name" : "Nuno Vieira", + "id" : "Nuno Vieira" }, { - "name" : "Paulo Custodio", "id" : "Paulo Custodio", + "name" : "Paulo Custodio", "data" : [ [ "Perl", @@ -323,8 +222,6 @@ ] }, { - "id" : "Roger Bell_West", - "name" : "Roger Bell_West", "data" : [ [ "Perl", @@ -338,9 +235,13 @@ "Blog", 1 ] - ] + ], + "name" : "Roger Bell_West", + "id" : "Roger Bell_West" }, { + "name" : "Simon Green", + "id" : "Simon Green", "data" : [ [ "Perl", @@ -350,9 +251,7 @@ "Blog", 1 ] - ], - "id" : "Simon Green", - "name" : "Simon Green" + ] }, { "data" : [ @@ -361,8 +260,8 @@ 1 ] ], - "name" : "Simon Proctor", - "id" : "Simon Proctor" + "id" : "Simon Proctor", + "name" : "Simon Proctor" }, { "id" : "Stuart Little", @@ -385,12 +284,10 @@ 1 ] ], - "name" : "Ulrich Rieke", - "id" : "Ulrich Rieke" + "id" : "Ulrich Rieke", + "name" : "Ulrich Rieke" }, { - "name" : "W. Luis Mochan", - "id" : "W. Luis Mochan", "data" : [ [ "Perl", @@ -400,16 +297,134 @@ "Blog", 1 ] - ] + ], + "id" : "W. Luis Mochan", + "name" : "W. Luis Mochan" } ] }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
", - "followPointer" : 1 + "chart" : { + "type" : "column" }, - "title" : { - "text" : "Perl Weekly Challenge - 094" - } + "legend" : { + "enabled" : 0 + }, + "series" : [ + { + "name" : "Perl Weekly Challenge - 094", + "colorByPoint" : 1, + "data" : [ + { + "name" : "Arne Sommer", + "drilldown" : "Arne Sommer", + "y" : 3 + }, + { + "y" : 3, + "drilldown" : "Cheok-Yin Fung", + "name" : "Cheok-Yin Fung" + }, + { + "y" : 3, + "drilldown" : "Dave Jacoby", + "name" : "Dave Jacoby" + }, + { + "y" : 2, + "drilldown" : "E. Choroba", + "name" : "E. Choroba" + }, + { + "drilldown" : "Flavio Poletti", + "name" : "Flavio Poletti", + "y" : 4 + }, + { + "y" : 2, + "name" : "Gustavo Chaves", + "drilldown" : "Gustavo Chaves" + }, + { + "drilldown" : "James Smith", + "name" : "James Smith", + "y" : 3 + }, + { + "y" : 2, + "drilldown" : "Jan Krnavek", + "name" : "Jan Krnavek" + }, + { + "name" : "Jorg Sommrey", + "drilldown" : "Jorg Sommrey", + "y" : 2 + }, + { + "y" : 5, + "name" : "Laurent Rosenfeld", + "drilldown" : "Laurent Rosenfeld" + }, + { + "y" : 2, + "drilldown" : "Lubos Kolouch", + "name" : "Lubos Kolouch" + }, + { + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari", + "y" : 4 + }, + { + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke", + "y" : 2 + }, + { + "drilldown" : "Nuno Vieira", + "name" : "Nuno Vieira", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Paulo Custodio", + "name" : "Paulo Custodio" + }, + { + "name" : "Philip Hood", + "drilldown" : "Philip Hood", + "y" : 1 + }, + { + "name" : "Roger Bell_West", + "drilldown" : "Roger Bell_West", + "y" : 5 + }, + { + "drilldown" : "Simon Green", + "name" : "Simon Green", + "y" : 3 + }, + { + "drilldown" : "Simon Proctor", + "name" : "Simon Proctor", + "y" : 1 + }, + { + "y" : 2, + "name" : "Stuart Little", + "drilldown" : "Stuart Little" + }, + { + "drilldown" : "Ulrich Rieke", + "name" : "Ulrich Rieke", + "y" : 2 + }, + { + "name" : "W. Luis Mochan", + "drilldown" : "W. Luis Mochan", + "y" : 3 + } + ] + } + ] } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index f4e583e9e9..c298f91a28 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,18 +1,18 @@ { - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" - }, - "subtitle" : { - "text" : "Last updated at 2021-01-10 07:22:36 GMT" - }, "tooltip" : { "pointFormat" : "{point.y:.0f}" }, - "chart" : { - "type" : "column" + "xAxis" : { + "labels" : { + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + } + }, + "type" : "category" }, - "legend" : { - "enabled" : "false" + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, "yAxis" : { "title" : { @@ -20,20 +20,29 @@ }, "min" : 0 }, + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : "false" + }, + "subtitle" : { + "text" : "Last updated at 2021-01-10 10:13:32 GMT" + }, "series" : [ { "name" : "Contributions", "dataLabels" : { - "align" : "right", - "format" : "{point.y:.0f}", - "rotation" : -90, + "enabled" : "true", "style" : { "fontFamily" : "Verdana, sans-serif", "fontSize" : "13px" }, - "enabled" : "true", + "format" : "{point.y:.0f}", "y" : 10, - "color" : "#FFFFFF" + "rotation" : -90, + "color" : "#FFFFFF", + "align" : "right" }, "data" : [ [ @@ -42,22 +51,13 @@ ], [ "Perl", - 4301 + 4303 ], [ "Raku", - 2834 + 2836 ] ] } - ], - "xAxis" : { - "type" : "category", - "labels" : { - "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" - } - } - } + ] } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index de7795e784..f5d73d9fea 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,16 +1,6 @@ { - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, "series" : [ { - "name" : "Perl Weekly Challenge Languages", "colorByPoint" : "true", "data" : [ { @@ -19,79 +9,79 @@ "name" : "#001" }, { - "y" : 118, + "name" : "#002", "drilldown" : "002", - "name" : "#002" + "y" : 118 }, { "name" : "#003", - "y" : 75, - "drilldown" : "003" + "drilldown" : "003", + "y" : 75 }, { "y" : 95, - "drilldown" : "004", - "name" : "#004" + "name" : "#004", + "drilldown" : "004" }, { - "y" : 76, + "name" : "#005", "drilldown" : "005", - "name" : "#005" + "y" : 76 }, { - "y" : 56, + "name" : "#006", "drilldown" : "006", - "name" : "#006" + "y" : 56 }, { + "y" : 63, "name" : "#007", - "y" : 61, "drilldown" : "007" }, { - "name" : "#008", + "y" : 74, "drilldown" : "008", - "y" : 74 + "name" : "#008" }, { "y" : 72, - "drilldown" : "009", - "name" : "#009" + "name" : "#009", + "drilldown" : "009" }, { "y" : 62, - "drilldown" : "010", - "name" : "#010" + "name" : "#010", + "drilldown" : "010" }, { - "y" : 81, + "name" : "#011", "drilldown" : "011", - "name" : "#011" + "y" : 81 }, { - "name" : "#012", "y" : 85, - "drilldown" : "012" + "drilldown" : "012", + "name" : "#012" }, { - "drilldown" : "013", "y" : 80, + "drilldown" : "013", "name" : "#013" }, { "y" : 98, - "drilldown" : "014", - "name" : "#014" + "name" : "#014", + "drilldown" : "014" }, { + "name" : "#015", "drilldown" : "015", - "y" : 95, - "name" : "#015" + "y" : 95 }, { - "drilldown" : "016", "y" : 68, - "name" : "#016" + "name" : "#016", + "drilldown" : "016" }, { "name" : "#017", @@ -99,19 +89,19 @@ "y" : 81 }, { + "y" : 78, "name" : "#018", - "drilldown" : "018", - "y" : 78 + "drilldown" : "018" }, { + "name" : "#019", "drilldown" : "019", - "y" : 99, - "name" : "#019" + "y" : 99 }, { - "y" : 97, + "name" : "#020", "drilldown" : "020", - "name" : "#020" + "y" : 97 }, { "y" : 69, @@ -119,13 +109,13 @@ "name" : "#021" }, { + "drilldown" : "022", "name" : "#022", - "y" : 65, - "drilldown" : "022" + "y" : 65 }, { - "drilldown" : "023", "y" : 93, + "drilldown" : "023", "name" : "#023" }, { @@ -134,24 +124,24 @@ "name" : "#024" }, { + "name" : "#025", "drilldown" : "025", - "y" : 57, - "name" : "#025" + "y" : 57 }, { + "drilldown" : "026", "name" : "#026", - "y" : 72, - "drilldown" : "026" + "y" : 72 }, { - "drilldown" : "027", "y" : 60, - "name" : "#027" + "name" : "#027", +