aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xchallenge-281/wanderdoc/perl/ch-1.pl73
-rwxr-xr-xchallenge-281/wanderdoc/perl/ch-2.pl124
-rw-r--r--stats/pwc-current.json169
-rw-r--r--stats/pwc-language-breakdown-2019.json338
-rw-r--r--stats/pwc-language-breakdown-2020.json438
-rw-r--r--stats/pwc-language-breakdown-2021.json750
-rw-r--r--stats/pwc-language-breakdown-2022.json372
-rw-r--r--stats/pwc-language-breakdown-2023.json386
-rw-r--r--stats/pwc-language-breakdown-2024.json288
-rw-r--r--stats/pwc-language-breakdown-summary.json44
-rw-r--r--stats/pwc-leaders.json414
-rw-r--r--stats/pwc-summary-1-30.json38
-rw-r--r--stats/pwc-summary-121-150.json32
-rw-r--r--stats/pwc-summary-151-180.json108
-rw-r--r--stats/pwc-summary-181-210.json98
-rw-r--r--stats/pwc-summary-211-240.json34
-rw-r--r--stats/pwc-summary-241-270.json104
-rw-r--r--stats/pwc-summary-271-300.json100
-rw-r--r--stats/pwc-summary-301-330.json82
-rw-r--r--stats/pwc-summary-31-60.json40
-rw-r--r--stats/pwc-summary-61-90.json106
-rw-r--r--stats/pwc-summary-91-120.json30
-rw-r--r--stats/pwc-summary.json38
-rw-r--r--stats/pwc-yearly-language-summary.json144
24 files changed, 2281 insertions, 2069 deletions
diff --git a/challenge-281/wanderdoc/perl/ch-1.pl b/challenge-281/wanderdoc/perl/ch-1.pl
new file mode 100755
index 0000000000..66a62161ad
--- /dev/null
+++ b/challenge-281/wanderdoc/perl/ch-1.pl
@@ -0,0 +1,73 @@
+#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+You are given coordinates, a string that represents the coordinates of a square of the chessboard as shown below:
+Write a script to return true if the square is white, and false if the square is black.
+
+Example 1
+
+Input: $coordinates = "d3"
+Output: true
+
+Example 2
+
+Input: $coordinates = "g5"
+Output: false
+
+Example 3
+
+Input: $coordinates = "e6"
+Output: true
+=cut
+
+package Field
+{
+ use constant {true => 1, false => 0};
+ use subs 'to_num', 'from_num', 'field_color';
+ use Class::Tiny qw (chess num);
+ sub to_num
+ {
+ my $self = $_[0];
+ my $notation = $self->chess;
+ my %map;
+ @map{'a' .. 'h'} = 0 .. 7;
+ my ($y, $x) = split(//, $notation);
+ return [$map{$y}, $x - 1];
+ };
+ sub from_num
+ {
+ my ($self, $field_ref) = @_;
+ my %map;
+ @map{0 ..7} = 'a' .. 'h';
+ my ($y, $x) = @$field_ref;
+ return join('', $map{$y}, $x + 1);
+ }
+ sub field_color
+ {
+ my $self = $_[0];
+ if ( $self->chess =~ /[aceg][1357]/ or $self->chess =~ /[bdfh][2468]/)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+1;
+};
+
+use constant {true => 1, false => 0};
+use Test2::V0;
+is(testing_field('d3'), true, 'Example 1');
+is(testing_field('g5'), false, 'Example 2');
+is(testing_field('e6'), true, 'Example 3');
+done_testing();
+
+sub testing_field
+{
+ my $field = Field->new(chess => $_[0]);
+ return $field->field_color;
+} \ No newline at end of file
diff --git a/challenge-281/wanderdoc/perl/ch-2.pl b/challenge-281/wanderdoc/perl/ch-2.pl
new file mode 100755
index 0000000000..dda2910ce3
--- /dev/null
+++ b/challenge-281/wanderdoc/perl/ch-2.pl
@@ -0,0 +1,124 @@
+#!perl
+use strict;
+use warnings FATAL => qw(all);
+
+=prompt
+A knight in chess can move from its current position to any square two rows or columns plus one column or row away. So in the diagram below, if it starts a S, it can move to any of the squares marked E.
+Write a script which takes a starting position and an ending position and calculates the least number of moves required.
+
+Example 1
+
+Input: $start = 'g2', $end = 'a8'
+Ouput: 4
+
+g2 -> e3 -> d5 -> c7 -> a8
+
+Example 2
+
+Input: $start = 'g2', $end = 'h2'
+Ouput: 3
+
+g2 -> e3 -> f1 -> h2
+=cut
+
+package Field
+{
+ use subs 'to_num', 'from_num';
+ use Class::Tiny qw (chess num);
+ sub to_num
+ {
+ my $self = $_[0];
+ my $notation = $self->chess;
+ my %map;
+ @map{'a' .. 'h'} = 0 .. 7;
+ my ($y, $x) = split(//, $notation);
+ return [$map{$y}, $x - 1];
+ };
+ sub from_num
+ {
+ my ($self, $field_ref) = @_;
+ my %map;
+ @map{0 ..7} = 'a' .. 'h';
+ my ($y, $x) = @$field_ref;
+ return join('', $map{$y}, $x + 1);
+ }
+1;
+};
+
+package Knight
+{
+ use parent -norequire, 'Field';
+ use subs 'make_move';
+ use Class::Tiny
+ {
+ chess => 'Field->chess',
+ all_moves => sub
+ {
+ my @arr = ([-2, -1], [-1, -2], [-2, 1], [-1, 2], [2, -1], [1, -2], [2, 1], [1, 2]);
+ return \@arr;
+ }
+ };
+ sub make_move
+ {
+ my $self = $_[0];
+ my $coord_delta = $_[1];
+ my $coord_old = $self->to_num;
+ my $x_new = $coord_old->[1] + $coord_delta->[1];
+ my $y_new = $coord_old->[0] + $coord_delta->[0];
+ if ( $x_new >= 0 and $y_new >= 0 and $x_new < 8 and $y_new < 8 )
+ {
+ $self->num([$y_new, $x_new]);
+ $self->chess($self->from_num($self->num));
+ }
+ return $self;
+ }
+1;
+};
+
+use Test2::V0;
+
+is(test_path('g2', 'a8'), 4, 'Example 1');
+is(test_path('g2', 'h2'), 3, 'Example 2');
+done_testing();
+
+sub test_path
+{
+ my ($start, $end) = @_;
+ my @output = find_path($start, $end);
+ return scalar @output - 1;
+}
+
+
+sub find_path
+{
+ my ($start, $end) = @_;
+ my @queue;
+ my %seen;
+
+ @queue = ([$start]);
+
+ $seen{$start} = 1;
+
+ while ( @queue )
+ {
+ my $this = shift @queue;
+ my $place = $this->[-1];
+
+ if ( $place eq $end )
+ {
+ return @$this;
+ }
+ else
+ {
+ MOVE: for my $move (@{Knight->all_moves})
+ {
+ my $knight = Knight->new(chess => $place);
+ $knight->make_move($move);
+ next MOVE if ($seen{$knight->chess});
+ $seen{$knight->chess} = 1;
+ push @queue, [@$this, $knight->chess];
+ }
+ }
+ }
+}
+
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 153a1f7fac..a1fab7f9ed 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,9 +1,8 @@
{
- "title" : {
- "text" : "The Weekly Challenge - 281"
- },
- "legend" : {
- "enabled" : 0
+ "tooltip" : {
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
+ "followPointer" : 1,
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>"
},
"chart" : {
"type" : "column"
@@ -16,16 +15,18 @@
"drilldown" : {
"series" : [
{
+ "id" : "Alexander Karelas",
+ "name" : "Alexander Karelas",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "Alexander Karelas",
- "id" : "Alexander Karelas"
+ ]
},
{
+ "id" : "Dave Jacoby",
+ "name" : "Dave Jacoby",
"data" : [
[
"Perl",
@@ -35,29 +36,27 @@
"Blog",
1
]
- ],
- "name" : "Dave Jacoby",
- "id" : "Dave Jacoby"
+ ]
},
{
+ "id" : "David Ferrone",
+ "name" : "David Ferrone",
"data" : [
[
"Perl",
2
]
- ],
- "id" : "David Ferrone",
- "name" : "David Ferrone"
+ ]
},
{
- "id" : "E. Choroba",
- "name" : "E. Choroba",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "name" : "E. Choroba",
+ "id" : "E. Choroba"
},
{
"data" : [
@@ -70,24 +69,24 @@
"id" : "Feng Chang"
},
{
- "id" : "Jan Krnavek",
- "name" : "Jan Krnavek",
"data" : [
[
"Raku",
2
]
- ]
+ ],
+ "name" : "Jan Krnavek",
+ "id" : "Jan Krnavek"
},
{
+ "name" : "Kjetil Skotheim",
+ "id" : "Kjetil Skotheim",
"data" : [
[
"Perl",
2
]
- ],
- "name" : "Kjetil Skotheim",
- "id" : "Kjetil Skotheim"
+ ]
},
{
"data" : [
@@ -104,8 +103,8 @@
1
]
],
- "id" : "Laurent Rosenfeld",
- "name" : "Laurent Rosenfeld"
+ "name" : "Laurent Rosenfeld",
+ "id" : "Laurent Rosenfeld"
},
{
"data" : [
@@ -114,8 +113,8 @@
2
]
],
- "name" : "Mariano Ortega",
- "id" : "Mariano Ortega"
+ "id" : "Mariano Ortega",
+ "name" : "Mariano Ortega"
},
{
"data" : [
@@ -128,6 +127,8 @@
"id" : "Mark Anderson"
},
{
+ "id" : "Packy Anderson",
+ "name" : "Packy Anderson",
"data" : [
[
"Perl",
@@ -141,11 +142,11 @@
"Blog",
1
]
- ],
- "name" : "Packy Anderson",
- "id" : "Packy Anderson"
+ ]
},
{
+ "id" : "Thomas Kohler",
+ "name" : "Thomas Kohler",
"data" : [
[
"Perl",
@@ -155,9 +156,7 @@
"Blog",
2
]
- ],
- "name" : "Thomas Kohler",
- "id" : "Thomas Kohler"
+ ]
},
{
"data" : [
@@ -170,41 +169,48 @@
1
]
],
- "name" : "W. Luis Mochan",
- "id" : "W. Luis Mochan"
+ "id" : "W. Luis Mochan",
+ "name" : "W. Luis Mochan"
+ },
+ {
+ "data" : [
+ [
+ "Perl",
+ 2
+ ]
+ ],
+ "name" : "Wanderdoc",
+ "id" : "Wanderdoc"
}
]
},
- "subtitle" : {
- "text" : "[Champions: 13] Last updated at 2024-08-06 09:04:30 GMT"
- },
- "tooltip" : {
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
- "followPointer" : 1,
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>"
- },
- "xAxis" : {
- "type" : "category"
+ "plotOptions" : {
+ "series" : {
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ },
+ "borderWidth" : 0
+ }
},
"series" : [
{
"name" : "The Weekly Challenge - 281",
- "colorByPoint" : 1,
"data" : [
{
"y" : 2,
- "drilldown" : "Alexander Karelas",
- "name" : "Alexander Karelas"
+ "name" : "Alexander Karelas",
+ "drilldown" : "Alexander Karelas"
},
{
+ "y" : 3,
"name" : "Dave Jacoby",
- "drilldown" : "Dave Jacoby",
- "y" : 3
+ "drilldown" : "Dave Jacoby"
},
{
- "y" : 2,
"drilldown" : "David Ferrone",
- "name" : "David Ferrone"
+ "name" : "David Ferrone",
+ "y" : 2
},
{
"drilldown" : "E. Choroba",
@@ -212,60 +218,69 @@
"y" : 2
},
{
+ "drilldown" : "Feng Chang",
"y" : 2,
- "name" : "Feng Chang",
- "drilldown" : "Feng Chang"
+ "name" : "Feng Chang"
},
{
- "y" : 2,
+ "drilldown" : "Jan Krnavek",
"name" : "Jan Krnavek",
- "drilldown" : "Jan Krnavek"
+ "y" : 2
},
{
"drilldown" : "Kjetil Skotheim",
- "name" : "Kjetil Skotheim",
- "y" : 2
+ "y" : 2,
+ "name" : "Kjetil Skotheim"
},
{
"drilldown" : "Laurent Rosenfeld",
- "name" : "Laurent Rosenfeld",
- "y" : 3
+ "y" : 3,
+ "name" : "Laurent Rosenfeld"
},
{
- "drilldown" : "Mariano Ortega",
"name" : "Mariano Ortega",
- "y" : 2
+ "y" : 2,
+ "drilldown" : "Mariano Ortega"
},
{
- "y" : 2,
"name" : "Mark Anderson",
+ "y" : 2,
"drilldown" : "Mark Anderson"
},
{
"y" : 5,
- "drilldown" : "Packy Anderson",
- "name" : "Packy Anderson"
+ "name" : "Packy Anderson",
+ "drilldown" : "Packy Anderson"
},
{
- "y" : 4,
+ "drilldown" : "Thomas Kohler",
"name" : "Thomas Kohler",
- "drilldown" : "Thomas Kohler"
+ "y" : 4
},
{
- "y" : 3,
"name" : "W. Luis Mochan",
+ "y" : 3,
"drilldown" : "W. Luis Mochan"
+ },
+ {
+ "y" : 2,
+ "name" : "Wanderdoc",
+ "drilldown" : "Wanderdoc"
}
- ]
+ ],
+ "colorByPoint" : 1
}
],
- "plotOptions" : {
- "series" : {
- "borderWidth" : 0,
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- }
- }
+ "title" : {
+ "text" : "The Weekly Challenge - 281"
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "subtitle" : {
+ "text" : "[Champions: 14] Last updated at 2024-08-06 09:19:35 GMT"
+ },
+ "legend" : {
+ "enabled" : 0
}
}
diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json
index d68e38e212..2abc62254c 100644
--- a/stats/pwc-language-breakdown-2019.json
+++ b/stats/pwc-language-breakdown-2019.json
@@ -1,10 +1,26 @@
{
- "legend" : {
- "enabled" : "false"
+ "chart" : {
+ "type" : "column"
+ },
+ "tooltip" : {
+ "headerFormat" : "<span style=\"font-size:11px\"></span>",
+ "pointFormat" : "<span style=\"color:{point.color}\">Challenge {point.name}</span>: <b>{point.y:f}</b><br/>",
+ "followPointer" : "true"
+ },
+ "plotOptions" : {
+ "series" : {
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ },
+ "borderWidth" : 0
+ }
},
"drilldown" : {
"series" : [
{
+ "id" : "001",
+ "name" : "001",
"data" : [
[
"Perl",
@@ -18,13 +34,11 @@
"Blog",
12
]
- ],
- "name" : "001",
- "id" : "001"
+ ]
},
{
- "name" : "002",
"id" : "002",
+ "name" : "002",
"data" : [
[
"Perl",
@@ -41,6 +55,8 @@
]
},
{
+ "name" : "003",
+ "id" : "003",
"data" : [
[
"Perl",
@@ -54,9 +70,7 @@
"Blog",
9
]
- ],
- "name" : "003",
- "id" : "003"
+ ]
},
{
"data" : [
@@ -73,8 +87,8 @@
10
]
],
- "name" : "004",
- "id" : "004"
+ "id" : "004",
+ "name" : "004"
},
{
"data" : [
@@ -109,12 +123,10 @@
7
]
],
- "id" : "006",
- "name" : "006"
+ "name" : "006",
+ "id" : "006"
},
{
- "id" : "007",
- "name" : "007",
"data" : [
[
"Perl",
@@ -128,7 +140,9 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "007",
+ "name" : "007"
},
{
"data" : [
@@ -145,8 +159,8 @@
12
]
],
- "id" : "008",
- "name" : "008"
+ "name" : "008",
+ "id" : "008"
},
{
"data" : [
@@ -163,12 +177,10 @@
13
]
],
- "name" : "009",
- "id" : "009"
+ "id" : "009",
+ "name" : "009"
},
{
- "id" : "010",
- "name" : "010",
"data" : [
[
"Perl",
@@ -182,9 +194,13 @@
"Blog",
11
]
- ]
+ ],
+ "name" : "010",
+ "id" : "010"
},
{
+ "id" : "011",
+ "name" : "011",
"data" : [
[
"Perl",
@@ -198,11 +214,11 @@
"Blog",
10
]
- ],
- "id" : "011",
- "name" : "011"
+ ]
},
{
+ "name" : "012",
+ "id" : "012",
"data" : [
[
"Perl",
@@ -216,11 +232,11 @@
"Blog",
11
]
- ],
- "id" : "012",
- "name" : "012"
+ ]
},
{
+ "name" : "013",
+ "id" : "013",
"data" : [
[
"Perl",
@@ -234,11 +250,11 @@
"Blog",
13
]
- ],
- "name" : "013",
- "id" : "013"
+ ]
},
{
+ "id" : "014",
+ "name" : "014",
"data" : [
[
"Perl",
@@ -252,11 +268,11 @@
"Blog",
15
]
- ],
- "name" : "014",
- "id" : "014"
+ ]
},
{
+ "id" : "015",
+ "name" : "015",
"data" : [
[
"Perl",
@@ -270,11 +286,11 @@
"Blog",
15
]
- ],
- "name" : "015",
- "id" : "015"
+ ]
},
{
+ "name" : "016",
+ "id" : "016",
"data" : [
[
"Perl",
@@ -288,11 +304,11 @@
"Blog",
13
]
- ],
- "id" : "016",
- "name" : "016"
+ ]
},
{
+ "name" : "017",
+ "id" : "017",
"data" : [
[
"Perl",
@@ -306,11 +322,11 @@
"Blog",
12
]
- ],
- "id" : "017",
- "name" : "017"
+ ]
},
{
+ "id" : "018",
+ "name" : "018",
"data" : [
[
"Perl",
@@ -324,9 +340,7 @@
"Blog",
14
]
- ],
- "name" : "018",
- "id" : "018"
+ ]
},
{
"data" : [
@@ -361,8 +375,8 @@
13
]
],
- "id" : "020",
- "name" : "020"
+ "name" : "020",
+ "id" : "020"
},
{
"id" : "021",
@@ -383,8 +397,6 @@
]
},
{
- "id" : "022",
- "name" : "022",
"data" : [
[
"Perl",
@@ -398,7 +410,9 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "022",
+ "id" : "022"
},
{
"data" : [
@@ -419,8 +433,8 @@
"id" : "023"
},
{
- "name" : "024",
"id" : "024",
+ "name" : "024",
"data" : [
[
"Perl",
@@ -437,8 +451,8 @@
]
},
{
- "id" : "025",
"name" : "025",
+ "id" : "025",
"data" : [
[
"Perl",
@@ -455,8 +469,6 @@
]
},
{
- "id" : "026",
- "name" : "026",
"data" : [
[
"Perl",
@@ -470,11 +482,13 @@
"Blog",
10
]
- ]
+ ],
+ "id" : "026",
+ "name" : "026"
},
{
- "id" : "027",
"name" : "027",
+ "id" : "027",
"data" : [
[
"Perl",
@@ -491,8 +505,8 @@
]
},
{
- "id" : "028",
"name" : "028",
+ "id" : "028",
"data" : [
[
"Perl",
@@ -559,12 +573,10 @@
9
]
],
- "name" : "031",
- "id" : "031"
+ "id" : "031",
+ "name" : "031"
},
{
- "name" : "032",
- "id" : "032",
"data" : [
[
"Perl",
@@ -578,11 +590,11 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "032",
+ "id" : "032"
},
{
- "name" : "033",
- "id" : "033",
"data" : [
[
"Perl",
@@ -596,9 +608,13 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "033",
+ "id" : "033"
},
{
+ "id" : "034",
+ "name" : "034",
"data" : [
[
"Perl",
@@ -612,9 +628,7 @@
"Blog",
11
]
- ],
- "name" : "034",
- "id" : "034"
+ ]
},
{
"data" : [
@@ -635,6 +649,8 @@
"id" : "035"
},
{
+ "name" : "036",
+ "id" : "036",
"data" : [
[
"Perl",
@@ -648,9 +664,7 @@
"Blog",
11
]
- ],
- "name" : "036",
- "id" : "036"
+ ]
},
{
"data" : [
@@ -671,8 +685,6 @@
"name" : "037"
},
{
- "name" : "038",
- "id" : "038",
"data" : [
[
"Perl",
@@ -686,7 +698,9 @@
"Blog",
12
]
- ]
+ ],
+ "id" : "038",
+ "name" : "038"
},
{
"data" : [
@@ -707,6 +721,8 @@
"name" : "039"
},
{
+ "name" : "040",
+ "id" : "040",
"data" : [
[
"Perl",
@@ -720,13 +736,9 @@
"Blog",
10
]
- ],
- "name" : "040",
- "id" : "040"
+ ]
},
{
- "name" : "041",
- "id" : "041",
"data" : [
[
"Perl",
@@ -740,7 +752,9 @@
"Blog",
9
]
- ]
+ ],
+ "name" : "041",
+ "id" : "041"
}
]
},
@@ -749,34 +763,29 @@
"text" : "Total Solutions"
}
},
- "chart" : {
- "type" : "column"
- },
- "title" : {
- "text" : "The Weekly Challenge Language"
- },
"series" : [
{
+ "name" : "The Weekly Challenge Languages",
"data" : [
{
- "name" : "001",
"drilldown" : "001",
+ "name" : "001",
"y" : 165
},
{
- "drilldown" : "002",
"name" : "002",
- "y" : 133
+ "y" : 133,
+ "drilldown" : "002"
},
{
- "drilldown" : "003",
+ "y" : 91,
"name" : "003",
- "y" : 91
+ "drilldown" : "003"
},
{
- "y" : 106,
"drilldown" : "004",
- "name" : "004"
+ "name" : "004",
+ "y" : 106
},
{
"y" : 82,
@@ -784,39 +793,39 @@
"drilldown" : "005"
},
{
- "name" : "006",
"drilldown" : "006",
- "y" : 63
+ "y" : 63,
+ "name" : "006"
},
{
- "drilldown" : "007",
+ "y" : 71,