aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-281/reinier-maliepaard/blog.txt1
-rw-r--r--challenge-281/reinier-maliepaard/perl/ch-1.pl48
-rw-r--r--challenge-281/reinier-maliepaard/perl/ch-2.pl107
-rw-r--r--stats/pwc-current.json169
-rw-r--r--stats/pwc-language-breakdown-2019.json274
-rw-r--r--stats/pwc-language-breakdown-2020.json358
-rw-r--r--stats/pwc-language-breakdown-2021.json296
-rw-r--r--stats/pwc-language-breakdown-2022.json334
-rw-r--r--stats/pwc-language-breakdown-2023.json710
-rw-r--r--stats/pwc-language-breakdown-2024.json224
-rw-r--r--stats/pwc-language-breakdown-summary.json78
-rw-r--r--stats/pwc-leaders.json726
-rw-r--r--stats/pwc-summary-1-30.json40
-rw-r--r--stats/pwc-summary-121-150.json20
-rw-r--r--stats/pwc-summary-151-180.json110
-rw-r--r--stats/pwc-summary-181-210.json98
-rw-r--r--stats/pwc-summary-211-240.json102
-rw-r--r--stats/pwc-summary-241-270.json108
-rw-r--r--stats/pwc-summary-271-300.json110
-rw-r--r--stats/pwc-summary-301-330.json40
-rw-r--r--stats/pwc-summary-31-60.json116
-rw-r--r--stats/pwc-summary-61-90.json106
-rw-r--r--stats/pwc-summary-91-120.json48
-rw-r--r--stats/pwc-summary.json680
-rw-r--r--stats/pwc-yearly-language-summary.json92
25 files changed, 2585 insertions, 2410 deletions
diff --git a/challenge-281/reinier-maliepaard/blog.txt b/challenge-281/reinier-maliepaard/blog.txt
new file mode 100644
index 0000000000..cf1682dfed
--- /dev/null
+++ b/challenge-281/reinier-maliepaard/blog.txt
@@ -0,0 +1 @@
+https://reiniermaliepaard.nl/perl/pwc/index.php?id=pwc281
diff --git a/challenge-281/reinier-maliepaard/perl/ch-1.pl b/challenge-281/reinier-maliepaard/perl/ch-1.pl
new file mode 100644
index 0000000000..7aa97bc097
--- /dev/null
+++ b/challenge-281/reinier-maliepaard/perl/ch-1.pl
@@ -0,0 +1,48 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+=begin
+Light fields are created by combining the column letters b, d, f, h and
+the odd row numbers 1, 3, 5, 7, or the column letters a, c, e, g and
+the even row numbers 2, 4, 6, 8. When representing the letters by their
+numeric ASCII codes and adding these to the row numbers, the result is
+always an odd number. Example: b1 -> 98 + 1 = 99 -> odd -> light field
+=cut
+
+# Solution
+
+sub get_field_color {
+
+ # Split the field notation into column and row
+ my ($col, $row) = ($_[0] =~ /([a-h])([1-8])/);
+
+ # Ensure the input is valid
+ return("invalid field\n") unless (defined $col) && (defined $row);
+
+ # Convert column letter to the numeric ASCII value
+ # and add this number to the row number
+ ( ( ord($col) + $row ) % 2 != 0 ) ? return("true\n") # light
+ : return("false\n"); # dark
+}
+
+# Tests
+
+my $field;
+
+# Example 1
+$field = "d3";
+print(get_field_color($field)); # Output: true
+
+# Example 2
+$field = "g5";
+print(get_field_color($field)); # Output: false
+
+# Example 3
+$field = "e6";
+print(get_field_color($field)); # Output: true
+
+# Example 4
+$field = "z8";
+print(get_field_color($field)); # Output: invalid field
+
diff --git a/challenge-281/reinier-maliepaard/perl/ch-2.pl b/challenge-281/reinier-maliepaard/perl/ch-2.pl
new file mode 100644
index 0000000000..250e9b0d59
--- /dev/null
+++ b/challenge-281/reinier-maliepaard/perl/ch-2.pl
@@ -0,0 +1,107 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+=begin
+BFS (Breadth-First Search) seems to be the best solution for finding the
+shortest path for the knight's move problem on a chessboard.
+
+1. Shortest Path Guarantee: BFS explores all possible moves level by level
+(i.e., all positions reachable in one move, then all positions reachable
+in two moves, and so on).
+
+2. Simplicity: BFS is straightforward to implement and understand. It uses
+a queue to explore nodes in the correct order and ensures that each node
+is visited only once.
+=cut
+
+# Solution
+
+# Knight's possible moves
+my @moves = ([2, 1], [2, -1], [-2, 1], [-2, -1], [1, 2], [1, -2], [-1, 2], [-1, -2]);
+
+# Convert chess notation to coordinates
+sub notation_to_coords {
+ my ($col, $row) = ($_[0] =~ /([a-h])([1-8])/);
+
+ return (ord($col) - ord('a'), $row - 1);
+}
+
+# Check if a position is on the board
+sub is_on_board {
+ return $_[0] >= 0 && $_[0] < 8 && $_[1] >= 0 && $_[1] < 8;
+}
+
+# Find the shortest path using BFS
+sub knight_shortest_path {
+
+ my ($in_1, $in_2) = @_;
+
+ # $start and $end are references to arrays containing the x and y
+ # coordinates of the starting and ending positions.
+ my $start = [notation_to_coords($in_1)];
+ my $end = [notation_to_coords($in_2)];
+
+ # Initialize the queue with the start position and depth 0
+ my @queue = ([$start, 0]);
+
+ # Track visited positions using a hash
+ my %visited = ("$start->[0],$start->[1]" => 1);
+
+ # Continue while there are elements in the queue
+ while (@queue) {
+
+ # Dequeue the first element
+ my ($current, $depth) = @{shift @queue};
+
+ # Extract current x and y coordinates
+ my ($x, $y) = @$current;
+
+ # Return depth if end position is reached
+ return $depth if $x == $end->[0] && $y == $end->[1];
+
+ # Iterate over all possible knight moves
+ for my $move (@moves) {
+
+ # Calculate new position
+ my ($new_x, $new_y) = ($x + $move->[0], $y + $move->[1]);
+
+ # Check if the new position is on the board and not visited
+ if (is_on_board($new_x, $new_y) && !$visited{"$new_x,$new_y"}) {
+
+ # Enqueue the new position with incremented depth
+ push @queue, [[$new_x, $new_y], $depth + 1];
+
+ # Mark the new position as visited
+ $visited{"$new_x,$new_y"} = 1;
+ }
+ }
+ }
+ # -1 if no path is found (shouldn't happen on a standard chessboard)
+ return(-1);
+}
+
+# Tests
+
+my ($start, $end);
+
+# Example 1
+$start = "g2";
+$end = "a8";
+print( knight_shortest_path($start, $end), "\n") ; # Output: 4
+
+# Example 2
+$start = "g2";
+$end = "h2";
+print( knight_shortest_path($start, $end), "\n"); # Output: 3
+
+# Example 3
+$start = "d5";
+$end = "c7";
+print( knight_shortest_path($start, $end), "\n"); # Output: 1
+
+# Example 4
+$start = "e3";
+$end = "e1";
+print( knight_shortest_path($start, $end), "\n"); # Output: 2
+
diff --git a/stats/pwc-current.json b/stats/pwc-current.json
index 4ec65837b6..beba319a87 100644
--- a/stats/pwc-current.json
+++ b/stats/pwc-current.json
@@ -1,57 +1,63 @@
{
- "subtitle" : {
- "text" : "[Champions: 19] Last updated at 2024-08-07 15:53:15 GMT"
+ "plotOptions" : {
+ "series" : {
+ "borderWidth" : 0,
+ "dataLabels" : {
+ "format" : "{point.y}",
+ "enabled" : 1
+ }
+ }
+ },
+ "legend" : {
+ "enabled" : 0
},
"tooltip" : {
- "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>",
+ "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>",
"followPointer" : 1,
- "pointFormat" : "<span style='color:{point.color}'>{point.name}</span>: <b>{point.y:f}</b><br/>"
- },
- "chart" : {
- "type" : "column"
- },
- "xAxis" : {
- "type" : "category"
+ "headerFormat" : "<span style='font-size:11px'>{series.name}</span><br/>"
},
"yAxis" : {
"title" : {
"text" : "Total Solutions"
}
},
+ "chart" : {
+ "type" : "column"
+ },
"series" : [
{
"name" : "The Weekly Challenge - 281",
"colorByPoint" : 1,
"data" : [
{
+ "name" : "Alexander Karelas",
"drilldown" : "Alexander Karelas",
- "y" : 2,
- "name" : "Alexander Karelas"
+ "y" : 2
},
{
+ "name" : "Dave Jacoby",
"drilldown" : "Dave Jacoby",
- "y" : 3,
- "name" : "Dave Jacoby"
+ "y" : 3
},
{
+ "name" : "David Ferrone",
"drilldown" : "David Ferrone",
- "y" : 2,
- "name" : "David Ferrone"
+ "y" : 2
},
{
- "drilldown" : "E. Choroba",
"y" : 2,
+ "drilldown" : "E. Choroba",
"name" : "E. Choroba"
},
{
- "name" : "Feng Chang",
+ "drilldown" : "Feng Chang",
"y" : 2,
- "drilldown" : "Feng Chang"
+ "name" : "Feng Chang"
},
{
- "name" : "Jan Krnavek",
"drilldown" : "Jan Krnavek",
- "y" : 2
+ "y" : 2,
+ "name" : "Jan Krnavek"
},
{
"y" : 2,
@@ -59,8 +65,8 @@
"name" : "Kjetil Skotheim"
},
{
- "y" : 3,
"drilldown" : "Laurent Rosenfeld",
+ "y" : 3,
"name" : "Laurent Rosenfeld"
},
{
@@ -69,28 +75,33 @@
"name" : "Mariano Ortega"
},
{
- "name" : "Mark Anderson",
"drilldown" : "Mark Anderson",
- "y" : 2
+ "y" : 2,
+ "name" : "Mark Anderson"
},
{
+ "name" : "Packy Anderson",
"drilldown" : "Packy Anderson",
- "y" : 5,
- "name" : "Packy Anderson"
+ "y" : 5
},
{
+ "name" : "Peter Campbell Smith",
"drilldown" : "Peter Campbell Smith",
- "y" : 3,
- "name" : "Peter Campbell Smith"
+ "y" : 3
},
{
"name" : "Peter Meszaros",
- "y" : 2,
- "drilldown" : "Peter Meszaros"
+ "drilldown" : "Peter Meszaros",
+ "y" : 2
+ },
+ {
+ "name" : "Reinier Maliepaard",
+ "drilldown" : "Reinier Maliepaard",
+ "y" : 3
},
{
- "drilldown" : "Robbie Hatley",
"y" : 3,
+ "drilldown" : "Robbie Hatley",
"name" : "Robbie Hatley"
},
{
@@ -99,24 +110,24 @@
"name" : "Roger Bell_West"
},
{
- "y" : 4,
+ "name" : "Thomas Kohler",
"drilldown" : "Thomas Kohler",
- "name" : "Thomas Kohler"
+ "y" : 4
},
{
- "name" : "Ulrich Rieke",
"y" : 4,
- "drilldown" : "Ulrich Rieke"
+ "drilldown" : "Ulrich Rieke",
+ "name" : "Ulrich Rieke"
},
{
- "y" : 3,
"drilldown" : "W. Luis Mochan",
+ "y" : 3,
"name" : "W. Luis Mochan"
},
{
- "name" : "Wanderdoc",
"drilldown" : "Wanderdoc",
- "y" : 2
+ "y" : 2,
+ "name" : "Wanderdoc"
}
]
}
@@ -124,17 +135,11 @@
"title" : {
"text" : "The Weekly Challenge - 281"
},
- "legend" : {
- "enabled" : 0
+ "xAxis" : {
+ "type" : "category"
},
- "plotOptions" : {
- "series" : {
- "dataLabels" : {
- "format" : "{point.y}",
- "enabled" : 1
- },
- "borderWidth" : 0
- }
+ "subtitle" : {
+ "text" : "[Champions: 20] Last updated at 2024-08-08 08:45:06 GMT"
},
"drilldown" : {
"series" : [
@@ -150,6 +155,7 @@
},
{
"name" : "Dave Jacoby",
+ "id" : "Dave Jacoby",
"data" : [
[
"Perl",
@@ -159,28 +165,27 @@
"Blog",
1
]
- ],
- "id" : "Dave Jacoby"
+ ]
},
{
"name" : "David Ferrone",
+ "id" : "David Ferrone",
"data" : [
[
"Perl",
2
]
- ],
- "id" : "David Ferrone"
+ ]
},
{
+ "name" : "E. Choroba",
"data" : [
[
"Perl",
2
]
],
- "id" : "E. Choroba",
- "name" : "E. Choroba"
+ "id" : "E. Choroba"
},
{
"data" : [
@@ -203,17 +208,16 @@
"name" : "Jan Krnavek"
},
{
+ "name" : "Kjetil Skotheim",
"data" : [
[
"Perl",
2
]
],
- "id" : "Kjetil Skotheim",
- "name" : "Kjetil Skotheim"
+ "id" : "Kjetil Skotheim"
},
{
- "name" : "Laurent Rosenfeld",
"id" : "Laurent Rosenfeld",
"data" : [
[
@@ -228,7 +232,8 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "Laurent Rosenfeld"
},
{
"name" : "Mariano Ortega",
@@ -251,6 +256,7 @@
"name" : "Mark Anderson"
},
{
+ "name" : "Packy Anderson",
"data" : [
[
"Perl",
@@ -265,11 +271,9 @@
1
]
],
- "id" : "Packy Anderson",
- "name" : "Packy Anderson"
+ "id" : "Packy Anderson"
},
{
- "name" : "Peter Campbell Smith",
"id" : "Peter Campbell Smith",
"data" : [
[
@@ -280,21 +284,35 @@
"Blog",
1
]
- ]
+ ],
+ "name" : "Peter Campbell Smith"
},
{
+ "id" : "Peter Meszaros",
"data" : [
[
"Perl",
2
]
],
- "id" : "Peter Meszaros",
"name" : "Peter Meszaros"
},
{
+ "data" : [
+ [
+ "Perl",
+ 2
+ ],
+ [
+ "Blog",
+ 1
+ ]
+ ],
+ "id" : "Reinier Maliepaard",
+ "name" : "Reinier Maliepaard"
+ },
+ {
"name" : "Robbie Hatley",
- "id" : "Robbie Hatley",
"data" : [
[
"Perl",
@@ -304,9 +322,11 @@
"Blog",
1
]
- ]
+ ],
+ "id" : "Robbie Hatley"
},
{
+ "name" : "Roger Bell_West",
"id" : "Roger Bell_West",
"data" : [
[
@@ -317,10 +337,11 @@
"Raku",
2
]
- ],
- "name" : "Roger Bell_West"
+ ]
},
{
+ "name" : "Thomas Kohler",
+ "id" : "Thomas Kohler",
"data" : [
[
"Perl",
@@ -330,11 +351,10 @@
"Blog",
2
]
- ],
- "id" : "Thomas Kohler",
- "name" : "Thomas Kohler"
+ ]
},
{
+ "id" : "Ulrich Rieke",
"data" : [
[
"Perl",
@@ -345,11 +365,9 @@
2
]
],
- "id" : "Ulrich Rieke",
"name" : "Ulrich Rieke"
},
{
- "id" : "W. Luis Mochan",
"data" : [
[
"Perl",
@@ -360,17 +378,18 @@
1
]
],
+ "id" : "W. Luis Mochan",
"name" : "W. Luis Mochan"
},
{
- "name" : "Wanderdoc",
- "id" : "Wanderdoc",
"data" : [
[
"Perl",
2
]
- ]
+ ],
+ "id" : "Wanderdoc",
+ "name" : "Wanderdoc"
}
]
}
diff --git a/stats/pwc-language-breakdown-2019.json b/stats/pwc-language-breakdown-2019.json
index fc43ceb835..6e7c81dbfb 100644
--- a/stats/pwc-language-breakdown-2019.json
+++ b/stats/pwc-language-breakdown-2019.json
@@ -1,19 +1,4 @@
{
- "legend" : {
- "enabled" : "false"
- },
- "title" : {
- "text" : "The Weekly Challenge Language"
- },
- "plotOptions" : {
- "series" : {
- "borderWidth" : 0,
- "dataLabels" : {
- "enabled" : 1,
- "format" : "{point.y}"
- }
- }
- },
"drilldown" : {
"series" : [
{
@@ -35,6 +20,7 @@
"id" : "041"
},
{
+ "name" : "040",
"id" : "040",
"data" : [
[
@@ -49,11 +35,10 @@
"Blog",
10
]
- ],
- "name" : "040"
+ ]
},
{
- "name" : "039",
+ "id" : "039",
"data" : [
[
"Perl",
@@ -68,9 +53,11 @@
12
]
],
- "id" : "039"
+ "name" : "039"
},
{
+ "name" : "038",
+ "id" : "038",
"data" : [
[
"Perl",
@@ -84,9 +71,7 @@
"Blog",
12
]
- ],
- "id" : "038",
- "name" : "038"
+ ]
},
{
"data" : [
@@ -108,7 +93,6 @@
},
{
"name" : "036",
- "id" : "036",
"data" : [
[
"Perl",
@@ -122,7 +106,8 @@
"Blog",
11
]
- ]
+ ],
+ "id" : "036"
},
{
"id" : "035",
@@ -144,7 +129,6 @@
},
{
"name" : "034",
- "id" : "034",
"data" : [
[
"Perl",
@@ -158,10 +142,11 @@
"Blog",
11
]
- ]
+ ],
+ "id" : "034"
},
{
- "name" : "033",
+ "id" : "033",
"data" : [
[
"Perl",
@@ -176,7 +161,7 @@
10
]
],
- "id" : "033"
+ "name" : "033"
},
{
"name" : "032",
@@ -197,7 +182,7 @@
]
},
{
- "id" : "031",
+ "name" : "031",
"data" : [
[
"Perl",
@@ -212,10 +197,11 @@
9
]
],
- "name" : "031"
+ "id" : "031"
},
{
"name" : "030",
+ "id" : "030",
"data" : [
[
"Perl",
@@ -229,11 +215,10 @@
"Blog",
10
]
- ],
- "id" : "030"
+ ]
},
{
- "id" : "029",
+ "name" : "029",
"data" : [
[
"Perl",
@@ -248,10 +233,10 @@
12
]
],
- "name" : "029"
+ "id" : "029"
},
{
- "id" : "028",
+ "name" : "028",
"data" : [
[
"Perl",
@@ -266,11 +251,9 @@
9
]
],
- "name" : "028"
+ "id" : "028"
},
{
- "name" : "027",
- "id" : "027",
"data" : [
[
"Perl",
@@ -284,10 +267,11 @@
"Blog",
9
]
- ]
+ ],
+ "id" : "027",
+ "name" : "027"
},
{
- "name" : "026",
"data" : [
[
"Perl",
@@ -302,9 +286,12 @@
10
]
],
- "id" : "026"
+ "id" : "026",
+ "name" : "026"
},
{
+ "name" : "025",
+ "id" : "025",
"data" : [
[
"Perl",
@@ -318,9 +305,7 @@
"Blog",
12
]
- ],
- "id" : "025",
- "name" : "025"
+ ]
},
{
"data" : [
@@ -341,6 +326,7 @@
"name" : "024"
},
{
+ "id" : "023",
"data" : [
[
"Perl",
@@ -355,10 +341,10 @@
12
]
],
- "id" : "023",
"name" : "023"
},
{
+ "id" : "022",
"data" : [
[
"Perl",
@@ -373,7 +359,6 @@
10
]
],
- "id" : "022",
"name" : "022"
},
{
@@ -396,6 +381,7 @@
},
{
"name" : "020",
+ "id" : "020",
"data" : [
[
"Perl",
@@ -409,8 +395,7 @@
"Blog",
13
]
- ],
- "id" : "020"
+ ]
},
{
"data" : [
@@ -432,6 +417,7 @@
},
{
"name" : "018",
+ "id" : "018",
"data" : [
[
"Perl",
@@ -445,10 +431,11 @@
"Blog",
14
]
- ],
- "id" : "018"
+ ]
},
{
+ "name" : "017",
+ "id" : "017",
"data" : [
[
"Perl",
@@ -462,9 +449,7 @@
"Blog",
12
]
- ],
- "id" : "017",
- "name" : "017"
+ ]
},
{
"id" : "016",
@@ -485,6 +470,7 @@
"name" : "016"
},
{
+ "id" : "015",
"data" : [
[
"Perl",
@@ -499,12 +485,9 @@
15
]
],
- "id" : "015",
"name" : "015"
},
{
- "name" : "014",
- "id" : "014",
"data" : [
[
"Perl",
@@ -518,7 +501,9 @@
"Blog",
15
]
- ]
+ ],
+ "id" : "014",
+ "name" : "014"
},
{
"name" : "013",
@@ -539,6 +524,7 @@
]
},
{
+ "id" : "012",
"data" : [
[
"Perl",
@@ -553,11 +539,9 @@
11
]
],
- "id" : "012",
"name" : "012"
},
{
- "name" : "011",
"id" : "011",
"data" : [
[
@@ -572,7 +556,8 @@
"Blog",
10
]
- ]
+ ],
+ "name" : "011"
},
{
"name" : "010",
@@ -594,7 +579,6 @@
},
{
"name" : "009",
- "id" : "009",
"data" : [
[
"Perl",
@@ -608,7 +592,8 @@
"Blog",
13
]
- ]
+ ],
+ "id" : "009"
},
{
"name" : "008",
@@ -647,7 +632,7 @@
"id" : "007"
},
{
- "name" : "006",
+ "id" : "006",
"data" : [
[
"Perl",
@@ -662,10 +647,10 @@
7
]
],
- "id" : "006"
+ "name" : "006"
},
{
- "name" : "005",
+ "id" : "005",
"data" : [
[
"Perl",
@@ -680,7 +665,7 @@
12
]
],
- "id" : "005"
+ "name" : "005"
},
{
"id" : "004",
@@ -719,6 +704,7 @@
"name" : "003"
},
{
+ "name" : "002",
"id" : "002",
"data" : [
[
@@ -733,10 +719,10 @@
"Blog",
10
]
- ],
- "name" : "002"
+ ]
},
{
+ "name" : "001",
"data" : [
[
"Perl",
@@ -751,28 +737,36 @@
12
]
],
- "id" : "001",
- "name" : "001"
+ "id" : "001"
}
]
},
+ "subtitle" : {
+ "text" : "Click the columns to drilldown the language breakdown. Last updated at 2024-08-08 08:45:06 GMT"
+ },
+ "xAxis" : {
+ "type" : "category"
+ },
+ "title" : {
+ "text" : "The Weekly Challenge Language"
+ },
"series" : [
{
"data" : [
{
- "name" : "041",
"drilldown" : "041",
- "y" : 80
+ "y" : 80,
+ "name" : "041"
},
{
- "name" : "040",
+ "y" : 77,
"drilldown" : "040",
- "y" : 77
+ "name" : "040"
},
{
- "name" : "039",
+ "drilldown" : "039",
"y" : 68,
- "drilldown" : "039"
+ "name" : "039"
},
{
"name" : "038",
@@ -780,64 +774,