diff options
| author | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2020-12-19 11:12:51 +0100 |
|---|---|---|
| committer | Jörg Sommrey <28217714+jo-37@users.noreply.github.com> | 2020-12-19 11:13:43 +0100 |
| commit | 1c56d627264052d3b3d3babbb9214822ad807f06 (patch) | |
| tree | 7323988dab4802a28bfdf813ec2b278a9914389a | |
| parent | 8503dc5936c2dbd8e990ac86030b1e34cfe51a5d (diff) | |
| download | perlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.tar.gz perlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.tar.bz2 perlweeklychallenge-club-1c56d627264052d3b3d3babbb9214822ad807f06.zip | |
Use appropriate type for piddle indices
| -rwxr-xr-x | challenge-089/jo-37/perl/ch-2.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/challenge-089/jo-37/perl/ch-2.pl b/challenge-089/jo-37/perl/ch-2.pl index b08d40b377..22bb8f7c83 100755 --- a/challenge-089/jo-37/perl/ch-2.pl +++ b/challenge-089/jo-37/perl/ch-2.pl @@ -11,11 +11,11 @@ sub siamese { my $n = shift; my $ord = 2 * $n + 1 ; my $msq = zeroes(long, $ord, $ord)->inplace->setvaltobad(0); - my $idx = long $n, 0; + my $idx = indx $n, 0; for my $val (1 .. $ord ** 2) { $msq->range($idx, 0, 'periodic') .= $val; say $msq if $::verbose; - $idx += $val % $ord ? long(1, -1) : long(0, 1); + $idx += $val % $ord ? indx(1, -1) : indx(0, 1); } # Return order, magic constant and magic square ($ord, ($ord**3 + $ord) / 2, $msq); |
