diff options
| author | drbaggy <js5@sanger.ac.uk> | 2021-06-22 06:42:02 +0100 |
|---|---|---|
| committer | drbaggy <js5@sanger.ac.uk> | 2021-06-22 06:42:02 +0100 |
| commit | 78a1baea42565debab6719d9bcab545328668c4f (patch) | |
| tree | 4e543970fd9da8991708c7bb30a843cdc57ddac8 | |
| parent | 01c543fb07c20f14ee15a69c80b73f9a25e65358 (diff) | |
| download | perlweeklychallenge-club-78a1baea42565debab6719d9bcab545328668c4f.tar.gz perlweeklychallenge-club-78a1baea42565debab6719d9bcab545328668c4f.tar.bz2 perlweeklychallenge-club-78a1baea42565debab6719d9bcab545328668c4f.zip | |
Update README.md
| -rw-r--r-- | challenge-118/james-smith/README.md | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/challenge-118/james-smith/README.md b/challenge-118/james-smith/README.md index e9cdabb88b..18e4327d69 100644 --- a/challenge-118/james-smith/README.md +++ b/challenge-118/james-smith/README.md @@ -141,7 +141,11 @@ walk( 0, 7, 0, q() ); Write out best solution ```perl -say length $best_rt, q( - ), show_rt( $best_rt ); ## Show best route +say ''; +say "Treasures: @treasures"; +say '#Steps: ',-1 + length $best_rt; +say 'Route: ',show_rt( $best_rt ); +say ''; ``` ### The walk function @@ -204,9 +208,9 @@ nested `map`s. sub show_rt { my %t = map { $_ => 1 } @treasures; return join q( ), - map { ( exists $t{$_} ? q(*) : q( ) ) . $_ } - map { chr( 97 + ($_&7) ).( 1 + ($_>>3) ) } - map { ord $_ } + map { $_.( exists $t{$_} ? q(*) : q( ) ) } + map { chr( 97 + ($_&7) ).( 1 + ($_>>3) ) } + map { ord $_ } split m{}, shift; } ``` |
