diff --git a/day-14/two.go b/day-14/two.go index 06d7d8b..f29da8d 100644 --- a/day-14/two.go +++ b/day-14/two.go @@ -32,8 +32,8 @@ func cycleMany(image img, iterations int) { copy(cachedImages[i+1], image.raw) } - period := i - start // length of a full period - copy(image.raw, cachedImages[start+((iterations-i-1)%period)]) // copy cachedImage into image.raw + period := i - start // length of a full period + copy(image.raw, cachedImages[start+((iterations-i-1)%period)+1]) // copy cachedImage into image.raw } // two returns the load of all boulders after 1000000000 cycles