aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--challenge-281/peter-meszaros/perl/ch-1.pl56
-rw-r--r--challenge-281/peter-meszaros/perl/ch-2.pl88
-rw-r--r--challenge-281/peter-meszaros/tcl/ch-1.tcl60
-rw-r--r--challenge-281/peter-meszaros/tcl/ch-2.tcl102
-rwxr-xr-xchallenge-281/ulrich-rieke/cpp/ch-1.cpp43
-rwxr-xr-xchallenge-281/ulrich-rieke/cpp/ch-2.cpp80
-rwxr-xr-xchallenge-281/ulrich-rieke/haskell/ch-1.hs25
-rwxr-xr-xchallenge-281/ulrich-rieke/haskell/ch-2.hs40
-rwxr-xr-xchallenge-281/ulrich-rieke/perl/ch-1.pl52
-rwxr-xr-xchallenge-281/ulrich-rieke/perl/ch-2.pl54
-rwxr-xr-xchallenge-281/ulrich-rieke/raku/ch-1.raku35
-rwxr-xr-xchallenge-281/ulrich-rieke/raku/ch-2.raku47
-rwxr-xr-xchallenge-281/ulrich-rieke/rust/ch-1.rs35
-rwxr-xr-xchallenge-281/ulrich-rieke/rust/ch-2.rs61
-rw-r--r--stats/pwc-current.json206
-rw-r--r--stats/pwc-language-breakdown-2019.json632
-rw-r--r--stats/pwc-language-breakdown-2020.json426
-rw-r--r--stats/pwc-language-breakdown-2021.json416
-rw-r--r--stats/pwc-language-breakdown-2022.json770
-rw-r--r--stats/pwc-language-breakdown-2023.json766
-rw-r--r--stats/pwc-language-breakdown-2024.json510
-rw-r--r--stats/pwc-language-breakdown-summary.json54
-rw-r--r--stats/pwc-leaders.json384
-rw-r--r--stats/pwc-summary-1-30.json106
-rw-r--r--stats/pwc-summary-121-150.json98
-rw-r--r--stats/pwc-summary-151-180.json104
-rw-r--r--stats/pwc-summary-181-210.json110
-rw-r--r--stats/pwc-summary-211-240.json106
-rw-r--r--stats/pwc-summary-241-270.json112
-rw-r--r--stats/pwc-summary-271-300.json104
-rw-r--r--stats/pwc-summary-301-330.json58
-rw-r--r--stats/pwc-summary-31-60.json100
-rw-r--r--stats/pwc-summary-61-90.json30
-rw-r--r--stats/pwc-summary-91-120.json46
-rw-r--r--stats/pwc-summary.json54
-rw-r--r--stats/pwc-yearly-language-summary.json114
36 files changed, 3448 insertions, 2636 deletions
diff --git a/challenge-281/peter-meszaros/perl/ch-1.pl b/challenge-281/peter-meszaros/perl/ch-1.pl
new file mode 100644
index 0000000000..8cbcddaa71
--- /dev/null
+++ b/challenge-281/peter-meszaros/perl/ch-1.pl
@@ -0,0 +1,56 @@
+#!/usr/bin/env perl
+#
+=head1 Task 1: Check Color
+Submitted by: Mohammad Sajid Anwar
+You are given coordinates, a string that represents the coordinates of a square
+of the chessboard as shown below:
+ +-+-+-+-+-+-+-+-+
+ 8 | |#| |#| |#| |#|
+ 7 |#| |#| |#| |#| |
+ 6 | |#| |#| |#| |#|
+ 5 |#| |#| |#| |#| |
+ 4 | |#| |#| |#| |#|
+ 3 |#| |#| |#| |#| |
+ 2 | |#| |#| |#| |#|
+ 1 |#| |#| |#| |#| |
+ +-+-+-+-+-+-+-+-+
+ a b c d e f g h
+Write a script to return true if the square is light, and false if the square
+is dark.
+=head2 Example 1
+ Input: $coordinates = "d3"
+ Output: true
+=head2 Example 2
+ Input: $coordinates = "g5"
+ Output: false
+=head2 Example 3
+ Input: $coordinates = "e6"
+ Output: true
+=cut
+
+use strict;
+use warnings;
+use Test2::V0 -no_srand => 1;
+use Data::Dumper;
+
+my $cases = [
+ ['d3', 1, 'Example 1'],
+ ['g5', 0, 'Example 2'],
+ ['e6', 1, 'Example 3'],
+];
+
+sub check_color
+{
+ my $pos = shift;
+
+ my ($x, $y) = split '', $pos;
+
+ return (ord($x) + $y) % 2;
+}
+
+for (@$cases) {
+ is(check_color($_->[0]), $_->[1], $_->[2]);
+}
+done_testing();
+
+exit 0;
diff --git a/challenge-281/peter-meszaros/perl/ch-2.pl b/challenge-281/peter-meszaros/perl/ch-2.pl
new file mode 100644
index 0000000000..b708fd4754
--- /dev/null
+++ b/challenge-281/peter-meszaros/perl/ch-2.pl
@@ -0,0 +1,88 @@
+#!/usr/bin/env perl
+#
+=head1 Task 2: Knight's Move
+Submitted by: Peter Campbell Smith
+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.
+ +--+--+--+--+--+--+--+--+
+ 8 |a8| | | | | | | |
+ 7 | | |E | |E | | | |
+ 6 | |E | | | |E | | |
+ 5 | | | |S | | | | |
+ 4 | |E | | | |E | | |
+ 3 | | |E | |E | | | |
+ 2 | | | | | | |g2| |
+ 1 | | | | | | | | |
+ +--+--+--+--+--+--+--+--+
+ a b c d e f g h
+=head2 Example 1
+ Input: $start = 'g2', $end = 'a8'
+ Ouput: 4
+ g2 -> e3 -> d5 -> c7 -> a8
+=head2 Example 2
+ Input: $start = 'g2', $end = 'h2'
+ Ouput: 3
+ g2 -> e3 -> f1 -> h2
+=cut
+
+use strict;
+use warnings;
+use Test2::V0 -no_srand => 1;
+use Data::Dumper;
+
+my $cases = [
+ [['g2', 'a8'], 4, 'Example 1'],
+ [['g2', 'h2'], 3, 'Example 2'],
+];
+
+sub knights_move
+{
+ my $s = $_[0]->[0];
+ my $e = $_[0]->[1];
+
+ my @s = split '', $s;
+ my @e = split '', $e;
+
+ $s[0] = ord($s[0]) - ord('a');
+ $e[0] = ord($e[0]) - ord('a');
+ $s[1]--;
+ $e[1]--;
+
+ my $dx = [2, 2, -2, -2, 1, 1, -1, -1];
+ my $dy = [1, -1, 1, -1, 2, -2, 2, -2];
+
+ my @queue = [$s[0], $s[1], 0];
+ my $visited->[$s[0]]->[$s[1]] = 1;
+
+ while (@queue) {
+ my $p = shift @queue;
+ my $x = $p->[0];
+ my $y = $p->[1];
+ my $v = $p->[2];
+ if ($x == $e[0] && $y == $e[1]) {
+ return $v;
+ }
+ for my $i (0 .. 7) {
+ my $new_x = $p->[0] + $dx->[$i];
+ my $new_y = $p->[1] + $dy->[$i];
+ my $val = $v + 1;
+ if ($new_x >= 0 && $new_x <= 7 &&
+ $new_y >= 0 && $new_y <= 7 &&
+ not $visited->[$new_x]->[$new_y]) {
+ $visited->[$new_x]->[$new_y] = 1;
+ push @queue, [$new_x, $new_y, $val];
+ }
+ }
+ }
+ return undef;
+}
+
+for (@$cases) {
+ is(knights_move($_->[0]), $_->[1], $_->[2]);
+}
+done_testing();
+
+exit 0;
diff --git a/challenge-281/peter-meszaros/tcl/ch-1.tcl b/challenge-281/peter-meszaros/tcl/ch-1.tcl
new file mode 100644
index 0000000000..29f6ff02ea
--- /dev/null
+++ b/challenge-281/peter-meszaros/tcl/ch-1.tcl
@@ -0,0 +1,60 @@
+#!/usr/bin/env tclsh
+#
+# Task 1: Check Color
+#
+# Submitted by: Mohammad Sajid Anwar
+#
+# You are given coordinates, a string that represents the coordinates of a square
+# of the chessboard as shown below:
+#
+# +-+-+-+-+-+-+-+-+
+# 8 | |#| |#| |#| |#|
+# 7 |#| |#| |#| |#| |
+# 6 | |#| |#| |#| |#|
+# 5 |#| |#| |#| |#| |
+# 4 | |#| |#| |#| |#|
+# 3 |#| |#| |#| |#| |
+# 2 | |#| |#| |#| |#|
+# 1 |#| |#| |#| |#| |
+# +-+-+-+-+-+-+-+-+
+# a b c d e f g h
+#
+# Write a script to return true if the square is light, and false if the square
+# is dark.
+#
+# Example 1
+#
+# Input: $coordinates = "d3"
+# Output: true
+#
+# Example 2
+#
+# Input: $coordinates = "g5"
+# Output: false
+#
+# Example 3
+#
+# Input: $coordinates = "e6"
+# Output: true
+
+package require tcltest
+
+set cases {
+ {d3 1 "Example 1"}
+ {g5 0 "Example 2"}
+ {e6 1 "Example 3"}
+}
+
+proc check_color {pos} {
+ set l [split $pos {}]
+ return [expr ([scan [lindex $l 0] %c] + [lindex $l 1]) % 2]
+}
+
+tcltest::configure -verbose {pass}
+foreach case $cases {
+ tcltest::test [lindex $case 2] {} {
+ check_color [lindex $case 0]
+ } [lindex $case 1]
+}
+
+exit 0
diff --git a/challenge-281/peter-meszaros/tcl/ch-2.tcl b/challenge-281/peter-meszaros/tcl/ch-2.tcl
new file mode 100644
index 0000000000..68f368cf9c
--- /dev/null
+++ b/challenge-281/peter-meszaros/tcl/ch-2.tcl
@@ -0,0 +1,102 @@
+#!/usr/bin/env tclsh
+#
+# Task 2: Knight's Move
+#
+# Submitted by: Peter Campbell Smith
+#
+# 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.
+#
+# +--+--+--+--+--+--+--+--+
+# 8 |a8| | | | | | | |
+# 7 | | |E | |E | | | |
+# 6 | |E | | | |E | | |
+# 5 | | | |S | | | | |
+# 4 | |E | | | |E | | |
+# 3 | | |E | |E | | | |
+# 2 | | | | | | |g2| |
+# 1 | | | | | | | | |
+# +--+--+--+--+--+--+--+--+
+# a b c d e f g h
+#
+# 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
+#
+
+package require tcltest
+package require struct::queue
+package require struct::matrix
+
+set cases {
+ {{g2 a8} 4 "Example 1"}
+ {{g2 h2} 3 "Example 2"}
+}
+
+proc knights_move {params} {
+
+ set s [split [lindex $params 0] {}]
+ set e [split [lindex $params 1] {}]
+ set sx [expr [scan [lindex $s 0] %c] - [scan "a" %c]]
+ set ex [expr [scan [lindex $e 0] %c] - [scan "a" %c]]
+ set sy [expr [lindex $s 1] - 1]
+ set ey [expr [lindex $e 1] - 1]
+ set dx {2 2 -2 -2 1 1 -1 -1}
+ set dy {1 -1 1 -1 2 -2 2 -2}
+
+ set queue [::struct::queue]
+ $queue put [list $sx $sy 0]
+
+ set visited [::struct::matrix]
+ $visited add rows 8
+ $visited add columns 8
+
+ while {[$queue size]} {
+ set p [$queue get]
+ set x [lindex $p 0]
+ set y [lindex $p 1]
+ set v [lindex $p 2]
+ if {$x == $ex && $y == $ey} {
+ $queue destroy
+ $visited destroy
+ return $v
+ }
+ for {set i 0} {$i < 8} {incr i} {
+ set new_x [expr $x + [lindex $dx $i]]
+ set new_y [expr $y + [lindex $dy $i]]
+ set val [expr $v + 1]
+ if {$new_x >= 0 && $new_x <= 7 &&
+ $new_y >= 0 && $new_y <= 7 &&
+ [$visited get cell $new_x $new_y] != 1} {
+ $visited set cell $new_x $new_y 1
+ $queue put [list $new_x $new_y $val]
+ }
+ }
+ }
+ $queue destroy
+ $visited destroy
+ return null
+}
+
+tcltest::configure -verbose {pass}
+foreach case $cases {
+ tcltest::test [lindex $case 2] {} {
+ knights_move [lindex $case 0]
+ } [lindex $case 1]
+}
+
+exit 0
diff --git a/challenge-281/ulrich-rieke/cpp/ch-1.cpp b/challenge-281/ulrich-rieke/cpp/ch-1.cpp
new file mode 100755
index 0000000000..756a211ba5
--- /dev/null
+++ b/challenge-281/ulrich-rieke/cpp/ch-1.cpp
@@ -0,0 +1,43 @@
+#include <iostream>
+#include <string>
+#include <vector>
+
+using namespace std::string_literals ;
+
+std::vector<std::string> createLine( const std::string & start ) {
+ std::vector<std::string> line ;
+ for ( int i = 0 ; i < 8 ; i++ ) {
+ if ( i % 2 == 0 )
+ line.push_back( start ) ;
+ else {
+ if ( start == "light"s )
+ line.push_back( "dark"s ) ;
+ else
+ line.push_back( "light"s ) ;
+ }
+ }
+ return line ;
+}
+
+int main( ) {
+ std::cout << "Enter the coordinates of a field on a chess board!\n" ;
+ std::string field ;
+ std::cin >> field ;
+ std::string cols {"abcdefgh"} ;
+ std::string col { field.substr( 0 , 1 ) } ;
+ int colpos = cols.find( col ) ;
+ int row { std::stoi( field.substr( 1 , 1 ) ) } ;
+ std::vector<std::string> baseline { createLine( "dark"s ) } ;
+ bool result = false ;
+ if ( row == 1 ) {
+ result = (baseline[colpos] == "light"s) ;
+ std::cout << std::boolalpha << result << '\n' ;
+ }
+ else {
+ std::string foot { baseline[ colpos ] } ;
+ std::vector<std::string> col_line { createLine( foot ) } ;
+ result = (col_line[ row - 1 ] == "light"s) ;
+ std::cout << std::boolalpha << result << '\n' ;
+ }
+ return 0 ;
+}
diff --git a/challenge-281/ulrich-rieke/cpp/ch-2.cpp b/challenge-281/ulrich-rieke/cpp/ch-2.cpp
new file mode 100755
index 0000000000..2af80967d2
--- /dev/null
+++ b/challenge-281/ulrich-rieke/cpp/ch-2.cpp
@@ -0,0 +1,80 @@
+#include <iostream>
+#include <vector>
+#include <string>
+#include <map>
+#include <sstream>
+#include <cstdlib>
+#include <algorithm>
+
+std::vector<std::string> split( const std::string & text , char delimiter ) {
+ std::istringstream istr { text } ;
+ std::string word ;
+ std::vector<std::string> words ;
+ while ( std::getline( istr , word , delimiter ) ) {
+ words.push_back( word ) ;
+ }
+ return words ;
+}
+
+//create all fields of a chess board
+std::vector<std::string> findAllFields( ) {
+ std::string cols {"abcdefgh"} ;
+ std::string rows {"12345678"} ;
+ std::vector<std::string> board ;
+ for ( int i = 0 ; i < cols.length( ) ; i++ ) {
+ for ( int j = 0 ; j < rows.length( ) ; j++ ) {
+ std::string field { cols.substr( i , 1 ).append( rows.substr( j , 1 ) ) } ;
+ board.push_back( field ) ;
+ }
+ }
+ return board ;
+}
+
+//all suitable fields on a chessboard are those that differ from the given field
+// by an absolute difference of 2 in rows and of 1 in columns or vice versa
+std::vector<std::string> findTargets( const std::string & field , const
+ std::vector<std::string> & board ) {
+ std::vector<std::string> selected ;
+ static const std::string columns {"abcdefgh"} ;
+ static const std::string rows {"12345678"} ;
+ auto selector = [field]( const auto & f ) {
+ auto colfound = columns.find_first_of( field.substr( 0 , 1 ) ) ;
+ auto rowfound = rows.find_first_of( field.substr( 1 , 1 ) ) ;
+ auto fieldcol = columns.find_first_of( f.substr( 0 , 1 ) ) ;
+ auto fieldrow = rows.find_first_of( f.substr( 1 , 1 ) ) ;
+ auto coldiff = abs( colfound - fieldcol ) ;
+ auto rowdiff = abs( rowfound - fieldrow ) ;
+ return ( (coldiff == 1) && (rowdiff == 2)) || ( (coldiff == 2) &&
+ (rowdiff == 1 )) ;
+ } ;
+ std::copy_if( board.begin( ) , board.end( ) , std::back_inserter( selected ) ,
+ selector ) ;
+ return selected ;
+}
+
+int main( ) {
+ std::cout << "Enter a source and a target field!\n" ;
+ std::string line ;
+ std::getline( std::cin, line ) ;
+ std::vector<std::string> fields { split( line , ' ' ) } ;
+ std::vector<std::string> chessboard { findAllFields( ) } ;
+ std::string sourceField { fields[ 0 ] } ;
+ std::string targetField { fields[ 1 ] } ;
+ std::vector<std::string> targets = findTargets( sourceField , chessboard ) ;
+ int count = 1 ;
+ while ( std::find( targets.begin( ) , targets.end( ) , targetField ) ==
+ targets.end( ) ) {
+ count++ ;
+ std::vector<std::string> newTargets , elementTargets ;
+ for ( auto it = targets.begin( ) ; it != targets.end( ) ; it++ ) {
+ elementTargets = findTargets( *it , chessboard ) ;
+ for ( auto f : elementTargets )
+ newTargets.push_back( f ) ;
+ elementTargets.clear( ) ;
+ }
+ for ( auto f : newTargets )
+ targets.push_back( f ) ;
+ }
+ std::cout << count << '\n' ;
+ return 0 ;
+}
diff --git a/challenge-281/ulrich-rieke/haskell/ch-1.hs b/challenge-281/ulrich-rieke/haskell/ch-1.hs
new file mode 100755
index 0000000000..ed267a395d
--- /dev/null
+++ b/challenge-281/ulrich-rieke/haskell/ch-1.hs
@@ -0,0 +1,25 @@
+module Challenge281
+ where
+import Data.List ( findIndices , ( !! ))
+import Data.Char ( digitToInt )
+
+createLine :: String -> [String]
+createLine base = if base == "light" then take 8 $ cycle ["light" , "dark"]
+ else take 8 $ cycle ["dark" , "light"]
+
+solution :: String -> Bool
+solution field =
+ let baseline = createLine "dark"
+ columns = "abcdefgh"
+ row = digitToInt $ last field
+ col = head field
+ colindex = head $ findIndices ( == col ) columns
+ in if row == 1 then (baseline !! colindex) == "light" else ( createLine
+ ( baseline !! colindex ) !! ( row - 1 ) ) == "light"
+
+
+main :: IO ( )
+main = do
+ putStrLn "Enter the coordinates of a chess field!"
+ field <- getLine
+ print $ solution field
diff --git a/challenge-281/ulrich-rieke/haskell/ch-2.hs b/challenge-281/ulrich-rieke/haskell/ch-2.hs
new file mode 100755
index 0000000000..85b360b52d
--- /dev/null
+++ b/challenge-281/ulrich-rieke/haskell/ch-2.hs
@@ -0,0 +1,40 @@
+module Challenge281_2
+ where
+import Control.Applicative
+import Data.Char ( digitToInt )
+import Data.Maybe ( fromJust )
+
+chessboard :: [(Char , Int)]
+chessboard = (,) <$> ['a'..'h'] <*> [1..8]
+
+convert :: String -> (Char , Int)
+convert field = ( head field , digitToInt $ last field )
+
+findSuitableTargets :: String -> [(Char , Int)]
+findSuitableTargets field =
+ let converted = convert field
+ indexedCols = zip ['a'..'h'] [1 , 2 ..]
+ fieldCol = fromJust $ lookup ( fst converted ) indexedCols
+ fieldRow = snd converted
+ in filter (\p -> ((abs ( (fromJust $ lookup ( fst p ) indexedCols) - fieldCol ) == 2 )
+ && ( abs ( fieldRow - snd p ) == 1 )) || (( abs ( (fromJust $ lookup ( fst p )
+ indexedCols) - fieldCol ) == 1 ) && ( abs ( fieldRow - snd p ) == 2 ))) chessboard
+
+solution :: String -> String -> Int
+solution from to = fst $ until (\p -> elem target ( snd p )) step (1 , findSuitableTargets
+ from )
+ where
+ target :: (Char , Int)
+ target = convert to
+ toString :: (Char , Int) -> String
+ toString ( c , num ) = [c] ++ show num
+ step :: (Int , [(Char , Int)]) -> (Int , [(Char , Int)] )
+ step ( count , associations ) = ( count + 1 , concat $ map (\p -> findSuitableTargets
+ ( toString p ) ) associations )
+
+main :: IO ( )
+main = do
+ putStrLn "Enter a source and a target chess field, separated by blanks!"
+ line <- getLine
+ let [from , to] = words line
+ print $ solution from to
diff --git a/challenge-281/ulrich-rieke/perl/ch-1.pl b/challenge-281/ulrich-rieke/perl/ch-1.pl
new file mode 100755
index 0000000000..3ecc24160f
--- /dev/null
+++ b/challenge-281/ulrich-rieke/perl/ch-1.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+
+sub createLine {
+ my $start = shift ;
+ my @line ;
+ for my $pos ( 0..7) {
+ if ( $pos % 2 == 0 ) {
+ push( @line, $start ) ;
+ }
+ else {
+ if ( $start eq "light" ) {
+ push( @line, "dark" ) ;
+ }
+ else {
+ push( @line , "light" ) ;
+ }
+ }
+ }
+ return @line ;
+}
+
+say "Enter a field on a chessboard!" ;
+my $field = <STDIN> ;
+chomp $field ;
+my $col = substr( $field, 0 , 1 ) ;
+my $row = substr( $field , 1 , 1 ) ;
+my $cols = "abcdefgh" ;
+my @baseline = createLine( "dark" ) ;
+my $result ;
+if ( $row == 1 ) {
+ if ( $baseline[ index( $cols , $col ) ] eq "light" ) {
+ $result = "true" ;
+ }
+ else {
+ $result = "false" ;
+ }
+}
+else {
+ my $foot = $baseline[ index( $cols , $col ) ] ;
+ my @col_line = createLine( $foot ) ;
+ if ( $col_line[ $row - 1 ] eq "light" ) {
+ $result = "true" ;
+ }
+ else {
+ $result = "false" ;
+ }
+}
+say $result ;
+
diff --git a/challenge-281/ulrich-rieke/perl/ch-2.pl b/challenge-281/ulrich-rieke/perl/ch-2.pl
new file mode 100755
index 0000000000..29210ed3d1
--- /dev/null
+++ b/challenge-281/ulrich-rieke/perl/ch-2.pl
@@ -0,0 +1,54 @@
+#!/usr/bin/perl ;
+use strict ;
+use warnings ;
+use feature 'say' ;
+
+#find the target fields of the given knight field! Keep doing so for every target
+#field until the target field we look for is in the array!
+
+#find possible target fields out of all chess fields possible!
+sub findTargetFields {
+ my $field = shift ;
+ my $chessfields = shift ;
+ my $cols = "abcdefgh" ;
+ my $rows = "12345678" ;
+ my @targetFields = grep { (abs( index( $cols , substr( $field , 0 , 1 )) -
+ index( $cols , substr( $_ , 0 , 1 ) ) ) == 1 && ( abs( index( $rows ,
+ substr( $field , 1 , 1 ) ) - index( $rows , substr( $_ , 1 , 1 ) ))
+ == 2 )) || ( abs( index( $cols , substr( $field , 0 , 1 ) ) - index( $cols ,
+ substr($_ , 0 , 1 ))) == 2 && ( abs( index( $rows , substr(
+ $field , 1 , 1 ) ) - index( $rows , substr( $_ , 1 , 1 ) ))
+ == 1 )) } @$chessfields ;
+ return @targetFields ;
+}
+
+say "Enter a start and a target field of a knight!" ;
+my $line = <STDIN> ;
+chomp $line ;
+(my $start , my $target ) = split( /\s+/ , $line ) ;
+#create all possible chess fields ;
+my $cols = "abcdefgh" ;
+my $rows = "12345678" ;
+my @chessfields ;
+for my $col( split( // , $cols ) ) {
+ for my $row ( split( // , $rows ) ) {
+ push( @chessfields , $col . $row ) ;
+ }
+}
+my %targetsFound ;
+my $count = 1 ;
+my @targetFields = findTargetFields( $start , \@chessfields ) ;
+map { $targetsFound{$_}++ } @targetFields ;
+while ( not ( exists( $targetsFound{ $target } ) ) ) {
+ $count++ ;
+ my @newTargets ;
+ for my $field ( keys %targetsFound ) {
+ my @currentTargets = findTargetFields( $field , \@chessfields ) ;
+ for my $el ( @currentTargets ) {
+ push( @newTargets , $el ) ;
+ }
+ }
+ map { $targetsFound{ $_}++ } @newTargets ;
+ @newTargets = ( ) ;
+}
+say $count ;
diff --git a/challenge-281/ulrich-rieke/raku/ch-1.raku b/challenge-281/ulrich-rieke/raku/ch-1.raku
new file mode 100755
index 0000000000..f24c61aef5
--- /dev/null
+++ b/challenge-281/ulrich-rieke/raku/ch-1.raku
@@ -0,0 +1,35 @@
+use v6 ;
+
+sub createLine( $start ) {
+ my @line ;
+ for (0..7) -> $pos {
+ if ( $pos %% 2 ) {
+ @line.push( $start ) ;
+ }
+ else {
+ if ( $start eq "light" ) {
+ @line.push( "dark" ) ;
+ }
+ else {
+ @line.push( "light" ) ;
+ }
+ }
+ }
+ return @line ;
+}
+
+say "Enter the coordinates of a chess field!" ;
+my $field = $*IN.get ;
+my $cols = "abcdefgh" ;
+my $col = $field.substr( 0 , 1 ) ;
+my $row = $field.substr( 1 , 1 ).map( {.Int} ) ;
+my @baseline = createLine( "dark" ) ;
+my $result ;
+if ( $row == 1 ) {
+ $result = @baseline[ $cols.index( $col ) ] eq "light" ;
+}
+else {
+ my @col_line = createLine( @baseline[ $cols.index( $col )] ) ;
+ $result = @col_line[ $row - 1 ] eq "light" ;
+}
+say $result ;
diff --git a/challenge-281/ulrich-rieke/raku/ch-2.raku b/challenge-281/ulrich-rieke/raku/ch-2.raku
new file mode 100755
index 0000000000..0e3e46e3cf
--- /dev/null
+++ b/challenge-281/ulrich-rieke/raku/ch-2.raku
@@ -0,0 +1,47 @@
+use v6 ;
+
+#the basic idea is : find all possible target fields for a given source field!
+#then, for every target field found , again create all new target fields until
+#the initial target field is in it
+
+sub findTargets( @allFields , $start ) {
+ my $cols = "abcdefgh" ;
+ my $rows = "12345678" ;
+ my @targets = @allFields.grep( { abs($cols.index( $start.substr( 0 , 1 )) -
+ $cols.index($_.substr( 0 , 1))) == 1 && abs( $rows.index( $start.substr(1 , 1 )) -
+ $rows.index( $_.substr( 1 , 1 ) )) == 2 || ( abs( $cols.index(
+ $start.substr( 0 , 1 )) - $cols.index( $_.substr( 0 , 1 ))) == 2 &&
+ (abs( $rows.index( $start.substr( 1 , 1 ) ) - $rows.index( $_.substr( 1 , 1 )))
+ == 1 ) ) } ) ;
+ return @targets ;
+}
+
+say "Enter a start and a target chess field!" ;
+my $line = $*IN.get ;
+(my $start , my $target ) = $line.words ;
+my $cols = "abcdefgh" ;
+my $rows = "12345678" ;
+my @chessFields ;
+for ($cols.comb) -> $column {
+ for ( $rows.comb) -> $row {
+ my $field = $column ~ $row ;
+ @chessFields.push( $field ) ;
+ }
+}
+my $count = 1 ;
+my @newTargets = findTargets( @chessFields , $start ) ;
+my $fieldSet = @newTargets.Set ;
+while ( not ( $target (elem) $fieldSet ) ) {
+ $count++ ;
+ my @nextTargets ;
+ for @newTargets -> $tar {
+ my @elementsTargets = findTargets( @chessFields , $tar ) ;
+ for (@elementsTargets) -> $el {
+ @nextTargets.push( $el ) ;
+ }
+ @elementsTargets = ( ) ;
+ }
+ @newTargets = @nextTargets ;
+ $fieldSet = @newTargets.Set ;
+}
+say $count ;
diff --git a/challenge-281/ulrich-rieke/rust/ch-1.rs b/challenge-281/ulrich-rieke/rust/ch-1.rs
new file mode 100755
index 0000000000..3f83868afd
--- /dev/null
+++ b/challenge-281/ulrich-rieke/rust/ch-1.rs
@@ -0,0 +1,35 @@
+use std::io ;
+
+fn main() {
+ println!("Enter a chess field!");
+ let mut inline : String = String::new( ) ;
+ io::stdin( ).read_line( &mut inline ).unwrap( ) ;
+ let entered_line : &str = inline.as_str( ).trim( ) ;
+ let cols : &str = "abcdefgh" ;
+ let col : char = entered_line.chars( ).nth( 0 ).unwrap( ) ;
+ let row : u32 = entered_line.chars( ).nth( 1 ).unwrap( ).to_digit( 10 ).unwrap( ) ;
+ let first_pair : Vec<&str> = vec!["light" , "dark"] ;
+ let second_pair : Vec<&str> = vec!["dark" , "light"] ;
+ let colnum = cols.find( col ).unwrap( ) ;
+ let mut baseline_colors : Vec<&str> = Vec::new( ) ;
+ let it = second_pair.iter( ).cycle( ).take( 8 ) ;
+ it.for_each( | f | baseline_colors.push( f ) ) ;
+ let result : bool ;
+ if row == 1 {
+ result = baseline_colors.iter( ).nth( colnum ).unwrap( ) == &"light" ;
+ }
+ else {
+ let base_color : &str = baseline_colors[colnum] ;
+ let mut col_sequence : Vec<&str> = Vec::new( ) ;
+ if base_color == "light" {
+ let sec_it = first_pair.iter( ).cycle( ).take( 8 ) ;
+ sec_it.for_each( | f | col_sequence.push( f ) ) ;
+ }
+ else {
+ let it = second_pair.iter( ).cycle( ).take( 8 ) ;
+ it.for_each( | f | col_sequence.push( f ) ) ;
+ }
+ result = col_sequence[ (row - 1) as usize] == "light" ;
+ }
+ println!("{}" , result) ;
+}
diff --git a/challenge-281/ulrich-rieke/rust/ch-2.rs b/challenge-281/ulrich-rieke/rust/ch-2.rs
new file mode 100755
index 0000000000..cdd6ec07c8
--- /dev/null
+++ b/challenge-281/ulrich-rieke/rust/ch-2.rs
@@ -0,0 +1,61 @@
+use std::io ;
+
+//find the target fields for a given start field
+fn find_target_fields( from : String , fields : &Vec<(char , char)> )
+ -> Vec<String> {
+ let field : &str = &from[..] ;
+ let chess_cols : &str = "abcdefgh" ;
+ let chess_rows : &str = "12345678" ;
+ let col : char = field.chars( ).nth( 0 ).unwrap( ) ;
+ let row : char = field.chars( ).nth( 1 ).unwrap( ) ;
+ let colpos = chess_cols.find( col ).unwrap( ) ;
+ let rowpos = chess_rows.find( row ).unwrap( ) ;
+ let mut target_fields : Vec<String> = Vec::new( ) ;
+ fields.into_iter( ).filter( | p | {
+ let pos1 = chess_cols.find( p.0 ).unwrap( ) ;
+ let pos2 = chess_rows.find( p.1).unwrap( ) ;
+ let coldiff : i8 = pos1 as i8 - colpos as i8 ;
+ let rowdiff : i8 = pos2 as i8 - rowpos as i8 ;
+ coldiff.abs( ) == 1 && rowdiff.abs(