diff options
| author | Mohammad Sajid Anwar <Mohammad.Anwar@yahoo.com> | 2024-08-10 19:07:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-10 19:07:22 +0100 |
| commit | 8a463a8abed64bd1c40f645f58e374c66bfc5648 (patch) | |
| tree | 442843b7b691b12bca6127853958e98bcb6a951d | |
| parent | 08256ebd262a73e6ca97a63889bf827b3d085b67 (diff) | |
| parent | 160fcbe6b60cfab3f473b461b0028b7be696ca20 (diff) | |
| download | perlweeklychallenge-club-8a463a8abed64bd1c40f645f58e374c66bfc5648.tar.gz perlweeklychallenge-club-8a463a8abed64bd1c40f645f58e374c66bfc5648.tar.bz2 perlweeklychallenge-club-8a463a8abed64bd1c40f645f58e374c66bfc5648.zip | |
Merge pull request #10571 from jo-37/contrib
distinguish walks from paths
| -rwxr-xr-x | challenge-281/jo-37/perl/ch-2.pl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/challenge-281/jo-37/perl/ch-2.pl b/challenge-281/jo-37/perl/ch-2.pl index 17ce3fed1e..2ab4600d02 100755 --- a/challenge-281/jo-37/perl/ch-2.pl +++ b/challenge-281/jo-37/perl/ch-2.pl @@ -75,18 +75,18 @@ sub knights_move { } sub diameter { - my $paths = zeroes adj(0); + my $walks = zeroes adj(0); for (0 .. N**2 - 1) { - $paths += adj($_); - return $_ if all $paths; + $walks += adj($_); + return $_ if all $walks; } 'inf'; } sub not_within ($n) { - my $paths = zeros adj(0); - $paths += adj($_) for 0 .. $n; - whichND !$paths->splitdim(1, N)->splitdim(0, N); + my $walks = zeros adj(0); + $walks += adj($_) for 0 .. $n; + whichND !$walks->splitdim(1, N)->splitdim(0, N); } sub analyze { |
