From 11e416f9affc72c71faa21962410fcd8062d7a04 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Wed, 2 Sep 2020 18:18:49 -0400 Subject: perl code for challenge 76 task 1 Initial draft. I added the sieve code and started processing it, but then I realized that once I had the prime factors this was the same problem as last week's task 1. So I backed that code out. Now to use last week's code... --- challenge-076/walt-mankowski/perl/ch-1.pl | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 challenge-076/walt-mankowski/perl/ch-1.pl diff --git a/challenge-076/walt-mankowski/perl/ch-1.pl b/challenge-076/walt-mankowski/perl/ch-1.pl new file mode 100644 index 0000000000..bd19d3acfb --- /dev/null +++ b/challenge-076/walt-mankowski/perl/ch-1.pl @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use feature qw(:5.32); +use experimental qw(signatures); + +# TASK #1 › Prime Sum +# Submitted by: Mohammad S Anwar +# Reviewed by: Ryan Thompson +# +# You are given a number $N. Write a script to find the minimum number +# of prime numbers required, whose summation gives you $N. +# +# For the sake of this task, please assume 1 is not a prime number. +# Example: +# +# Input: +# $N = 9 +# +# Ouput: +# 2 as sum of 2 prime numbers i.e. 2 and 7 is same as the input number. +# 2 + 7 = 9. + +# compute primes up to $n using the Sieve of Eratosthenes +sub primes_upto($n) { + my @is_prime = map {1} (0..$n); + $is_prime[0] = $is_prime[1] = 0; + + for my $i (2..$n) { + if ($is_prime[$i]) { + for (my $j = $i * 2; $j <= $n; $j += $i) { + $is_prime[$j] = 0; + } + } + } + return grep {$is_prime[$_]} 2..$n; +} + +my $n = shift @ARGV; +my @primes = primes_upto($n); -- cgit From 6ccd0e432efb85605adceb674f976e1d806c10e7 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Wed, 2 Sep 2020 18:43:42 -0400 Subject: added coin counting code from last week's challenge This turns out to be quite slow even for n=100. I'm tempted to use Goldbach's conjecture to limit it to 2 or 3, but I don't think I'm going to have time. --- challenge-076/walt-mankowski/perl/ch-1.pl | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/challenge-076/walt-mankowski/perl/ch-1.pl b/challenge-076/walt-mankowski/perl/ch-1.pl index bd19d3acfb..d4c8673a2d 100644 --- a/challenge-076/walt-mankowski/perl/ch-1.pl +++ b/challenge-076/walt-mankowski/perl/ch-1.pl @@ -3,6 +3,7 @@ use strict; use warnings; use feature qw(:5.32); use experimental qw(signatures); +use List::Util qw(sum); # TASK #1 › Prime Sum # Submitted by: Mohammad S Anwar @@ -36,5 +37,66 @@ sub primes_upto($n) { return grep {$is_prime[$_]} 2..$n; } +sub value($c, $cnt) { + my $sum = 0; + for my $i (0..$#$c) { + $sum += $c->[$i] * $cnt->[$i]; + } + return $sum; +} + +sub sums($s, @c) { + my @solutions; + + my @cnt = map {0} 0..$#c; + while (1) { + my $val = value(\@c, \@cnt); + if ($val >= $s) { + if ($val == $s) { + my @tmp = @cnt; + push @solutions, \@tmp; + } + + # rotate "odometer" + $cnt[-1] = 0; + my $i = -2; + $cnt[$i]++; + while ($i >= -@c && value(\@c, \@cnt) > $s) { + $cnt[$i] = 0; + $i--; + $cnt[$i]++ if $i >= -@c; + } + last if $i < -@c; + } else { + $cnt[-1]++; + } + } + return @solutions; +} + my $n = shift @ARGV; my @primes = primes_upto($n); +my @solutions = sums($n, @primes); +say "primes: @primes"; + +# find indices of best solution +my $min = 1e300; +my @best; +for my $i (0..$#solutions) { + my $sum = sum $solutions[$i]->@*; + if ($sum < $min) { + $min = $sum; + @best = ($i); + } elsif ($sum == $min) { + push @best, $i; + } +} + +# print out the solutions +for my $i (@best) { + my @p; + for my $j (0..$#primes) { + push @p, ($primes[$j]) x $solutions[$i][$j] if $solutions[$i][$j]; + } + say join " + ", @p; +} -- cgit From efb91c982b908daebdf92f9d04094c91d6678c73 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Wed, 2 Sep 2020 22:08:22 -0400 Subject: Simplified code by assuming Goldbach Conjecture is true --- challenge-076/walt-mankowski/perl/ch-1.pl | 68 ++++++++----------------------- 1 file changed, 16 insertions(+), 52 deletions(-) diff --git a/challenge-076/walt-mankowski/perl/ch-1.pl b/challenge-076/walt-mankowski/perl/ch-1.pl index d4c8673a2d..d2939f19ff 100644 --- a/challenge-076/walt-mankowski/perl/ch-1.pl +++ b/challenge-076/walt-mankowski/perl/ch-1.pl @@ -4,6 +4,7 @@ use warnings; use feature qw(:5.32); use experimental qw(signatures); use List::Util qw(sum); +use Algorithm::Combinatorics qw(combinations_with_repetition); # TASK #1 › Prime Sum # Submitted by: Mohammad S Anwar @@ -37,38 +38,20 @@ sub primes_upto($n) { return grep {$is_prime[$_]} 2..$n; } -sub value($c, $cnt) { - my $sum = 0; - for my $i (0..$#$c) { - $sum += $c->[$i] * $cnt->[$i]; - } - return $sum; -} - -sub sums($s, @c) { +sub sums_goldbach($s, $k, @primes) { my @solutions; + my $best = 1e300; - my @cnt = map {0} 0..$#c; - while (1) { - my $val = value(\@c, \@cnt); - if ($val >= $s) { - if ($val == $s) { - my @tmp = @cnt; - push @solutions, \@tmp; - } - - # rotate "odometer" - $cnt[-1] = 0; - my $i = -2; - $cnt[$i]++; - while ($i >= -@c && value(\@c, \@cnt) > $s) { - $cnt[$i] = 0; - $i--; - $cnt[$i]++ if $i >= -@c; - } - last if $i < -@c; - } else { - $cnt[-1]++; + my $iter = combinations_with_repetition([0, @primes], $k); + while (my $p = $iter->next) { + my @digits = grep(!/^0$/, $p->@*); + next unless @digits; + next unless sum(@digits) == $s; + if (@digits < $best) { + @solutions = (join " + ", @digits); + $best = @digits; + } elsif (@digits == $best) { + push @solutions, join " + ", @digits; } } return @solutions; @@ -76,27 +59,8 @@ sub sums($s, @c) { my $n = shift @ARGV; my @primes = primes_upto($n); -my @solutions = sums($n, @primes); say "primes: @primes"; -# find indices of best solution -my $min = 1e300; -my @best; -for my $i (0..$#solutions) { - my $sum = sum $solutions[$i]->@*; - if ($sum < $min) { - $min = $sum; - @best = ($i); - } elsif ($sum == $min) { - push @best, $i; - } -} - -# print out the solutions -for my $i (@best) { - my @p; - for my $j (0..$#primes) { - push @p, ($primes[$j]) x $solutions[$i][$j] if $solutions[$i][$j]; - } - say join " + ", @p; -} +my $k = $n % 2 == 0 ? 2 : 3; +my @solutions = sums_goldbach($n, $k, @primes); +say join "\n", @solutions; -- cgit From 547803013c605082d977b850974be03420de6539 Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Thu, 3 Sep 2020 21:17:52 -0400 Subject: first draft of perl for for challenge 76 task 2 reading in the grid --- challenge-076/walt-mankowski/perl/ch-2.pl | 62 +++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 challenge-076/walt-mankowski/perl/ch-2.pl diff --git a/challenge-076/walt-mankowski/perl/ch-2.pl b/challenge-076/walt-mankowski/perl/ch-2.pl new file mode 100644 index 0000000000..fba7870763 --- /dev/null +++ b/challenge-076/walt-mankowski/perl/ch-2.pl @@ -0,0 +1,62 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use feature qw(:5.32); +use experimental qw(signatures); +use autodie; + +# TASK #2 › Word Search +# Submitted by: Neil Bowers +# Reviewed by: Ryan Thompson +# +# Write a script that takes two file names. The first file would +# contain word search grid as shown below. The second file contains +# list of words, one word per line. You could even use local +# dictionary file. +# +# Print out a list of all words seen on the grid, looking both +# orthogonally and diagonally, backwards as well as forwards. +# +# Output +# Found 54 words of length 5 or more when checked against the local +# dictionary. You may or may not get the same result but that is fine. + +my $MIN_LEN = 5; +my ($grid_name, $dict_name) = @ARGV; +my $grid = read_grid($grid_name); +for my $row ($grid->@*) { + $, = ", "; + say $row->@*; +} + + +sub read_grid($grid_name) { + my @grid; + open my $fh, '<', $grid_name; + my $width = 0; + my $row = 0; + while (my $line = <$fh>) { + chomp $line; + if ($width == 0) { + # make top line + $width = 2 + length($line); + for my $col (0..$width-1) { + $grid[$row][$col] = ' '; + } + $row = 1; + } + my @c = split //, $line; + $grid[$row][0] = ' '; + for my $i (0..$#c) { + $grid[$row][$i+1] = $c[$i]; + } + $grid[$row][$width-1] = ' '; + $row++; + } + # make bottom line + for my $col (0..$width-1) { + $grid[$row][$col] = ' '; + } + + return \@grid; +} -- cgit From a1e3bd722a9fe8d2725998f18c59c0989a3e37aa Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Thu, 3 Sep 2020 21:26:19 -0400 Subject: parse the dictionary into words and prefixes --- challenge-076/walt-mankowski/perl/ch-2.pl | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/challenge-076/walt-mankowski/perl/ch-2.pl b/challenge-076/walt-mankowski/perl/ch-2.pl index fba7870763..c7ab9b49cc 100644 --- a/challenge-076/walt-mankowski/perl/ch-2.pl +++ b/challenge-076/walt-mankowski/perl/ch-2.pl @@ -29,6 +29,11 @@ for my $row ($grid->@*) { say $row->@*; } +my ($words, $prefixes) = parse_dict($dict_name, $MIN_LEN); +for my $k (sort keys %$prefixes) { + say $k; +} + sub read_grid($grid_name) { my @grid; @@ -60,3 +65,21 @@ sub read_grid($grid_name) { return \@grid; } + +sub parse_dict($dict_name, $min_len) { + my %words; + my %prefixes; + + open my $fh, '<', $dict_name; + while (my $word = <$fh>) { + chomp $word; + next unless length($word) >= $min_len; + next unless $word =~ /^[a-z]+$/; + + $words{$word} = 1; + for my $len (1..length($word)) { + $prefixes{substr($word, 0, $len)} = 1; + } + } + return (\%words, \%prefixes); +} -- cgit From ccff7d7e2cd398bc83ffb9833038c615d3ec982f Mon Sep 17 00:00:00 2001 From: Walt Mankowski Date: Fri, 4 Sep 2020 06:28:15 -0400 Subject: added code to scan the grid for words This appears to be working but still needs testing and cleanup. --- challenge-076/walt-mankowski/perl/ch-2.pl | 59 +++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/challenge-076/walt-mankowski/perl/ch-2.pl b/challenge-076/walt-mankowski/perl/ch-2.pl index c7ab9b49cc..48436c9a0e 100644 --- a/challenge-076/walt-mankowski/perl/ch-2.pl +++ b/challenge-076/walt-mankowski/perl/ch-2.pl @@ -24,16 +24,45 @@ use autodie; my $MIN_LEN = 5; my ($grid_name, $dict_name) = @ARGV; my $grid = read_grid($grid_name); -for my $row ($grid->@*) { - $, = ", "; - say $row->@*; -} +my $rows = $grid->@*; +my $cols = $grid->[0]->@*; + +# for my $row ($grid->@*) { +# $, = ", "; +# say $row->@*; +# } my ($words, $prefixes) = parse_dict($dict_name, $MIN_LEN); -for my $k (sort keys %$prefixes) { - say $k; +# for my $k (sort keys %$prefixes) { +# say $k; +# } +# for my $k (sort keys %$words) { +# say $k; +# } + +my @dirs = ([ 0, 1], # e + [-1, 1], # ne + [-1, 0], # n + [-1, -1], # nw + [ 0, -1], # w + [ 1, -1], # sw + [ 1, 0], # s + [ 1, 1], # se + ); + +my @found; +for my $row (0..$rows-1) { + for my $col (0..$cols-1) { + next if $grid->[$row][$col] eq ' '; + for my $dir (@dirs) { + push @found, search_grid($grid, $row, $col, $dir, $words, $prefixes); + } + } } +for my $word (sort @found) { + say $word; +} sub read_grid($grid_name) { my @grid; @@ -75,6 +104,7 @@ sub parse_dict($dict_name, $min_len) { chomp $word; next unless length($word) >= $min_len; next unless $word =~ /^[a-z]+$/; + $word =~ tr/a-z/A-Z/; $words{$word} = 1; for my $len (1..length($word)) { @@ -83,3 +113,20 @@ sub parse_dict($dict_name, $min_len) { } return (\%words, \%prefixes); } + +sub search_grid($grid, $row, $col, $dir, $words, $prefixes) { +# say "$row $col @$dir"; + my @found; + my $s = $grid->[$row][$col]; + while (defined $prefixes->{$s}) { + $row += $dir->[0]; + $col += $dir->[1]; + $s .= $grid->[$row][$col]; + push @found, $s if defined $words->{$s}; + } + # if (@found) { + # say "found @found"; + # } + + return @found; +} -- cgit From 96359f89a3f6ff89b93965600fc879769188a6cd Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Fri, 4 Sep 2020 21:24:50 +0200 Subject: Solution 076 Task 1 Perl LK --- challenge-076/lubos-kolouch/perl/ch-1.pl | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 challenge-076/lubos-kolouch/perl/ch-1.pl diff --git a/challenge-076/lubos-kolouch/perl/ch-1.pl b/challenge-076/lubos-kolouch/perl/ch-1.pl new file mode 100644 index 0000000000..f4f1c54b7c --- /dev/null +++ b/challenge-076/lubos-kolouch/perl/ch-1.pl @@ -0,0 +1,48 @@ +#!/usr/bin/perl +#=============================================================================== +# +# FILE: ch-1.pl +# +# USAGE: ./ch-1.pl +# +# DESCRIPTION: https://perlweeklychallenge.org/blog/perl-weekly-challenge-076/ +# +# Task 1 - Prime Sum +# +# AUTHOR: Lubos Kolouch +#=============================================================================== + +use strict; +use warnings; +use Math::Prime::Util qw/is_prime/; + +sub get_nr_primes { + my $what = shift; + + # if the number is prime, we need just 1 number to represent it + + return 1 if is_prime($what); + + # if the number is even, we need 2 primes thanks to Goldbach's conjecture + return 2 if $what % 2 == 1; + + # if the number - 2 is prime, return 2 + return 2 if is_prime($what - 2); + + # if the number -3 is prime, return 2 (3 and the prime) + return 2 if is_prime($what - 3); + + # otherwise return 3 - it is 3 and 2 primes forming $what - 3 thanks to + # Goldbach's conjecture + + return 3 +} + + +use Test::More; + +is(get_nr_primes(9), 2, 'test 9'); +is(get_nr_primes(10), 2, 'test 10'); +is(get_nr_primes(2), 1, 'test 2'); + +done_testing; -- cgit From 71b570df0971b3194a6b5e76a110ad866ab0267f Mon Sep 17 00:00:00 2001 From: Lubos Kolouch Date: Fri, 4 Sep 2020 21:39:50 +0200 Subject: Solution 076 LK Task 1 Python --- challenge-076/lubos-kolouch/python/ch-1.py | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 challenge-076/lubos-kolouch/python/ch-1.py diff --git a/challenge-076/lubos-kolouch/python/ch-1.py b/challenge-076/lubos-kolouch/python/ch-1.py new file mode 100644 index 0000000000..e3ad8abce6 --- /dev/null +++ b/challenge-076/lubos-kolouch/python/ch-1.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +""" Perl weekly challenge 076 """ +# =============================================================================== +# +# FILE: ch-1.py +# +# USAGE: ./ch-1.py +# +# DESCRIPTION: https://perlweeklychallenge.org/blog/perl-weekly-challenge-076/ +# +# Task 1 - Prime Sum +# +# AUTHOR: Lubos Kolouch +# =============================================================================== +from sympy import isprime + + +def get_nr_primes(what): + """ Calculate and return the number of primes needed """ + + # if the number is prime, we need just 1 number to represent it + + if isprime(what): + return 1 + + # if the number is even, we need 2 primes thanks to Goldbach's conjecture + if what % 2 == 1: + return 2 + + # if the number - 2 is prime, return 2 + if isprime(what - 2): + return 2 + + # if the number -3 is prime, return 2 (3 and the prime) + if isprime(what - 3): + return 2 + + # otherwise return 3 - it is 3 and 2 primes forming $what - 3 thanks to + # Goldbach's conjecture + return 3 + + +assert get_nr_primes(2) == 1 +assert get_nr_primes(9) == 2 +assert get_nr_primes(10) == 2 +assert get_nr_primes(12) == 3 -- cgit From 95842629a3433fe1784d03cd7f51f958c1489b3e Mon Sep 17 00:00:00 2001 From: Tyler Wardhaugh Date: Mon, 31 Aug 2020 12:05:05 -0700 Subject: prepare files for Challenge #076 Replace references to previous challenge 75. --- challenge-076/tyler-wardhaugh/clojure/README.md | 12 ++++++------ challenge-076/tyler-wardhaugh/clojure/deps.edn | 18 ++++++++---------- challenge-076/tyler-wardhaugh/clojure/pom.xml | 11 +++-------- .../tyler-wardhaugh/clojure/src/tw/weekly/c76.clj | 12 ++++++++++++ 4 files changed, 29 insertions(+), 24 deletions(-) create mode 100644 challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/c76.clj diff --git a/challenge-076/tyler-wardhaugh/clojure/README.md b/challenge-076/tyler-wardhaugh/clojure/README.md index 4bc8af0088..a46a7a9fc9 100644 --- a/challenge-076/tyler-wardhaugh/clojure/README.md +++ b/challenge-076/tyler-wardhaugh/clojure/README.md @@ -1,25 +1,25 @@ -# tw.weekly.c75 +# tw.weekly.c76 -The Weekly Challenge - #075 - Tyler Wardhaugh +The Weekly Challenge - #076 - Tyler Wardhaugh ## Usage Run the project directly (shows default output from both tasks): - $ clojure -m tw.weekly.c75 + $ clojure -m tw.weekly.c76 Run the project's tests (which are samples from the task descriptions): $ clojure -A:test:runner -Run Task #1 with input (SUM COIN [COIN]...) +Run Task #1 with input - $ clojure -m tw.weekly.ch-1 6 1 2 4 + $ clojure -m tw.weekly.ch-1 Run Task #2 with input: - $ clojure -m tw.weekly.ch-2 2 1 4 5 3 7 + $ clojure -m tw.weekly.ch-2 ## Project Template diff --git a/challenge-076/tyler-wardhaugh/clojure/deps.edn b/challenge-076/tyler-wardhaugh/clojure/deps.edn index 6f74027036..a96b7f6cb9 100644 --- a/challenge-076/tyler-wardhaugh/clojure/deps.edn +++ b/challenge-076/tyler-wardhaugh/clojure/deps.edn @@ -1,15 +1,13 @@ {:paths ["src" "resources"] - :deps {org.clojure/clojure {:mvn/version "1.10.1"} - metametadata/multiset {:mvn/version "0.1.1"}} + :deps {org.clojure/clojure {:mvn/version "1.10.1"}} :aliases {:test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}} - :runner - {:extra-deps {com.cognitect/test-runner - {:git/url "https://github.com/cognitect-labs/test-runner" - :sha "f7ef16dc3b8332b0d77bc0274578ad5270fbfedd"}} - :main-opts ["-m" "cognitect.test-runner" - "-d" "test"]} + :runner {:extra-deps {com.cognitect/test-runner + {:git/url "https://github.com/cognitect-labs/test-runner" + :sha "f7ef16dc3b8332b0d77bc0274578ad5270fbfedd"}} + :main-opts ["-m" "cognitect.test-runner" + "-d" "test"]} :uberjar {:extra-deps {seancorfield/depstar {:mvn/version "1.0.94"}} - :main-opts ["-m" "hf.depstar.uberjar" "tw.weekly.c75.jar" - "-C" "-m" "tw.weekly.c75"]}}} + :main-opts ["-m" "hf.depstar.uberjar" "tw.weekly.c76.jar" + "-C" "-m" "tw.weekly.c76"]}}} diff --git a/challenge-076/tyler-wardhaugh/clojure/pom.xml b/challenge-076/tyler-wardhaugh/clojure/pom.xml index 7e0da3dd93..33951743ca 100644 --- a/challenge-076/tyler-wardhaugh/clojure/pom.xml +++ b/challenge-076/tyler-wardhaugh/clojure/pom.xml @@ -2,10 +2,10 @@ 4.0.0 tw.weekly - tw.weekly.c75 + tw.weekly.c76 0.1.0-SNAPSHOT - tw.weekly.c75 - The Weekly Challenge - #075 + tw.weekly.c76 + The Weekly Challenge - #076 https://github.com/manwar/perlweeklychallenge-club @@ -24,11 +24,6 @@ clojure 1.10.1 - - metametadata - multiset - 0.1.1 - diff --git a/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/c76.clj b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/c76.clj new file mode 100644 index 0000000000..e155b703fb --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/c76.clj @@ -0,0 +1,12 @@ +(ns tw.weekly.c76 + (:require [tw.weekly.ch-1 :as ch-1]) + (:require [tw.weekly.ch-2 :as ch-2]) + (:gen-class)) + +(defn -main + "Run both tasks." + [& args] + (println "Task #1") + (ch-1/-main) + (println "\n\nTask #2") + (ch-2/-main)) -- cgit From a4595717ac5c2a026763f6daee285570fd4e3373 Mon Sep 17 00:00:00 2001 From: Tyler Wardhaugh Date: Mon, 31 Aug 2020 16:36:11 -0700 Subject: Task #1 --- challenge-076/tyler-wardhaugh/clojure/deps.edn | 4 ++- challenge-076/tyler-wardhaugh/clojure/pom.xml | 10 ++++++ .../tyler-wardhaugh/clojure/src/tw/weekly/ch-1.clj | 1 + .../tyler-wardhaugh/clojure/src/tw/weekly/ch_1.clj | 37 ++++++++++++++++++++++ .../clojure/test/tw/weekly/c76_test.clj | 13 ++++++++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 120000 challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-1.clj create mode 100644 challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_1.clj create mode 100644 challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj diff --git a/challenge-076/tyler-wardhaugh/clojure/deps.edn b/challenge-076/tyler-wardhaugh/clojure/deps.edn index a96b7f6cb9..2befca222b 100644 --- a/challenge-076/tyler-wardhaugh/clojure/deps.edn +++ b/challenge-076/tyler-wardhaugh/clojure/deps.edn @@ -1,5 +1,7 @@ {:paths ["src" "resources"] - :deps {org.clojure/clojure {:mvn/version "1.10.1"}} + :deps {org.clojure/clojure {:mvn/version "1.10.1"} + com.hypirion/primes {:mvn/version "0.2.2"} + org.clojure/math.combinatorics {:mvn/version "0.1.6"}} :aliases {:test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}} diff --git a/challenge-076/tyler-wardhaugh/clojure/pom.xml b/challenge-076/tyler-wardhaugh/clojure/pom.xml index 33951743ca..418d05029f 100644 --- a/challenge-076/tyler-wardhaugh/clojure/pom.xml +++ b/challenge-076/tyler-wardhaugh/clojure/pom.xml @@ -24,6 +24,16 @@ clojure 1.10.1 + + com.hypirion + primes + 0.2.2 + + + org.clojure + math.combinatorics + 0.1.6 + diff --git a/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-1.clj b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-1.clj new file mode 120000 index 0000000000..924a7a086e --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-1.clj @@ -0,0 +1 @@ +ch_1.clj \ No newline at end of file diff --git a/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_1.clj b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_1.clj new file mode 100644 index 0000000000..300b89c7ff --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_1.clj @@ -0,0 +1,37 @@ +(ns tw.weekly.ch-1 + (:require [clojure.edn :as edn]) + (:require [clojure.math.combinatorics :as combo]) + (:require [com.hypirion.primes :as p])) + +; My initial attempt, which I've preserved here. +(defn find-min-primes-to-sum-brute-force + "Find the minimum number of prime numbers required, whose summation gives you the argument provided, by brute force." + [n] + (if (p/prime? n) [n] + (as-> n x + (p/take-below x) + (combo/partitions x :min 2 :max 3) + (mapcat identity x) + (filter #(= n (reduce + %)) x) + (sort-by count x) + (first x)))) + +; basis for algorithm: +; https://stackoverflow.com/a/35756072 +; StackOverflow answer by user448810 +(defn find-min-primes-to-sum + "Find the minimum number of prime numbers required, whose summation gives you the argument provided." + [n] + (cond + (p/prime? n) [n] + (even? n) (let [f (juxt #(- n %) identity)] (->> (p/primes) (filter #(p/prime? (- n %))) first f)) + (and (odd? n) (p/prime? (- n 2))) [2 (- n 2)] + :else (conj 3 (find-min-primes-to-sum (- n 3))))) + +(defn -main + "Run Task 1 with a number N, defaulting to the number given in the task example, 9." + [& args] + (let [N (or (some-> args first edn/read-string) 9)] + (let [solution (find-min-primes-to-sum N)] + (printf "%d prime number(s) are the minimum number required to sum to %d.\n" (count solution) N) + (println solution)))) diff --git a/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj b/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj new file mode 100644 index 0000000000..de205dd328 --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj @@ -0,0 +1,13 @@ +(ns tw.weekly.c76-test + (:require [clojure.test :refer :all] + [tw.weekly.ch-1 :refer [find-min-primes-to-sum find-min-primes-to-sum-brute-force]] + [tw.weekly.ch-2 :refer []])) + +(deftest ch-1 + (testing "Task 1" + (is (= 2 (count (find-min-primes-to-sum 9)) (count (find-min-primes-to-sum-brute-force 9)))) + (is (= 2 (count (find-min-primes-to-sum 34)) (count (find-min-primes-to-sum-brute-force 34)))))) + +(deftest ch-2 + (testing "Task 2" + )) -- cgit From 61693aedc19be0752aca365702514f4b325b921f Mon Sep 17 00:00:00 2001 From: Tyler Wardhaugh Date: Fri, 4 Sep 2020 13:43:16 -0700 Subject: Task #2 --- challenge-076/tyler-wardhaugh/clojure/deps.edn | 3 +- challenge-076/tyler-wardhaugh/clojure/pom.xml | 5 ++ .../tyler-wardhaugh/clojure/resources/dict.txt | 53 +++++++++++++++++++ .../tyler-wardhaugh/clojure/resources/grid.txt | 19 +++++++ .../tyler-wardhaugh/clojure/src/tw/weekly/ch-2.clj | 1 + .../tyler-wardhaugh/clojure/src/tw/weekly/ch_2.clj | 59 ++++++++++++++++++++++ .../clojure/test/tw/weekly/c76_test.clj | 8 ++- 7 files changed, 145 insertions(+), 3 deletions(-) create mode 100644 challenge-076/tyler-wardhaugh/clojure/resources/dict.txt create mode 100644 challenge-076/tyler-wardhaugh/clojure/resources/grid.txt create mode 120000 challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-2.clj create mode 100644 challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_2.clj diff --git a/challenge-076/tyler-wardhaugh/clojure/deps.edn b/challenge-076/tyler-wardhaugh/clojure/deps.edn index 2befca222b..fff9b934dc 100644 --- a/challenge-076/tyler-wardhaugh/clojure/deps.edn +++ b/challenge-076/tyler-wardhaugh/clojure/deps.edn @@ -1,7 +1,8 @@ {:paths ["src" "resources"] :deps {org.clojure/clojure {:mvn/version "1.10.1"} com.hypirion/primes {:mvn/version "0.2.2"} - org.clojure/math.combinatorics {:mvn/version "0.1.6"}} + org.clojure/math.combinatorics {:mvn/version "0.1.6"} + net.mikera/core.matrix {:mvn/version "0.62.0"}} :aliases {:test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.0.0"}}} diff --git a/challenge-076/tyler-wardhaugh/clojure/pom.xml b/challenge-076/tyler-wardhaugh/clojure/pom.xml index 418d05029f..5f42d66326 100644 --- a/challenge-076/tyler-wardhaugh/clojure/pom.xml +++ b/challenge-076/tyler-wardhaugh/clojure/pom.xml @@ -34,6 +34,11 @@ math.combinatorics 0.1.6 + + net.mikera + core.matrix + 0.62.0 + diff --git a/challenge-076/tyler-wardhaugh/clojure/resources/dict.txt b/challenge-076/tyler-wardhaugh/clojure/resources/dict.txt new file mode 100644 index 0000000000..c0d8215b4a --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/resources/dict.txt @@ -0,0 +1,53 @@ +argos +margo +patna +traci +tracie +aimed +align +antes +arose +ashed +blunt +blunts +broad +buries +clove +cloven +constitution +constitutions +croon +depart +departed +enter +filch +garlic +goats +grieve +grieves +hazard +liens +malign +malignant +malls +midst +ought +ovary +parted +pudgiest +quash +quashed +ruses +shrine +shrines +social +socializing +spasm +spasmodic +succor +succors +theorem +theorems +virus +viruses +wigged diff --git a/challenge-076/tyler-wardhaugh/clojure/resources/grid.txt b/challenge-076/tyler-wardhaugh/clojure/resources/grid.txt new file mode 100644 index 0000000000..31cf2e0fd8 --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/resources/grid.txt @@ -0,0 +1,19 @@ +B I D E M I A T S U C C O R S T +L D E G G I W Q H O D E E H D P +U S E I R U B U T E A S L A G U +N G N I Z I L A I C O S C N U D +T G M I D S T S A R A R E I F G +S R E N M D C H A S I V E E L I +S C S H A E U E B R O A D M T E +H W O V L P E D D L A I U L S S +R Y O N L A S F C S T A O G O T +I G U S S R R U G O V A R Y O C +N R G P A T N A N G I L A M O O +E I H A C E I V I R U S E S E D +S E T S U D T T G A R L I C N H +H V R M X L W I U M S N S O T B +A E A O F I L C H T O D C A E U +Z S C D F E C A A I I R L N R F +A R I I A N Y U T O O O U T P F +R S E C I S N A B O S C N E R A +D R S M P C U U N E L T E S I L diff --git a/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-2.clj b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-2.clj new file mode 120000 index 0000000000..5a32e17ef9 --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch-2.clj @@ -0,0 +1 @@ +ch_2.clj \ No newline at end of file diff --git a/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_2.clj b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_2.clj new file mode 100644 index 0000000000..cd5109aab1 --- /dev/null +++ b/challenge-076/tyler-wardhaugh/clojure/src/tw/weekly/ch_2.clj @@ -0,0 +1,59 @@ +(ns tw.weekly.ch-2 + (:require [clojure.edn :as edn]) + (:require [clojure.java.io :as io]) + (:require [clojure.string :as str]) + (:require [clojure.core.matrix :as mat])) + +(def min-word-length 5) + +(defn parse-grid-file + "Parse grid file and return a multidimensional vector of chars." + [grid-file] + (with-open [rdr (io/reader grid-file)] + (-> rdr + line-seq + seq + (->> (map #(remove (fn [c] (Character/isWhitespace c)) %))) + to-array-2d))) + +(defn parse-dict-file + "Parse dictionary and return a vector of words." + [dict-file] + (with-open [rdr (io/reader dict-file)] + (->> (line-seq rdr) + (filter #(>= (count %) min-word-length)) + (map str/trim-newline) + (map str/upper-case) + (into [])))) + +(defn build-lines + "Return a set of lines in a word grid that could contain valid words." + [grid] + (let [[m n] (mat/shape grid) + transposed (mat/transpose grid) + rotated (mapv #(vec (reverse (mat/get-row transposed %))) (range n)) + get-diags (fn [g d] (map #(mat/diagonal g %) (range (- d) d))) + diag-across (get-diags grid m) + diag-down (get-diags rotated n)] + (->> [grid transposed diag-across diag-down] + (mapcat #(into [] (comp (map str/join) (remove (partial = ""))) %)) + (mapcat (juxt identity str/reverse)) + (into #{})))) + +(defn word-search + "Return a sequence of words found in a grid from a dictionary." + [grid dict] + (let [all-lines (build-lines grid)] + (->> dict + (mapcat (fn [word] (keep #(when (str/includes? % word) word) all-lines)))))) + +(defn -main + "Run Task 2 with a grid file and a dictionary file, defaulting to the ones in the resources directory." + [& args] + (let [grid-file (or (some-> args first edn/read-string) (io/resource "grid.txt")) + dict-file (or (some-> args second edn/read-string) (io/resource "dict.txt")) + grid (parse-grid-file grid-file) + dict (parse-dict-file dict-file) + words (word-search grid dict)] + (printf "%d word(s) from the dictionary of %d word(s) found in the grid:\n" (count words) (count dict)) + (doseq [word words] (println word)))) diff --git a/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj b/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj index de205dd328..003ce81591 100644 --- a/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj +++ b/challenge-076/tyler-wardhaugh/clojure/test/tw/weekly/c76_test.clj @@ -1,7 +1,8 @@ (ns tw.weekly.c76-test (:require [clojure.test :refer :all] + [clojure.java.io :as io] [tw.weekly.ch-1 :refer [find-min-primes-to-sum find-min-primes-to-sum-brute-force]] - [tw.weekly.ch-2 :refer []])) + [tw.weekly.ch-2 :refer [parse-dict-file parse-grid-file word-search]])) (deftest ch-1 (testing "Task 1" @@ -10,4 +11,7 @@ (deftest ch-2 (testing "Task 2" - )) + (let [grid (parse-grid-file (io/resource "grid.txt")) + dict (parse-dict-file (io/resource "dict.txt")) + words (word-search grid dict)] + (is (= (into #{} dict) (into #{} words)))))) -- cgit From 84e4d441b58d665ebc26938830f6240f47bd3ae6 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Fri, 4 Sep 2020 23:40:45 +0100 Subject: - Added solution by Lubos Kolouch. --- stats/pwc-current.json | 303 +-- stats/pwc-language-breakdown-summary.json | 66 +- stats/pwc-language-breakdown.json | 3034 ++++++++++++++--------------- stats/pwc-leaders.json | 722 +++---- stats/pwc-summary-1-30.json | 122 +- stats/pwc-summary-121-150.json | 126 +- stats/pwc-summary-151-180.json | 110 +- stats/pwc-summary-181-210.json | 64 +- stats/pwc-summary-31-60.json | 106 +- stats/pwc-summary-61-90.json | 104 +- stats/pwc-summary-91-120.json | 110 +- stats/pwc-summary.json | 62 +- 12 files changed, 2472 insertions(+), 2457 deletions(-) diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 291c88148d..11203adfa4 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,17 +1,145 @@ { + "series" : [ + { + "data" : [ + { + "name" : "Alexander Pankoff", + "y" : 2, + "drilldown" : "Alexander Pankoff" + }, + { + "drilldown" : "Andinus", + "y" : 2, + "name" : "Andinus" + }, + { + "drilldown" : "Javier Luque", + "y" : 5, + "name" : "Javier Luque" + }, + { + "name" : "Jorg Sommrey", + "y" : 2, + "drilldown" : "Jorg Sommrey" + }, + { + "drilldown" : "Lubos Kolouch", + "y" : 1, + "name" : "Lubos Kolouch" + }, + { + "y" : 4, + "drilldown" : "Luca Ferrari", + "name" : "Luca Ferrari" + }, + { + "y" : 2, + "drilldown" : "Mark Anderson", + "name" : "Mark Anderson" + }, + { + "y" : 2, + "drilldown" : "Markus Holzer", + "name" : "Markus Holzer" + }, + { + "name" : "Mohammad S Anwar", + "drilldown" : "Mohammad S Anwar", + "y" : 2 + }, + { + "name" : "Myoungjin Jeon", + "drilldown" : "Myoungjin Jeon", + "y" : 4 + }, + { + "name" : "Neil Bowers", + "drilldown" : "Neil Bowers", + "y" : 2 + }, + { + "y" : 2, + "drilldown" : "Nuno Vieira", + "name" : "Nuno Vieira" + }, + { + "name" : "Roger Bell_West", + "drilldown" : "Roger Bell_West", + "y" : 5 + }, + { + "y" : 3, + "drilldown" : "Simon Green", + "name" : "Simon Green" + }, + { + "name" : "Simon Proctor", + "y" : 2, + "drilldown" : "Simon Proctor" + }, + { + "y" : 1, + "drilldown" : "Ulrich Rieke", + "name" : "Ulrich Rieke" + }, + { + "name" : "Yet Ebreo", + "y" : 1, + "drilldown" : "Yet Ebreo" + } + ], + "colorByPoint" : 1, + "name" : "Perl Weekly Challenge - 076" + } + ], + "xAxis" : { + "type" : "category" + }, + "legend" : { + "enabled" : 0 + }, + "yAxis" : { + "title" : { + "text" : "Total Solutions" + } + }, + "title" : { + "text" : "Perl Weekly Challenge - 076" + }, + "plotOptions" : { + "series" : { + "dataLabels" : { + "format" : "{point.y}", + "enabled" : 1 + }, + "borderWidth" : 0 + } + }, + "chart" : { + "type" : "column" + }, + "tooltip" : { + "pointFormat" : "{point.name}: {point.y:f}
", + "headerFormat" : "{series.name}
", + "followPointer" : 1 + }, + "subtitle" : { + "text" : "[Champions: 17] Last updated at 2020-09-04 22:34:54 GMT" + }, "drilldown" : { "series" : [ { - "name" : "Alexander Pankoff", + "id" : "Alexander Pankoff", "data" : [ [ "Perl", 2 ] ], - "id" : "Alexander Pankoff" + "name" : "Alexander Pankoff" }, { + "name" : "Andinus", "id" : "Andinus", "data" : [ [ @@ -22,11 +150,9 @@ "Blog", 1 ] - ], - "name" : "Andinus" + ] }, { - "id" : "Javier Luque", "name" : "Javier Luque", "data" : [ [ @@ -41,11 +167,12 @@ "Blog", 1 ] - ] + ], + "id" : "Javier Luque" }, { - "id" : "Jorg Sommrey", "name" : "Jorg Sommrey", + "id" : "Jorg Sommrey", "data" : [ [ "Perl", @@ -53,6 +180,16 @@ ] ] }, + { + "name" : "Lubos Kolouch", + "id" : "Lubos Kolouch", + "data" : [ + [ + "Perl", + 1 + ] + ] + }, { "id" : "Luca Ferrari", "data" : [ @@ -68,24 +205,24 @@ "name" : "Luca Ferrari" }, { + "id" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson", - "id" : "Mark Anderson" + "name" : "Mark Anderson" }, { + "name" : "Markus Holzer", + "id" : "Markus Holzer", "data" : [ [ "Raku", 2 ] - ], - "name" : "Markus Holzer", - "id" : "Markus Holzer" + ] }, { "id" : "Mohammad S Anwar", @@ -113,6 +250,7 @@ }, { "name" : "Neil Bowers", + "id" : "Neil Bowers", "data" : [ [ "Perl", @@ -122,21 +260,19 @@ "Blog", 1 ] - ], - "id" : "Neil Bowers" + ] }, { "name" : "Nuno Vieira", + "id" : "Nuno Vieira", "data" : [ [ "Perl", 2 ] - ], - "id" : "Nuno Vieira" + ] }, { - "id" : "Roger Bell_West", "data" : [ [ "Perl", @@ -151,11 +287,10 @@ 1 ] ], + "id" : "Roger Bell_West", "name" : "Roger Bell_West" }, { - "id" : "Simon Green", - "name" : "Simon Green", "data" : [ [ "Perl", @@ -165,7 +300,9 @@ "Blog", 1 ] - ] + ], + "id" : "Simon Green", + "name" : "Simon Green" }, { "id" : "Simon Proctor", @@ -194,131 +331,9 @@ 1 ] ], - "name" : "Yet Ebreo", - "id" : "Yet Ebreo" + "id" : "Yet Ebreo", + "name" : "Yet Ebreo" } ] - }, - "series" : [ - { - "colorByPoint" : 1, - "name" : "Perl Weekly Challenge - 076", - "data" : [ - { - "y" : 2, - "name" : "Alexander Pankoff", - "drilldown" : "Alexander Pankoff" - }, - { - "name" : "Andinus", - "y" : 2, - "drilldown" : "Andinus" - }, - { - "drilldown" : "Javier Luque", - "name" : "Javier Luque", - "y" : 5 - }, - { - "drilldown" : "Jorg Sommrey", - "name" : "Jorg Sommrey", - "y" : 2 - }, - { - "name" : "Luca Ferrari", - "y" : 4, - "drilldown" : "Luca Ferrari" - }, - { - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Markus Holzer", - "y" : 2, - "name" : "Markus Holzer" - }, - { - "y" : 2, - "name" : "Mohammad S Anwar", - "drilldown" : "Mohammad S Anwar" - }, - { - "drilldown" : "Myoungjin Jeon", - "y" : 4, - "name" : "Myoungjin Jeon" - }, - { - "name" : "Neil Bowers", - "y" : 2, - "drilldown" : "Neil Bowers" - }, - { - "drilldown" : "Nuno Vieira", - "name" : "Nuno Vieira", - "y" : 2 - }, - { - "drilldown" : "Roger Bell_West", - "name" : "Roger Bell_West", - "y" : 5 - }, - { - "name" : "Simon Green", - "y" : 3, - "drilldown" : "Simon Green" - }, - { - "y" : 2, - "name" : "Simon Proctor", - "drilldown" : "Simon Proctor" - }, - { - "drilldown" : "Ulrich Rieke", - "y" : 1, - "name" : "Ulrich Rieke" - }, - { - "drilldown" : "Yet Ebreo", - "y" : 1, - "name" : "Yet Ebreo" - } - ] - } - ], - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, - "subtitle" : { - "text" : "[Champions: 16] Last updated at 2020-09-04 10:21:22 GMT" - }, - "tooltip" : { - "headerFormat" : "{series.name}
", - "followPointer" : 1, - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "title" : { - "text" : "Perl Weekly Challenge - 076" - }, - "yAxis" : { - "title" : { - "text" : "Total Solutions" - } - }, - "legend" : { - "enabled" : 0 - }, - "xAxis" : { - "type" : "category" - }, - "chart" : { - "type" : "column" } } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 7bc89d6f18..fbea636fff 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,49 +1,37 @@ { - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" + "title" : { + "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" }, - "chart" : { - "type" : "column" + "yAxis" : { + "min" : 0, + "title" : { + "text" : null + } }, "legend" : { "enabled" : "false" }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 + "subtitle" : { + "text" : "Last updated at 2020-09-04 22:34:54 GMT" }, "tooltip" : { "pointFormat" : "{point.y:.0f}" }, - "subtitle" : { - "text" : "Last updated at 2020-09-04 10:21:22 GMT" + "chart" : { + "type" : "column" }, - "title" : { - "text" : "Perl Weekly Challenge Contributions [2019 - 2020]" + "xAxis" : { + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + }, + "type" : "category" }, "series" : [ { "name" : "Contributions", - "dataLabels" : { - "color" : "#FFFFFF", - "align" : "right", - "rotation" : -90, - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - }, - "enabled" : "true", - "format" : "{point.y:.0f}", - "y" : 10 - }, "data" : [ [ "Blog", @@ -51,13 +39,25 @@ ], [ "Perl", - 3173 + 3174 ], [ "Raku", 2065 ] - ] + ], + "dataLabels" : { + "rotation" : -90, + "enabled" : "true", + "y" : 10, + "style" : { + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" + }, + "align" : "right", + "color" : "#FFFFFF", + "format" : "{point.y:.0f}" + } } ] } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 3c0738bb99..179011cc0f 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,1435 +1,41 @@ { - "title" : { - "text" : "Perl Weekly Challenge Language" - }, - "tooltip" : { - "followPointer" : "true", - "headerFormat" : "", - "pointFormat" : "Challenge {point.name}: {point.y:f}
" - }, - "subtitle" : { - "text" : "Click the columns to drilldown the language breakdown. Last updated at 2020-09-04 10:21:22 GMT" - }, - "plotOptions" : { - "series" : { - "dataLabels" : { - "format" : "{point.y}", - "enabled" : 1 - }, - "borderWidth" : 0 - } - }, - "drilldown" : { - "series" : [ - { - "id" : "001", - "data" : [ - [ - "Perl", - 86 - ], - [ - "Raku", - 45 - ], - [ - "Blog", - 11 - ] - ], - "name" : "001" - }, - { - "name" : "002", - "data" : [ - [ - "Perl", - 65 - ], - [ - "Raku", - 34 - ], - [ - "Blog", - 10 - ] - ], - "id" : "002" - }, - { - "name" : "003", - "data" : [ - [ - "Perl", - 34 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 9 - ] - ], - "id" : "003" - }, - { - "id" : "004", - "name" : "004", - "data" : [ - [ - "Perl", - 50 - ], - [ - "Raku", - 31 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "name" : "005", - "data" : [ - [ - "Perl", - 36 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 12 - ] - ], - "id" : "005" - }, - { - "name" : "006", - "data" : [ - [ - "Perl", - 29 - ], - [ - "Raku", - 16 - ], - [ - "Blog", - 7 - ] - ], - "id" : "006" - }, - { - "id" : "007", - "data" : [ - [ - "Perl", - 28 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 10 - ] - ], - "name" : "007" - }, - { - "name" : "008", - "data" : [ - [ - "Perl", - 40 - ], - [ - "Raku", - 20 - ], - [ - "Blog", - 12 - ] - ], - "id" : "008" - }, - { - "id" : "009", - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 18 - ], - [ - "Blog", - 13 - ] - ], - "name" : "009" - }, - { - "id" : "010", - "name" : "010", - "data" : [ - [ - "Perl", - 32 - ], - [ - "Raku", - 17 - ], - [ - "Blog", - 11 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 43 - ], - [ - "Raku", - 26 - ], - [ - "Blog", - 10 - ] - ], - "name" : "011", - "id" : "011" - }, - { - "id" : "012", - "name" : "012", - "data" : [ - [ - "Perl", - 44 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 11 - ] - ] - }, - { - "id" : "013", - "data" : [ - [ - "Perl", - 42 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 13 - ] - ], - "name" : "013" - }, - { - "id" : "014", - "data" : [ - [ - "Perl", - 52 - ], - [ - "Raku", - 29 - ], - [ - "Blog", - 15 - ] - ], - "name" : "014" - }, - { - "data" : [ - [ - "Perl", - 52 - ], - [ - "Raku", - 26 - ], - [ - "Blog", - 15 - ] - ], - "name" : "015", - "id" : "015" - }, - { - "id" : "016", - "name" : "016", - "data" : [ - [ - "Perl", - 33 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 12 - ] - ] - }, - { - "id" : "017", - "name" : "017", - "data" : [ - [ - "Perl", - 42 - ], - [ - "Raku", - 25 - ], - [ - "Blog", - 12 - ] - ] - }, - { - "name" : "018", - "data" : [ - [ - "Perl", - 33 - ], - [ - "Raku", - 29 - ], - [ - "Blog", - 14 - ] - ], - "id" : "018" - }, - { - "id" : "019", - "name" : "019", - "data" : [ - [ - "Perl", - 52 - ], - [ - "Raku", - 32 - ], - [ - "Blog", - 13 - ] - ] - }, - { - "id" : "020", - "data" : [ - [ - "Perl", - 47 - ], - [ - "Raku", - 35 - ], - [ - "Blog", - 13 - ] - ], - "name" : "020" - }, - { - "id" : "021", - "name" : "021", - "data" : [ - [ - "Perl", - 35 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "022", - "name" : "022", - "data" : [ - [ - "Perl", - 32 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "023", - "data" : [ - [ - "Perl", - 49 - ], - [ - "Raku", - 30 - ], - [ - "Blog", - 12 - ] - ], - "name" : "023" - }, - { - "id" : "024", - "data" : [ - [ - "Perl", - 35 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 11 - ] - ], - "name" : "024" - }, - { - "id" : "025", - "data" : [ - [ - "Perl", - 26 - ], - [ - "Raku", - 17 - ], - [ - "Blog", - 12 - ] - ], - "name" : "025" - }, - { - "data" : [ - [ - "Perl", - 33 - ], - [ - "Raku", - 27 - ], - [ - "Blog", - 10 - ] - ], - "name" : "026", - "id" : "026" - }, - { - "name" : "027", - "data" : [ - [ - "Perl", - 29 - ], - [ - "Raku", - 20 - ], - [ - "Blog", - 9 - ] - ], - "id" : "027" - }, - { - "name" : "028", - "data" : [ - [ - "Perl", - 45 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 9 - ] - ], - "id" : "028" - }, - { - "id" : "029", - "data" : [ - [ - "Perl", - 40 - ], - [ - "Raku", - 25 - ], - [ - "Blog", - 12 - ] - ], - "name" : "029" - }, - { - "data" : [ - [ - "Perl", - 74 - ], - [ - "Raku", - 31 - ], - [ - "Blog", - 10 - ] - ], - "name" : "030", - "id" : "030" - }, - { - "data" : [ - [ - "Perl", - 50 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 9 - ] - ], - "name" : "031", - "id" : "031" - }, - { - "id" : "032", - "name" : "032", - "data" : [ - [ - "Perl", - 57 - ], - [ - "Raku", - 25 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 62 - ], - [ - "Raku", - 36 - ], - [ - "Blog", - 10 - ] - ], - "name" : "033", - "id" : "033" - }, - { - "id" : "034", - "name" : "034", - "data" : [ - [ - "Perl", - 30 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 11 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 33 - ], - [ - "Raku", - 20 - ], - [ - "Blog", - 9 - ] - ], - "name" : "035", - "id" : "035" - }, - { - "name" : "036", - "data" : [ - [ - "Perl", - 35 - ], - [ - "Raku", - 20 - ], - [ - "Blog", - 11 - ] - ], - "id" : "036" - }, - { - "data" : [ - [ - "Perl", - 34 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 9 - ] - ], - "name" : "037", - "id" : "037" - }, - { - "name" : "038", - "data" : [ - [ - "Perl", - 31 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 12 - ] - ], - "id" : "038" - }, - { - "id" : "039", - "name" : "039", - "data" : [ - [ - "Perl", - 29 - ], - [ - "Raku", - 19 - ], - [ - "Blog", - 12 - ] - ] - }, - { - "id" : "040", - "name" : "040", - "data" : [ - [ - "Perl", - 39 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "041", - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 9 - ] - ], - "name" : "041" - }, - { - "id" : "042", - "data" : [ - [ - "Perl", - 47 - ], - [ - "Raku", - 30 - ], - [ - "Blog", - 11 -