From 57437bd4e563c53c107ca9c1ba91284053b8d08e Mon Sep 17 00:00:00 2001 From: Bob Lied Date: Mon, 10 Jun 2024 09:02:42 -0500 Subject: Week 273 solutions Alternate solution for ch-1.pl typo --- challenge-273/bob-lied/README | 6 ++-- challenge-273/bob-lied/perl/ch-1.pl | 61 +++++++++++++++++++++++++++++++++++++ challenge-273/bob-lied/perl/ch-2.pl | 44 ++++++++++++++++++++++++++ 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 challenge-273/bob-lied/perl/ch-1.pl create mode 100644 challenge-273/bob-lied/perl/ch-2.pl diff --git a/challenge-273/bob-lied/README b/challenge-273/bob-lied/README index ebf6fe8695..fbef60f528 100644 --- a/challenge-273/bob-lied/README +++ b/challenge-273/bob-lied/README @@ -1,4 +1,4 @@ -Solutions to weekly challenge 272 by Bob Lied +Solutions to weekly challenge 273 by Bob Lied -https://perlweeklychallenge.org/blog/perl-weekly-challenge-272/ -https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-272/bob-lied +https://perlweeklychallenge.org/blog/perl-weekly-challenge-273/ +https://github.com/boblied/perlweeklychallenge-club/tree/master/challenge-273/bob-lied diff --git a/challenge-273/bob-lied/perl/ch-1.pl b/challenge-273/bob-lied/perl/ch-1.pl new file mode 100644 index 0000000000..15f0409cda --- /dev/null +++ b/challenge-273/bob-lied/perl/ch-1.pl @@ -0,0 +1,61 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# Copyright (c) 2024, Bob Lied +#============================================================================= +# ch-1.pl Perl Weekly Challenge 273 Task 1 Percentage of Character +#============================================================================= +# You are given a string, $str and a character $char. +# Write a script to return the percentage, nearest whole, of given +# character in the given string. +# Example 1 Input: $str = "perl", $char = "e" +# Output: 25 +# Example 2 Input: $str = "java", $char = "a" +# Output: 50 +# Example 3 Input: $str = "python", $char = "m" +# Output: 0 +# Example 4 Input: $str = "ada", $char = "a" +# Output: 67 +# Example 5 Input: $str = "ballerina", $char = "l" +# Output: 22 +# Example 6 Input: $str = "analitik", $char = "k" +# Output: 13 +#============================================================================= + +use v5.40; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +exit(!runTest()) if $DoTest; + +say pctOfChar(@ARGV); + +sub pctOfChar($str, $char) +{ + # Solutioh 1: delete everything that isn't char, use remaining length + # my $occur = length( $str =~ s/[^$char]//gr ); + + # Solution 2: Global match in list context yields an array of + # matching characters. Assigning to scalar yields length of the list. + my $occur = @{[ $str =~ m/$char/g ]}; + return int( 100*($occur / length($str)) + 0.5 ); +} + +sub runTest +{ + use Test2::V0; + + is( pctOfChar("perl", "e"), 25, "Example 1 perl e"); + is( pctOfChar("java", "a"), 50, "Example 2 java a"); + is( pctOfChar("python", "m"), 0, "Example 3 python m"); + is( pctOfChar("ada", "a"), 67, "Example 4 ada a"); + is( pctOfChar("ballerina", "l"), 22, "Example 5 ballerina l"); + is( pctOfChar("analitik", "k"), 13, "Example 6 analitik k"); + + is( pctOfChar("rrrr", "r"), 100, "100%"); + + done_testing; +} diff --git a/challenge-273/bob-lied/perl/ch-2.pl b/challenge-273/bob-lied/perl/ch-2.pl new file mode 100644 index 0000000000..817a23bef8 --- /dev/null +++ b/challenge-273/bob-lied/perl/ch-2.pl @@ -0,0 +1,44 @@ +#!/usr/bin/env perl +# vim:set ts=4 sw=4 sts=4 et ai wm=0 nu: +#============================================================================= +# Copyright (c) 2024, Bob Lied +#============================================================================= +# ch-2.pl Perl Weekly Challenge 273 Task 2 B after A +#============================================================================= +# You are given a string, $str. +# Write a script to return true if there is at least one b, and no a +# appears after the first b. +# Example 1 Input: $str = "aabb" Output: true +# Example 2 Input: $str = "abab" Output: false +# Example 3 Input: $str = "aaa" Output: false +# Example 4 Input: $str = "bbb" Output: true +#============================================================================= + +use v5.40; + +use Getopt::Long; +my $Verbose = 0; +my $DoTest = 0; + +GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +exit(!runTest()) if $DoTest; + +say ( bAfterA($_) ? "true" : "false" ) for @ARGV; + +sub bAfterA($str) +{ + my $w = index($str, "b"); + return $w >= 0 && index($str, "a", $w) < 0; +} + +sub runTest +{ + use Test2::V0; + + is (bAfterA("aabb"), true, "Example 1"); + is (bAfterA("abab"), false, "Example 2"); + is (bAfterA("aaa" ), false, "Example 3"); + is (bAfterA("bbb" ), true, "Example 4"); + + done_testing; +} -- cgit From 53dad097e142b9e98929709397867ab1cbbfcd08 Mon Sep 17 00:00:00 2001 From: Bob Lied Date: Wed, 12 Jun 2024 19:20:56 -0500 Subject: Benchmark different ways to count characters Benchmark different ways to count characters --- challenge-273/bob-lied/perl/ch-1.pl | 85 +++++++++++++++++++++++++++++-------- 1 file changed, 67 insertions(+), 18 deletions(-) diff --git a/challenge-273/bob-lied/perl/ch-1.pl b/challenge-273/bob-lied/perl/ch-1.pl index 15f0409cda..1ed2a5ca47 100644 --- a/challenge-273/bob-lied/perl/ch-1.pl +++ b/challenge-273/bob-lied/perl/ch-1.pl @@ -25,22 +25,51 @@ use v5.40; use Getopt::Long; -my $Verbose = 0; -my $DoTest = 0; +my $DoTest = false; +my $Benchmark = 0; +my $Counter = 'saturn'; -GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +# Different ways to count the occurrence of a character in a string. +# Sample benchmark run on my system: +# Rate splitgrep delete grepcmp treval match saturn +# splitgrep 44683/s -- -26% -39% -84% -94% -96% +# delete 60386/s 35% -- -18% -78% -91% -94% +# grepcmp 73314/s 64% 21% -- -73% -89% -93% +# treval 274725/s 515% 355% 275% -- -60% -73% +# match 694444/s 1454% 1050% 847% 153% -- -31% +# saturn 1000000/s 2138% 1556% 1264% 264% 44% -- + +my %CountChar = ( + # Solution 1: delete everything that isn't char, use remaining length + delete => sub($str, $char) { length( $str =~ s/[^$char]//gr ) }, + + # Solution 2: Global match in list context yields an array of + # matching characters. Assigning to scalar yields length of the list. + match => sub($str, $char) { scalar( @{[ $str =~ m/$char/g ]} ) }, + + # Solution 3: Same array/scalar idea, but use =()= to get context + saturn => sub($str, $char) { my $occur =()= ( $str =~ m/$char/g ) }, + + # Solution 4: turn string into array and count with grep + splitgrep => sub($str, $char) { scalar( grep /$char/, split(//, $str) ) }, + + # Solution 4a: use string compare instead of RE in grep + grepcmp => sub($str, $char) { scalar( grep {$_ eq $char} split(//, $str) ) }, + + # Solution 5: count with tr///, needs eval to interpolate + treval => sub($str, $char) { eval "\$str =~ tr/$char//d" }, +); + +GetOptions("test" => \$DoTest, "benchmark:i" => \$Benchmark, "counter:s" => \$Counter); exit(!runTest()) if $DoTest; +exit( runBenchmark($Benchmark) ) if $Benchmark; + +say pctOfChar(@ARGV, $CountChar{$Counter}); -say pctOfChar(@ARGV); -sub pctOfChar($str, $char) +sub pctOfChar($str, $char, $counter) { - # Solutioh 1: delete everything that isn't char, use remaining length - # my $occur = length( $str =~ s/[^$char]//gr ); - - # Solution 2: Global match in list context yields an array of - # matching characters. Assigning to scalar yields length of the list. - my $occur = @{[ $str =~ m/$char/g ]}; + my $occur = $counter->($str, $char); return int( 100*($occur / length($str)) + 0.5 ); } @@ -48,14 +77,34 @@ sub runTest { use Test2::V0; - is( pctOfChar("perl", "e"), 25, "Example 1 perl e"); - is( pctOfChar("java", "a"), 50, "Example 2 java a"); - is( pctOfChar("python", "m"), 0, "Example 3 python m"); - is( pctOfChar("ada", "a"), 67, "Example 4 ada a"); - is( pctOfChar("ballerina", "l"), 22, "Example 5 ballerina l"); - is( pctOfChar("analitik", "k"), 13, "Example 6 analitik k"); + for my $countFunc ( sort keys %CountChar ) + { + is( pctOfChar("perl", "e", $CountChar{$countFunc}), 25, "Example 1 perl e $countFunc"); + is( pctOfChar("java", "a", $CountChar{$countFunc}), 50, "Example 2 java a $countFunc"); + is( pctOfChar("python", "m", $CountChar{$countFunc}), 0, "Example 3 python m $countFunc"); + is( pctOfChar("ada", "a", $CountChar{$countFunc}), 67, "Example 4 ada a $countFunc"); + is( pctOfChar("ballerina", "l", $CountChar{$countFunc}), 22, "Example 5 ballerina l $countFunc"); + is( pctOfChar("analitik", "k", $CountChar{$countFunc}), 13, "Example 6 analitik k $countFunc"); - is( pctOfChar("rrrr", "r"), 100, "100%"); + is( pctOfChar("rrrr", "r", $CountChar{$countFunc}), 100, "100% $countFunc"); + } done_testing; } + +sub runBenchmark($repeat) +{ + use Benchmark qw/cmpthese/; + + my $str = 'abcdefghijklmnopqrstuvwxy' x 10; + + cmpthese($repeat, { + "delete" => sub { pctOfChar($str, 'n', $CountChar{delete}) }, + "match" => sub { pctOfChar($str, 'n', $CountChar{match}) }, + "saturn" => sub { pctOfChar($str, 'n', $CountChar{saturn}) }, + "splitgrep" => sub { pctOfChar($str, 'n', $CountChar{splitgrep}) }, + "grepcmp" => sub { pctOfChar($str, 'n', $CountChar{grepcmp}) }, + "treval" => sub { pctOfChar($str, 'n', $CountChar{treval}) }, + }); + +} -- cgit From e3d7d9d87f2799af27557a4f0e2aa36e84057ae1 Mon Sep 17 00:00:00 2001 From: Bob Lied Date: Wed, 12 Jun 2024 19:38:18 -0500 Subject: Benchmark index vs RE in task 2 --- challenge-273/bob-lied/perl/ch-2.pl | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/challenge-273/bob-lied/perl/ch-2.pl b/challenge-273/bob-lied/perl/ch-2.pl index 817a23bef8..7132fa848a 100644 --- a/challenge-273/bob-lied/perl/ch-2.pl +++ b/challenge-273/bob-lied/perl/ch-2.pl @@ -17,11 +17,12 @@ use v5.40; use Getopt::Long; -my $Verbose = 0; -my $DoTest = 0; +my $DoTest = false; +my $Benchmark = 0; -GetOptions("test" => \$DoTest, "verbose" => \$Verbose); +GetOptions("test" => \$DoTest, "benchmark:i" => \$Benchmark); exit(!runTest()) if $DoTest; +exit( runBenchmark($Benchmark) ) if $Benchmark; say ( bAfterA($_) ? "true" : "false" ) for @ARGV; @@ -31,6 +32,11 @@ sub bAfterA($str) return $w >= 0 && index($str, "a", $w) < 0; } +sub bAfterA_RE($str) +{ + $str =~ m/^[^b]*b[^a]*$/ +} + sub runTest { use Test2::V0; @@ -40,5 +46,24 @@ sub runTest is (bAfterA("aaa" ), false, "Example 3"); is (bAfterA("bbb" ), true, "Example 4"); + is (bAfterA_RE("aabb"), true, "Example 1 RE"); + is (bAfterA_RE("abab"), false, "Example 2 RE"); + is (bAfterA_RE("aaa" ), false, "Example 3 RE"); + is (bAfterA_RE("bbb" ), true, "Example 4 RE"); + done_testing; } + +sub runBenchmark($repeat) +{ + use Benchmark qw/cmpthese/; + + cmpthese( $repeat, { + index => sub{ + bAfterA("aabb"), bAfterA("abab"), bAfterA("aaaa"), bAfterA("bbbb"), + }, + regex => sub{ + bAfterA_RE("aabb"), bAfterA_RE("abab"), bAfterA_RE("aaaa"), bAfterA_RE("bbbb"), + }, + }); +} -- cgit From c7797f212a2db97cae7ac808542c20df8402eea5 Mon Sep 17 00:00:00 2001 From: Mariano Spadaccini Date: Thu, 13 Jun 2024 12:18:46 +0200 Subject: Add ch-1 and ch-2 in Elixir --- challenge-273/spadacciniweb/elixir/ch-1.exs | 65 +++++++++++++++++++++++++++++ challenge-273/spadacciniweb/elixir/ch-2.exs | 60 ++++++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 challenge-273/spadacciniweb/elixir/ch-1.exs create mode 100644 challenge-273/spadacciniweb/elixir/ch-2.exs diff --git a/challenge-273/spadacciniweb/elixir/ch-1.exs b/challenge-273/spadacciniweb/elixir/ch-1.exs new file mode 100644 index 0000000000..3fe074e791 --- /dev/null +++ b/challenge-273/spadacciniweb/elixir/ch-1.exs @@ -0,0 +1,65 @@ +# Task 1: Percentage of Character +# Submitted by: Mohammad Sajid Anwar +# +# You are given a string, $str and a character $char. +# Write a script to return the percentage, nearest whole, of given character in the given string. +# +# Example 1 +# Input: $str = "perl", $char = "e" +# Output: 25 +# +# Example 2 +# Input: $str = "java", $char = "a" +# Output: 50 +# +# Example 3 +# Input: $str = "python", $char = "m" +# Output: 0 +# +# Example 4 +# Input: $str = "ada", $char = "a" +# Output: 67 +# +# Example 5 +# Input: $str = "ballerina", $char = "l" +# Output: 22 +# +# Example 6 +# Input: $str = "analitik", $char = "k" +# Output: 13 + +defmodule Percentage do + + def freq(str, char) do + String.split(str, "", trim: true) + |> Enum.frequencies + |> Map.get(char) + end + + def out(str, char) do + IO.write( str <> " " <> char <> " -> ") + case freq(str, char) do + nil -> IO.puts "0" + x -> IO.puts( x / String.length(str)*100 |> round ) + end + end + +end + +str = "perl"; char = "e"; +Percentage.out(str, char) + +str = "java"; char = "a"; +Percentage.out(str, char) + +str = "python"; char = "m"; +Percentage.out(str, char) + +str = "ada"; char = "a"; +Percentage.out(str, char) + +str = "ballerina"; char = "l"; +Percentage.out(str, char) + +str = "analitik"; char = "k"; +Percentage.out(str, char) diff --git a/challenge-273/spadacciniweb/elixir/ch-2.exs b/challenge-273/spadacciniweb/elixir/ch-2.exs new file mode 100644 index 0000000000..ca07864984 --- /dev/null +++ b/challenge-273/spadacciniweb/elixir/ch-2.exs @@ -0,0 +1,60 @@ +# Task 2: B After A +# Submitted by: Mohammad Sajid Anwar +# +# You are given a string, $str. +# Write a script to return true if there is at least one b, and no a appears after the first b. +# +# Example 1 +# Input: $str = "aabb" +# Output: true +# +# Example 2 +# Input: $str = "abab" +# Output: false +# +# Example 3 +# Input: $str = "aaa" +# Output: false +# +# Example 4 +# Input: $str = "bbb" +# Output: true + +defmodule Position do + + def first_b(str) do + case Regex.run(~r/b/, str, return: :index) do + nil -> nil + out -> out |> Enum.fetch!(0) |> elem(0) + end + end + + def last_a(str, pos) do + case Regex.run(~r/a/, str, offset: pos, return: :index) do + nil -> IO.puts( "true" ) + _ -> IO.puts( "false" ) + end + end + + def out(str) do + IO.write( str <> " -> " ) + #IO.inspect( first_b(str) ) + case first_b(str) do + nil -> IO.puts( "false" ) + out -> last_a(str, out) + end + end + +end + +str = "aabb" +Position.out(str) + +str = "abab" +Position.out(str) + +str = "aaa" +Position.out(str) + +str = "bbb" +Position.out(str) -- cgit From 9c95a292ea1d562a61a569f752954220ba6cbbc0 Mon Sep 17 00:00:00 2001 From: Mariano Spadaccini Date: Fri, 14 Jun 2024 09:13:08 +0200 Subject: Add ch-1 and ch-2 in Python --- challenge-273/spadacciniweb/python/ch-1.py | 61 ++++++++++++++++++++++++++++++ challenge-273/spadacciniweb/python/ch-2.py | 46 ++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 challenge-273/spadacciniweb/python/ch-1.py create mode 100644 challenge-273/spadacciniweb/python/ch-2.py diff --git a/challenge-273/spadacciniweb/python/ch-1.py b/challenge-273/spadacciniweb/python/ch-1.py new file mode 100644 index 0000000000..bfbc5cbc57 --- /dev/null +++ b/challenge-273/spadacciniweb/python/ch-1.py @@ -0,0 +1,61 @@ +# Task 1: Percentage of Character +# Submitted by: Mohammad Sajid Anwar +# +# You are given a string, $str and a character $char. +# Write a script to return the percentage, nearest whole, of given character in the given string. +# +# Example 1 +# Input: $str = "perl", $char = "e" +# Output: 25 +# +# Example 2 +# Input: $str = "java", $char = "a" +# Output: 50 +# +# Example 3 +# Input: $str = "python", $char = "m" +# Output: 0 +# +# Example 4 +# Input: $str = "ada", $char = "a" +# Output: 67 +# +# Example 5 +# Input: $str = "ballerina", $char = "l" +# Output: 22 +# +# Example 6 +# Input: $str = "analitik", $char = "k" +# Output: 13 + +def percentage(str, char): + print("%s -> %d" % + ( str, + round( str.count(char)*100/len(str) ) + ) + ) + +if __name__ == "__main__": + str = "perl" + char = "e" + percentage(str, char) + + str = "java" + char = "a" + percentage(str, char) + + str = "python" + char = "m" + percentage(str, char) + + str = "ada" + char = "a" + percentage(str, char) + + str = "ballerina" + char = "l" + percentage(str, char) + + str = "analitik" + char = "k" + percentage(str, char) diff --git a/challenge-273/spadacciniweb/python/ch-2.py b/challenge-273/spadacciniweb/python/ch-2.py new file mode 100644 index 0000000000..dce0bca454 --- /dev/null +++ b/challenge-273/spadacciniweb/python/ch-2.py @@ -0,0 +1,46 @@ +#!/usr/bin/env perl + +# Task 2: B After A +# Submitted by: Mohammad Sajid Anwar +# +# You are given a string, $str. +# Write a script to return true if there is at least one b, and no a appears after the first b. +# +# Example 1 +# Input: $str = "aabb" +# Output: true +# +# Example 2 +# Input: $str = "abab" +# Output: false +# +# Example 3 +# Input: $str = "aaa" +# Output: false +# +# Example 4 +# Input: $str = "bbb" +# Output: true + +def out(str): + offset = str.find('b') + if offset >= 0 and str.find('a', offset) == -1: + res = "true" + else: + res = "false" + print("%s -> %s" % + ( str, res ) + ) + +if __name__ == "__main__": + str = "aabb" + out(str) + + str = "abab" + out(str) + + str = "aaa" + out(str) + + str = "bbb" + out(str) -- cgit From 63876f502b91d23fc368baf387b52d14c2f781ca Mon Sep 17 00:00:00 2001 From: Mariano Spadaccini Date: Fri, 14 Jun 2024 09:14:27 +0200 Subject: Remake ch-2 in Perl --- challenge-273/spadacciniweb/perl/ch-2.pl | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/challenge-273/spadacciniweb/perl/ch-2.pl b/challenge-273/spadacciniweb/perl/ch-2.pl index a7c968b0fd..9f7cc330ca 100644 --- a/challenge-273/spadacciniweb/perl/ch-2.pl +++ b/challenge-273/spadacciniweb/perl/ch-2.pl @@ -42,14 +42,10 @@ exit 0; sub position { my $str = shift; - my $first_b = index($str, 'b'); - my $last_a = index((scalar reverse $str), 'a'); - $last_a = length($str) - $last_a - 1 - if $last_a >= 0; - + my $offset = index($str, 'b'); printf "%s -> %s\n", $str, - ($last_a > $first_b) - ? 'false' - : 'true'; + ($offset >= 0 and index($str, 'a', $offset) == -1) + ? 'true' + : 'false'; } -- cgit From 6ccb7df2da52549ac03b8d1c079d0b754cf73081 Mon Sep 17 00:00:00 2001 From: deadmarshal Date: Fri, 14 Jun 2024 03:37:26 -0400 Subject: TWC273 --- challenge-273/deadmarshal/go/ch1.go | 24 +++++++++++++++ challenge-273/deadmarshal/go/ch2.go | 18 +++++++++++ challenge-273/deadmarshal/java/Ch1.java | 17 +++++++++++ challenge-273/deadmarshal/java/Ch2.java | 14 +++++++++ challenge-273/deadmarshal/modula-3/ch1/src/Ch1.m3 | 23 ++++++++++++++ .../deadmarshal/modula-3/ch1/src/m3makefile | 5 ++++ challenge-273/deadmarshal/modula-3/ch2/src/Ch2.m3 | 35 ++++++++++++++++++++++ .../deadmarshal/modula-3/ch2/src/m3makefile | 5 ++++ challenge-273/deadmarshal/perl/ch-1.pl | 18 +++++++++++ challenge-273/deadmarshal/perl/ch-2.pl | 13 ++++++++ challenge-273/deadmarshal/raku/ch-1.raku | 15 ++++++++++ challenge-273/deadmarshal/raku/ch-2.raku | 12 ++++++++ 12 files changed, 199 insertions(+) create mode 100644 challenge-273/deadmarshal/go/ch1.go create mode 100644 challenge-273/deadmarshal/go/ch2.go create mode 100644 challenge-273/deadmarshal/java/Ch1.java create mode 100644 challenge-273/deadmarshal/java/Ch2.java create mode 100644 challenge-273/deadmarshal/modula-3/ch1/src/Ch1.m3 create mode 100644 challenge-273/deadmarshal/modula-3/ch1/src/m3makefile create mode 100644 challenge-273/deadmarshal/modula-3/ch2/src/Ch2.m3 create mode 100644 challenge-273/deadmarshal/modula-3/ch2/src/m3makefile create mode 100644 challenge-273/deadmarshal/perl/ch-1.pl create mode 100644 challenge-273/deadmarshal/perl/ch-2.pl create mode 100644 challenge-273/deadmarshal/raku/ch-1.raku create mode 100644 challenge-273/deadmarshal/raku/ch-2.raku diff --git a/challenge-273/deadmarshal/go/ch1.go b/challenge-273/deadmarshal/go/ch1.go new file mode 100644 index 0000000000..72e876ca87 --- /dev/null +++ b/challenge-273/deadmarshal/go/ch1.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" +) + +func percentageOfCharacter(str string, c rune) int { + count := 0 + for _,v := range str { + if v == c { + count++ + } + } + return int(float32(count) / float32(len(str)) * 100.0 + float32(0.5)) +} + +func main() { + fmt.Println(percentageOfCharacter("perl", 'e')) + fmt.Println(percentageOfCharacter("java", 'a')) + fmt.Println(percentageOfCharacter("python", 'm')) + fmt.Println(percentageOfCharacter("ada", 'a')) + fmt.Println(percentageOfCharacter("ballerina", 'l')) + fmt.Println(percentageOfCharacter("analitik", 'k')) +} diff --git a/challenge-273/deadmarshal/go/ch2.go b/challenge-273/deadmarshal/go/ch2.go new file mode 100644 index 0000000000..e58655dc17 --- /dev/null +++ b/challenge-273/deadmarshal/go/ch2.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "strings" +) + +func bAfterA(str string) bool { + i := strings.Index(str,"b") + return i != -1 && strings.LastIndex(str,"a") <= i +} + +func main(){ + fmt.Println(bAfterA("aabb")) + fmt.Println(bAfterA("abab")) + fmt.Println(bAfterA("aaa")) + fmt.Println(bAfterA("bbb")) +} diff --git a/challenge-273/deadmarshal/java/Ch1.java b/challenge-273/deadmarshal/java/Ch1.java new file mode 100644 index 0000000000..267c218829 --- /dev/null +++ b/challenge-273/deadmarshal/java/Ch1.java @@ -0,0 +1,17 @@ +public class Ch1 { + public static void main(String[] args) { + System.out.println(percentage_of_character("perl",'e')); + System.out.println(percentage_of_character("java",'a')); + System.out.println(percentage_of_character("python",'m')); + System.out.println(percentage_of_character("ada",'a')); + System.out.println(percentage_of_character("ballerina",'l')); + System.out.println(percentage_of_character("analitik",'k')); + } + + private static int percentage_of_character(String str,char c) { + int count = 0; + for(int i = 0; i < str.length(); ++i) if(str.charAt(i) == c) count++; + return Math.round(((float)count/str.length()) * 100); + } +} + diff --git a/challenge-273/deadmarshal/java/Ch2.java b/challenge-273/deadmarshal/java/Ch2.java new file mode 100644 index 0000000000..a606950072 --- /dev/null +++ b/challenge-273/deadmarshal/java/Ch2.java @@ -0,0 +1,14 @@ +public class Ch2 { + public static void main(String[] args) { + System.out.println(b_after_a("aabb")); + System.out.println(b_after_a("abab")); + System.out.println(b_after_a("aaa")); + System.out.println(b_after_a("bbb")); + } + + private static boolean b_after_a(String str) { + int i = str.indexOf('b'); + return i != -1 && i >= str.lastIndexOf('a'); + } +} + diff --git a/challenge-273/deadmarshal/modula-3/ch1/src/Ch1.m3 b/challenge-273/deadmarshal/modula-3/ch1/src/Ch1.m3 new file mode 100644 index 0000000000..b78a09364d --- /dev/null +++ b/challenge-273/deadmarshal/modula-3/ch1/src/Ch1.m3 @@ -0,0 +1,23 @@ +MODULE Ch1 EXPORTS Main; + +IMPORT SIO,Text; + +PROCEDURE PercentageOfCharacter(READONLY Str:TEXT; + READONLY C:CHAR):CARDINAL = + VAR Count:CARDINAL := 0; + BEGIN + FOR I := 0 TO Text.Length(Str)-1 DO + IF Text.GetChar(Str,I) = C THEN INC(Count) END + END; + RETURN FLOOR((FLOAT(Count) / FLOAT(Text.Length(Str))) * 100.0 + 0.5) + END PercentageOfCharacter; + +BEGIN + SIO.PutInt(PercentageOfCharacter("perl",'e')); SIO.Nl(); + SIO.PutInt(PercentageOfCharacter("java",'a')); SIO.Nl(); + SIO.PutInt(PercentageOfCharacter("python",'m')); SIO.Nl(); + SIO.PutInt(PercentageOfCharacter("ada",'a')); SIO.Nl(); + SIO.PutInt(PercentageOfCharacter("ballerina",'l')); SIO.Nl(); + SIO.PutInt(PercentageOfCharacter("analitik",'k')); SIO.Nl(); +END Ch1. + diff --git a/challenge-273/deadmarshal/modula-3/ch1/src/m3makefile b/challenge-273/deadmarshal/modula-3/ch1/src/m3makefile new file mode 100644 index 0000000000..9f66e4a51f --- /dev/null +++ b/challenge-273/deadmarshal/modula-3/ch1/src/m3makefile @@ -0,0 +1,5 @@ +import("libm3") +import("libsio") +implementation("Ch1") +program("ch1") + diff --git a/challenge-273/deadmarshal/modula-3/ch2/src/Ch2.m3 b/challenge-273/deadmarshal/modula-3/ch2/src/Ch2.m3 new file mode 100644 index 0000000000..421b09e8e0 --- /dev/null +++ b/challenge-273/deadmarshal/modula-3/ch2/src/Ch2.m3 @@ -0,0 +1,35 @@ +MODULE Ch2 EXPORTS Main; + +IMPORT SIO,Text; + +PROCEDURE FindChar(READONLY Str:TEXT; + READONLY C:CHAR; + READONLY Backwards:BOOLEAN := FALSE):INTEGER = + BEGIN + IF Backwards THEN + FOR I := Text.Length(Str)-1 TO 0 BY -1 DO + IF Text.GetChar(Str,I) = C THEN RETURN I END + END + ELSE + FOR I := 0 TO Text.Length(Str)-1 DO + IF Text.GetChar(Str,I) = C THEN RETURN I END + END + END; + RETURN -1 + END FindChar; + +PROCEDURE BAfterA(READONLY Str:TEXT):BOOLEAN = + VAR + IB:INTEGER := FindChar(Str,'b'); + IA:INTEGER := FindChar(Str,'a',TRUE); + BEGIN + RETURN IB # -1 AND IA <= IB + END BAfterA; + +BEGIN + SIO.PutBool(BAfterA("aabb")); SIO.Nl(); + SIO.PutBool(BAfterA("abab")); SIO.Nl(); + SIO.PutBool(BAfterA("aaa")); SIO.Nl(); + SIO.PutBool(BAfterA("bbb")); SIO.Nl(); +END Ch2. + diff --git a/challenge-273/deadmarshal/modula-3/ch2/src/m3makefile b/challenge-273/deadmarshal/modula-3/ch2/src/m3makefile new file mode 100644 index 0000000000..798c627ef3 --- /dev/null +++ b/challenge-273/deadmarshal/modula-3/ch2/src/m3makefile @@ -0,0 +1,5 @@ +import("libm3") +import("libsio") +implementation("Ch2") +program("ch2") + diff --git a/challenge-273/deadmarshal/perl/ch-1.pl b/challenge-273/deadmarshal/perl/ch-1.pl new file mode 100644 index 0000000000..044da5f05e --- /dev/null +++ b/challenge-273/deadmarshal/perl/ch-1.pl @@ -0,0 +1,18 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use POSIX qw(round); + +sub percentage_of_character{ + my ($str,$char) = @_; + my $count =()= $str =~ /\Q$char/g; + round(100 * $count / length $str) +} + +printf "%d\n",percentage_of_character('perl','e'); +printf "%d\n",percentage_of_character('java','a'); +printf "%d\n",percentage_of_character('python','m'); +printf "%d\n",percentage_of_character('ada','a'); +printf "%d\n",percentage_of_character('ballerina','l'); +printf "%d\n",percentage_of_character('analitik','k'); + diff --git a/challenge-273/deadmarshal/perl/ch-2.pl b/challenge-273/deadmarshal/perl/ch-2.pl new file mode 100644 index 0000000000..5a9f32d508 --- /dev/null +++ b/challenge-273/deadmarshal/perl/ch-2.pl @@ -0,0 +1,13 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +sub b_after_a{ + (-1 != index($_[0],'b')) >= rindex($_[0],'a') +} + +printf "%d\n",b_after_a('aabb'); +printf "%d\n",b_after_a('abab'); +printf "%d\n",b_after_a('aaa'); +printf "%d\n",b_after_a('bbb'); + diff --git a/challenge-273/deadmarshal/raku/ch-1.raku b/challenge-273/deadmarshal/raku/ch-1.raku new file mode 100644 index 0000000000..8b2ecd76e0 --- /dev/null +++ b/challenge-273/deadmarshal/raku/ch-1.raku @@ -0,0 +1,15 @@ +#!/usr/bin/env raku + +sub percentage-of-character($str,$c) +{ + my $count = $str.comb($c).elems; + round(100 * $count / $str.chars) +} + +say percentage-of-character('perl','e'); +say percentage-of-character('java','a'); +say percentage-of-character('python','m'); +say percentage-of-character('ada','a'); +say percentage-of-character('ballerina','l'); +say percentage-of-character('analitik','k'); + diff --git a/challenge-273/deadmarshal/raku/ch-2.raku b/challenge-273/deadmarshal/raku/ch-2.raku new file mode 100644 index 0000000000..bd2bb29664 --- /dev/null +++ b/challenge-273/deadmarshal/raku/ch-2.raku @@ -0,0 +1,12 @@ +#!/usr/bin/env raku + +sub b-after-a($str) +{ + ?($str ~~ /bb/) +} + +say b-after-a('aabb'); +say b-after-a('abab'); +say b-after-a('aaa'); +say b-after-a('bbb'); + -- cgit From f38f02987804feb1a1803099f8c832ec75dfd79a Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Fri, 14 Jun 2024 09:24:11 +0100 Subject: - Added solutions by Mariano Spadaccini. - Added solutions by Reinier Maliepaard. - Added solutions by Ali Moradi. --- challenge-273/reinier-maliepaard/blog.txt | 1 + challenge-273/reinier-maliepaard/perl/ch-1.pl | 47 + challenge-273/reinier-maliepaard/perl/ch-2.pl | 88 + stats/pwc-current.json | 318 +- stats/pwc-language-breakdown-summary.json | 70 +- stats/pwc-language-breakdown.json | 10618 ++++++++++++------------ stats/pwc-leaders.json | 750 +- stats/pwc-summary-1-30.json | 48 +- stats/pwc-summary-121-150.json | 104 +- stats/pwc-summary-151-180.json | 46 +- stats/pwc-summary-181-210.json | 40 +- stats/pwc-summary-211-240.json | 126 +- stats/pwc-summary-241-270.json | 118 +- stats/pwc-summary-271-300.json | 110 +- stats/pwc-summary-301-330.json | 38 +- stats/pwc-summary-31-60.json | 98 +- stats/pwc-summary-61-90.json | 130 +- stats/pwc-summary-91-120.json | 52 +- stats/pwc-summary.json | 672 +- 19 files changed, 6824 insertions(+), 6650 deletions(-) create mode 100644 challenge-273/reinier-maliepaard/blog.txt create mode 100644 challenge-273/reinier-maliepaard/perl/ch-1.pl create mode 100644 challenge-273/reinier-maliepaard/perl/ch-2.pl diff --git a/challenge-273/reinier-maliepaard/blog.txt b/challenge-273/reinier-maliepaard/blog.txt new file mode 100644 index 0000000000..7b99b8f2e0 --- /dev/null +++ b/challenge-273/reinier-maliepaard/blog.txt @@ -0,0 +1 @@ +https://reiniermaliepaard.nl/perl/pwc/index.php?id=pwc273 diff --git a/challenge-273/reinier-maliepaard/perl/ch-1.pl b/challenge-273/reinier-maliepaard/perl/ch-1.pl new file mode 100644 index 0000000000..31ce4bff5b --- /dev/null +++ b/challenge-273/reinier-maliepaard/perl/ch-1.pl @@ -0,0 +1,47 @@ +#!/usr/bin/perl +use strict; +use warnings; + +sub percentage_of_character { + + my ($str, $char) = (@_); + + # create a new Statistics::Frequency object. + my $f = Statistics::Frequency->new( split(//, $str) ); + return( int( ($f->proportional_frequency($char) * 100) + 0.5) ); + +} + +#TESTS + +my ($str, $char); + +# Example 1 +$str = "perl"; +$char = "e"; +print(percentage_of_character($str, $char), "\n"); # Output: 25 + +# Example 2 +$str = "java"; +$char = "a"; +print(percentage_of_character($str, $char), "\n"); # Output: 50 + +# Example 3 +$str = "python"; +$char = "m"; +print(percentage_of_character($str, $char), "\n"); # Output: 0 + +# Example 4 +$str = "ada"; +$char = "a"; +print(percentage_of_character($str, $char), "\n"); # Output: 67 + +# Example 5 +$str = "ballerina"; +$char = "l"; +print(percentage_of_character($str, $char), "\n"); # Output: 22 + +# Example 6 +$str = "analitik"; +$char = "k"; +print(percentage_of_character($str, $char), "\n"); # Output: 13 diff --git a/challenge-273/reinier-maliepaard/perl/ch-2.pl b/challenge-273/reinier-maliepaard/perl/ch-2.pl new file mode 100644 index 0000000000..d8c125399c --- /dev/null +++ b/challenge-273/reinier-maliepaard/perl/ch-2.pl @@ -0,0 +1,88 @@ +#!/usr/bin/perl +use strict; +use warnings; + +=begin + I prefer not to replicate the interesting regex solutions of others. + Therefore, I chose a different approach using the 'index' method. + + Postulate 1: The string must contain at least one 'b'. Strings like + 'b', 'bb', 'bbb', etc., are also valid. + Postulate 2: If a string contains the characters 'a' and 'b', then + 'a' is not allowed to follow the first 'b'. There are + two cases to consider: + 1. If 'ba' appears at the beginning of a string, it + should be evaluated as 'false'. + 2. If 'ba' appears elsewhere in the string, it must be + preceded by another 'b' to be evaluated as 'true'. + For instance, 'aaba' is 'false' but 'aabba' is 'true'. + + Performance: benchmarking my solution against several regex solutions I + found on GitHub showed that it performs adequately. It is neither the + fastest nor the slowest. +=cut + +sub BafterA { + + # 'b' in $_[0]? + return(0) if(index($_[0], "b") == -1); + # 'ba' at the beginning of $_[0] + return(0) if(index($_[0], "ba") == 0); + # 'bba'? 'aba' not allowed + return(0) if ((index($_[0], "ba") > 0) && (substr($_[0], (index($_[0], "ba")-1), 1) ne "b")); + 1; +} + +# TESTS + +my $str; + +# Example 1 +$str = "aabb"; +print(BafterA($str), "\n"); # Output: 1 + +# Example 2 +$str = "abab"; +print(BafterA($str), "\n"); # Output: 0 + +# Example 3 +$str = "aaa"; +print(BafterA($str), "\n"); # Output: 0 + +# Example 4 +$str = "bbb"; +print(BafterA($str), "\n"); # Output: 1 + +# Own tests + +# Example 5 +$str = "b"; +print(BafterA($str), "\n"); # Output: 1 + +# Example 6 +$str = "a"; +print(BafterA($str), "\n"); # Output: 0 + +# Example 7 +$str = "ba"; +print(BafterA($str), "\n"); # Output: 0 + +# Example 8 +$str = "ab"; +print(BafterA($str), "\n"); # Output: 1 + +# Example 9 +$str = "bba"; +print(BafterA($str), "\n"); # Output: 1 + +# Example 10 +$str = "aba"; +print(BafterA($str), "\n"); # Output: 0 + +# Example 11 +$str = "abba"; +print(BafterA($str), "\n"); # Output: 1 + +# Example 12 +$str = "babba"; +print(BafterA($str), "\n"); # Output: 0 diff --git a/stats/pwc-current.json b/stats/pwc-current.json index 88d16fce3c..1896ab74b5 100644 --- a/stats/pwc-current.json +++ b/stats/pwc-current.json @@ -1,105 +1,4 @@ { - "series" : [ - { - "data" : [ - { - "y" : 2, - "name" : "Andrew Shitov", - "drilldown" : "Andrew Shitov" - }, - { - "y" : 3, - "name" : "Dave Jacoby", - "drilldown" : "Dave Jacoby" - }, - { - "name" : "David Ferrone", - "y" : 2, - "drilldown" : "David Ferrone" - }, - { - "drilldown" : "E. Choroba", - "name" : "E. Choroba", - "y" : 2 - }, - { - "drilldown" : "Laurent Rosenfeld", - "y" : 6, - "name" : "Laurent Rosenfeld" - }, - { - "drilldown" : "Luca Ferrari", - "name" : "Luca Ferrari", - "y" : 11 - }, - { - "drilldown" : "Mariano Spadaccini", - "name" : "Mariano Spadaccini", - "y" : 2 - }, - { - "drilldown" : "Mark Anderson", - "name" : "Mark Anderson", - "y" : 2 - }, - { - "drilldown" : "Matthew Neleigh", - "name" : "Matthew Neleigh", - "y" : 2 - }, - { - "name" : "Niels van Dijke", - "y" : 2, - "drilldown" : "Niels van Dijke" - }, - { - "y" : 5, - "name" : "Packy Anderson", - "drilldown" : "Packy Anderson" - }, - { - "name" : "Peter Campbell Smith", - "y" : 3, - "drilldown" : "Peter Campbell Smith" - }, - { - "name" : "Peter Meszaros", - "y" : 2, - "drilldown" : "Peter Meszaros" - }, - { - "name" : "Robbie Hatley", - "y" : 3, - "drilldown" : "Robbie Hatley" - }, - { - "y" : 4, - "name" : "Roger Bell_West", - "drilldown" : "Roger Bell_West" - }, - { - "drilldown" : "Thomas Kohler", - "name" : "Thomas Kohler", - "y" : 4 - }, - { - "y" : 4, - "name" : "Ulrich Rieke", - "drilldown" : "Ulrich Rieke" - }, - { - "drilldown" : "Wanderdoc", - "y" : 2, - "name" : "Wanderdoc" - } - ], - "name" : "The Weekly Challenge - 273", - "colorByPoint" : 1 - } - ], - "subtitle" : { - "text" : "[Champions: 18] Last updated at 2024-06-13 12:09:17 GMT" - }, "xAxis" : { "type" : "category" }, @@ -108,23 +7,48 @@ "text" : "Total Solutions" } }, + "tooltip" : { + "followPointer" : 1, + "headerFormat" : "{series.name}
", + "pointFormat" : "{point.name}: {point.y:f}
" + }, "title" : { "text" : "The Weekly Challenge - 273" }, + "chart" : { + "type" : "column" + }, + "legend" : { + "enabled" : 0 + }, "drilldown" : { "series" : [ { - "id" : "Andrew Shitov", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ], + "id" : "Ali Moradi", + "name" : "Ali Moradi" + }, + { + "name" : "Andrew Shitov", "data" : [ [ "Raku", 2 ] ], - "name" : "Andrew Shitov" + "id" : "Andrew Shitov" }, { - "id" : "Dave Jacoby", + "name" : "Dave Jacoby", "data" : [ [ "Perl", @@ -135,7 +59,7 @@ 1 ] ], - "name" : "Dave Jacoby" + "id" : "Dave Jacoby" }, { "id" : "David Ferrone", @@ -148,18 +72,18 @@ "name" : "David Ferrone" }, { - "id" : "E. Choroba", "data" : [ [ "Perl", 2 ] ], + "id" : "E. Choroba", "name" : "E. Choroba" }, { - "id" : "Laurent Rosenfeld", "name" : "Laurent Rosenfeld", + "id" : "Laurent Rosenfeld", "data" : [ [ "Perl", @@ -176,7 +100,6 @@ ] }, { - "id" : "Luca Ferrari", "name" : "Luca Ferrari", "data" : [ [ @@ -187,47 +110,48 @@ "Blog", 9 ] - ] + ], + "id" : "Luca Ferrari" }, { + "name" : "Mariano Spadaccini", "data" : [ [ "Perl", 2 ] ], - "name" : "Mariano Spadaccini", "id" : "Mariano Spadaccini" }, { - "id" : "Mark Anderson", + "name" : "Mark Anderson", "data" : [ [ "Raku", 2 ] ], - "name" : "Mark Anderson" + "id" : "Mark Anderson" }, { + "name" : "Matthew Neleigh", "id" : "Matthew Neleigh", "data" : [ [ "Perl", 2 ] - ], - "name" : "Matthew Neleigh" + ] }, { "id" : "Niels van Dijke", - "name" : "Niels van Dijke", "data" : [ [ "Perl", 2 ] - ] + ], + "name" : "Niels van Dijke" }, { "id" : "Packy Anderson", @@ -258,8 +182,8 @@ 1 ] ], - "name" : "Peter Campbell Smith", - "id" : "Peter Campbell Smith" + "id" : "Peter Campbell Smith", + "name" : "Peter Campbell Smith" }, { "name" : "Peter Meszaros", @@ -272,7 +196,7 @@ "id" : "Peter Meszaros" }, { - "name" : "Robbie Hatley", + "name" : "Reinier Maliepaard", "data" : [ [ "Perl", @@ -283,23 +207,38 @@ 1 ] ], - "id" : "Robbie Hatley" + "id" : "Reinier Maliepaard" }, { + "id" : "Robbie Hatley", "data" : [ [ "Perl", 2 ], [ - "Raku", - 2 + "Blog", + 1 ] ], + "name" : "Robbie Hatley" + }, + { "name" : "Roger Bell_West", - "id" : "Roger Bell_West" + "id" : "Roger Bell_West", + "data" : [ + [ + "Perl", + 2 + ], + [ + "Raku", + 2 + ] + ] }, { + "name" : "Thomas Kohler", "id" : "Thomas Kohler", "data" : [ [ @@ -310,8 +249,7 @@ "Blog", 2 ] - ], - "name" : "Thomas Kohler" + ] }, { "id" : "Ulrich Rieke", @@ -328,35 +266,135 @@ "name" : "Ulrich Rieke" }, { + "name" : "Wanderdoc", + "id" : "Wanderdoc", "data" : [ [ "Perl", 2 ] - ], - "name" : "Wanderdoc", - "id" : "Wanderdoc" + ] } ] }, "plotOptions" : { "series" : { + "borderWidth" : 0, "dataLabels" : { "format" : "{point.y}", "enabled" : 1 - }, - "borderWidth" : 0 + } } }, - "tooltip" : { - "followPointer" : 1, - "headerFormat" : "{series.name}
", - "pointFormat" : "{point.name}: {point.y:f}
" - }, - "legend" : { - "enabled" : 0 + "subtitle" : { + "text" : "[Champions: 20] Last updated at 2024-06-14 08:18:44 GMT" }, - "chart" : { - "type" : "column" - } + "series" : [ + { + "name" : "The Weekly Challenge - 273", + "data" : [ + { + "drilldown" : "Ali Moradi", + "name" : "Ali Moradi", + "y" : 4 + }, + { + "y" : 2, + "name" : "Andrew Shitov", + "drilldown" : "Andrew Shitov" + }, + { + "drilldown" : "Dave Jacoby", + "y" : 3, + "name" : "Dave Jacoby" + }, + { + "drilldown" : "David Ferrone", + "y" : 2, + "name" : "David Ferrone" + }, + { + "name" : "E. Choroba", + "y" : 2, + "drilldown" : "E. Choroba" + }, + { + "drilldown" : "Laurent Rosenfeld", + "name" : "Laurent Rosenfeld", + "y" : 6 + }, + { + "y" : 11, + "name" : "Luca Ferrari", + "drilldown" : "Luca Ferrari" + }, + { + "drilldown" : "Mariano Spadaccini", + "y" : 2, + "name" : "Mariano Spadaccini" + }, + { + "name" : "Mark Anderson", + "y" : 2, + "drilldown" : "Mark Anderson" + }, + { + "y" : 2, + "name" : "Matthew Neleigh", + "drilldown" : "Matthew Neleigh" + }, + { + "drilldown" : "Niels van Dijke", + "name" : "Niels van Dijke", + "y" : 2 + }, + { + "y" : 5, + "name" : "Packy Anderson", + "drilldown" : "Packy Anderson" + }, + { + "drilldown" : "Peter Campbell Smith", + "y" : 3, + "name" : "Peter Campbell Smith" + }, + { + "name" : "Peter Meszaros", + "y" : 2, + "drilldown" : "Peter Meszaros" + }, + { + "name" : "Reinier Maliepaard", + "y" : 3, + "drilldown" : "Reinier Maliepaard" + }, + { + "name" : "Robbie Hatley", + "y" : 3, + "drilldown" : "Robbie Hatley" + }, + { + "drilldown" : "Roger Bell_West", + "name" : "Roger Bell_West", + "y" : 4 + }, + { + "y" : 4, + "name" : "Thomas Kohler", + "drilldown" : "Thomas Kohler" + }, + { + "drilldown" : "Ulrich Rieke", + "y" : 4, + "name" : "Ulrich Rieke" + }, + { + "drilldown" : "Wanderdoc", + "name" : "Wanderdoc", + "y" : 2 + } + ], + "colorByPoint" : 1 + } + ] } diff --git a/stats/pwc-language-breakdown-summary.json b/stats/pwc-language-breakdown-summary.json index 40f7c0c561..2dd33a30a8 100644 --- a/stats/pwc-language-breakdown-summary.json +++ b/stats/pwc-language-breakdown-summary.json @@ -1,63 +1,63 @@ { - "title" : { - "text" : "The Weekly Challenge Contributions [2019 - 2024]" - }, - "yAxis" : { - "title" : { - "text" : null - }, - "min" : 0 - }, - "subtitle" : { - "text" : "Last updated at 2024-06-13 12:09:17 GMT" - }, "series" : [ { + "name" : "Contributions", "data" : [ [ "Blog", - 4961 + 4962 ], [ "Perl", - 14132 + 14136 ], [ "Raku", - 8194 + 8196 ] ], "dataLabels" : { - "y" : 10, - "enabled" : "true", + "color" : "#FFFFFF", "style" : { - "fontFamily" : "Verdana, sans-serif", - "fontSize" : "13px" + "fontSize" : "13px", + "fontFamily" : "Verdana, sans-serif" }, - "align" : "right", - "rotation" : -90, "format" : "{point.y:.0f}", - "color" : "#FFFFFF" - }, - "name" : "Contributions" + "y" : 10, + "align" : "right", + "enabled" : "true", + "rotation" : -90 + } } ], - "xAxis" : { - "labels" : { - "style" : { - "fontSize" : "13px", - "fontFamily" : "Verdana, sans-serif" - } - }, - "type" : "category" - }, - "legend" : { - "enabled" : "false" + "title" : { + "text" : "The Weekly Challenge Contributions [2019 - 2024]" }, "chart" : { "type" : "column" }, + "legend" : { + "enabled" : "false" + }, "tooltip" : { "pointFormat" : "{point.y:.0f}" + }, + "subtitle" : { + "text" : "Last updated at 2024-06-14 08:18:44 GMT" + }, + "yAxis" : { + "title" : { + "text" : null + }, + "min" : 0 + }, + "xAxis" : { + "labels" : { + "style" : { + "fontFamily" : "Verdana, sans-serif", + "fontSize" : "13px" + } + }, + "type" : "category" } } diff --git a/stats/pwc-language-breakdown.json b/stats/pwc-language-breakdown.json index 6de86fc657..b899ecbd0b 100644 --- a/stats/pwc-language-breakdown.json +++ b/stats/pwc-language-breakdown.json @@ -1,4946 +1,15 @@ { - "chart" : { - "type" : "column" - }, - "legend" : { - "enabled" : "false" - }, - "drilldown" : { - "series" : [ - { - "data" : [ - [ - "Perl", - 107 - ], - [ - "Raku", - 49 - ], - [ - "Blog", - 12 - ] - ], - "name" : "001", - "id" : "001" - }, - { - "data" : [ - [ - "Perl", - 85 - ], - [ - "Raku", - 38 - ], - [ - "Blog", - 10 - ] - ], - "name" : "002", - "id" : "002" - }, - { - "id" : "003", - "data" : [ - [ - "Perl", - 50 - ], - [ - "Raku", - 32 - ], - [ - "Blog", - 9 - ] - ], - "name" : "003" - }, - { - "id" : "004", - "name" : "004", - "data" : [ - [ - "Perl", - 62 - ], - [ - "Raku", - 34 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "005", - "name" : "005", - "data" : [ - [ - "Perl", - 44 - ], - [ - "Raku", - 26 - ], - [ - "Blog", - 12 - ] - ] - }, - { - "name" : "006", - "data" : [ - [ - "Perl", - 38 - ], - [ - "Raku", - 18 - ], - [ - "Blog", - 7 - ] - ], - "id" : "006" - }, - { - "id" : "007", - "data" : [ - [ - "Perl", - 38 - ], - [ - "Raku", - 23 - ], - [ - "Blog", - 10 - ] - ], - "name" : "007" - }, - { - "id" : "008", - "name" : "008", - "data" : [ - [ - "Perl", - 50 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 12 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 48 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 13 - ] - ], - "name" : "009", - "id" : "009" - }, - { - "id" : "010", - "name" : "010", - "data" : [ - [ - "Perl", - 41 - ], - [ - "Raku", - 19 - ], - [ - "Blog", - 11 - ] - ] - }, - { - "id" : "011", - "data" : [ - [ - "Perl", - 53 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 10 - ] - ], - "name" : "011" - }, - { - "id" : "012", - "data" : [ - [ - "Perl", - 53 - ], - [ - "Raku", - 32 - ], - [ - "Blog", - 11 - ] - ], - "name" : "012" - }, - { - "id" : "013", - "name" : "013", - "data" : [ - [ - "Perl", - 50 - ], - [ - "Raku", - 25 - ], - [ - "Blog", - 13 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 58 - ], - [ - "Raku", - 31 - ], - [ - "Blog", - 15 - ] - ], - "name" : "014", - "id" : "014" - }, - { - "id" : "015", - "name" : "015", - "data" : [ - [ - "Perl", - 60 - ], - [ - "Raku", - 28 - ], - [ - "Blog", - 15 - ] - ] - }, - { - "data" : [ - [ - "Perl", - 38 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 13 - ] - ], - "name" : "016", - "id" : "016" - }, - { - "id" : "017", - "data" : [ - [ - "Perl", - 48 - ], - [ - "Raku", - 27 - ], - [ - "Blog", - 12 - ] - ], - "name" : "017" - }, - { - "data" : [ - [ - "Perl", - 39 - ], - [ - "Raku", - 31 - ], - [ - "Blog", - 14 - ] - ], - "name" : "018", - "id" : "018" - }, - { - "id" : "019", - "data" : [ - [ - "Perl", - 58 - ], - [ - "Raku", - 34 - ], - [ - "Blog", - 13 - ] - ], - "name" : "019" - }, - { - "id" : "020", - "name" : "020", - "data" : [ - [ - "Perl", - 53 - ], - [ - "Raku", - 37 - ], - [ - "Blog", - 13 - ] - ] - }, - { - "name" : "021", - "data" : [ - [ - "Perl", - 40 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 10 - ] - ], - "id" : "021" - }, - { - "id" : "022", - "name" : "022", - "data" : [ - [ - "Perl", - 39 - ], - [ - "Raku", - 23 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "023", - "data" : [ - [ - "Perl", - 57 - ], - [ - "Raku", - 32 - ], - [ - "Blog", - 12 - ] - ], - "name" : "023" - }, - { - "id" : "024", - "data" : [ - [ - "Perl", - 40 - ], - [ - "Raku", - 26 - ], - [ - "Blog", - 11 - ] - ], - "name" : "024" - }, - { - "id" : "025", - "data" : [ - [ - "Perl", - 31 - ], - [ - "Raku", - 19 - ], - [ - "Blog", - 12 - ] - ], - "name" : "025" - }, - { - "id" : "026", - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 29 - ], - [ - "Blog", - 10 - ] - ], - "name" : "026" - }, - { - "id" : "027", - "data" : [ - [ - "Perl", - 33 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 9 - ] - ], - "name" : "027" - }, - { - "id" : "028", - "data" : [ - [ - "Perl", - 47 - ], - [ - "Raku", - 26 - ], - [ - "Blog", - 9 - ] - ], - "name" : "028" - }, - { - "id" : "029", - "data" : [ - [ - "Perl", - 44 - ], - [ - "Raku", - 27 - ], - [ - "Blog", - 12 - ] - ], - "name" : "029" - }, - { - "id" : "030", - "name" : "030", - "data" : [ - [ - "Perl", - 78 - ], - [ - "Raku", - 33 - ], - [ - "Blog", - 10 - ] - ] - }, - { - "id" : "031", - "data" : [ - [ - "Perl", - 54 - ], - [ - "Raku", - 30 - ], - [ - "Blog", - 9 - ] - ], - "name" : "031" - }, - { - "data" : [ - [ - "Perl", - 61 - ], - [ - "Raku", - 27 - ], - [ - "Blog", - 10 - ] - ], - "name" : "032", - "id" : "032" - }, - { - "name" : "033", - "data" : [ - [ - "Perl", - 66 - ], - [ - "Raku", - 38 - ], - [ - "Blog", - 10 - ] - ], - "id" : "033" - }, - { - "data" : [ - [ - "Perl", - 36 - ], - [ - "Raku", - 23 - ], - [ - "Blog", - 11 - ] - ], - "name" : "034", - "id" : "034" - }, - { - "name" : "035", - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 9 - ] - ], - "id" : "035" - }, - { - "id" : "036", - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 22 - ], - [ - "Blog", - 11 - ] - ], - "name" : "036" - }, - { - "data" : [ - [ - "Perl", - 37 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 9 - ] - ], - "name" : "037", - "id" : "037" - }, - { - "data" : [ - [ - "Perl", - 38 - ], - [ - "Raku", - 24 - ], - [ - "Blog", - 12 - ] - ], - "name" : "038", - "id" : "038" - }, - { - "name" : "039", - "data" : [ - [ - "Perl", - 35 - ], - [ - "Raku", - 21 - ], - [ - "Blog", - 12 - ] - ], - "id" : "039" - }, - { - "id" : "040", - "name" : "040", - "data" : [ - [ - "Perl", - 43 -