diff options
| author | Walt Mankowski <waltman@pobox.com> | 2020-08-26 20:54:30 -0400 |
|---|---|---|
| committer | Walt Mankowski <waltman@pobox.com> | 2020-08-26 20:54:30 -0400 |
| commit | 000fc96aced80bc918100ff92372400197e619da (patch) | |
| tree | d66a681eff1e07821628899c24c32b73c332f1fb | |
| parent | f09ff0b5b57f38aa13376ffd3cd5d642c8d75a3b (diff) | |
| download | perlweeklychallenge-club-000fc96aced80bc918100ff92372400197e619da.tar.gz perlweeklychallenge-club-000fc96aced80bc918100ff92372400197e619da.tar.bz2 perlweeklychallenge-club-000fc96aced80bc918100ff92372400197e619da.zip | |
changed j to i
This is because I thought I needed 2 loop variables but only ended up
needing the inner one.
| -rw-r--r-- | challenge-075/walt-mankowski/perl/ch-1.pl | 14 | ||||
| -rw-r--r-- | challenge-075/walt-mankowski/python/ch-1.py | 16 |
2 files changed, 15 insertions, 15 deletions
diff --git a/challenge-075/walt-mankowski/perl/ch-1.pl b/challenge-075/walt-mankowski/perl/ch-1.pl index 032d6d598b..5fda97155e 100644 --- a/challenge-075/walt-mankowski/perl/ch-1.pl +++ b/challenge-075/walt-mankowski/perl/ch-1.pl @@ -40,14 +40,14 @@ while (1) { # rotate "odometer" $cnt[-1] = 0; - my $j = -2; - $cnt[$j]++; - while ($j >= -@c && value(\@c, \@cnt) > $s) { - $cnt[$j] = 0; - $j--; - $cnt[$j]++ if $j >= -@c; + my $i = -2; + $cnt[$i]++; + while ($i >= -@c && value(\@c, \@cnt) > $s) { + $cnt[$i] = 0; + $i--; + $cnt[$i]++ if $i >= -@c; } - last if $j < -@c; + last if $i < -@c; } else { $cnt[-1]++; } diff --git a/challenge-075/walt-mankowski/python/ch-1.py b/challenge-075/walt-mankowski/python/ch-1.py index b070bcb102..83ed4c23f9 100644 --- a/challenge-075/walt-mankowski/python/ch-1.py +++ b/challenge-075/walt-mankowski/python/ch-1.py @@ -15,15 +15,15 @@ while (True): # rotate "odometer" cnt[-1] = 0 - j = -2 - cnt[j] += 1 - while j >= -len(cnt) and np.dot(c, cnt) > s: - cnt[j] = 0 - j -= 1 - if j >= -len(cnt): - cnt[j] += 1 + i = -2 + cnt[i] += 1 + while i >= -len(cnt) and np.dot(c, cnt) > s: + cnt[i] = 0 + i -= 1 + if i >= -len(cnt): + cnt[i] += 1 - if j < -len(cnt): + if i < -len(cnt): break else: cnt[-1] += 1 |
