Skip to content

Commit 142ab0e

Browse files
committed
Advent of Code 2021 - Day 6 - blog post
1 parent 6c4574f commit 142ab0e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ Last year I ran a [cruise log for my 25 days competing in the Advent of Code](ht
2222
- [The Advent of Code 2021 Day 2 log, sneaky release](https://www.codingnagger.com/2021/12/02/the-advent-of-code-2021-day-2-log-sneaky-release/)
2323
- [The Advent of Code 2021 Day 3 log, sleepy brain](https://www.codingnagger.com/2021/12/03/the-advent-of-code-2021-day-3-log-sleepy-brain/)
2424
- [The Advent of Code 2021 Day 4 log, playing myself](https://www.codingnagger.com/2021/12/04/the-advent-of-code-2021-day-4-log-playing-myself/)
25-
- [The Advent of Code 2021 Day 5 log, pointless points](https://www.codingnagger.com/2021/12/05/the-advent-of-code-2021-day-5-log-pointless-points/)
25+
- [The Advent of Code 2021 Day 5 log, pointless points](https://www.codingnagger.com/2021/12/05/the-advent-of-code-2021-day-5-log-pointless-points/)
26+
- [The Advent of Code 2021 Day 6 log, plenty of fish](https://www.codingnagger.com/2021/12/06/the-advent-of-code-2021-day-6-log-plenty-of-fish/)

src/main/java/com/codingnagger/days/Day6.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ public void run(int cycleCount) {
5353
public void tick() {
5454
BigInteger newBorns = fishes[0];
5555

56-
System.arraycopy(fishes, 1, fishes, 0, 8);
56+
for (int i = 1; i < 9; i++) {
57+
fishes[i-1] = fishes[i];
58+
}
5759

5860
fishes[6] = fishes[6].add(newBorns);
5961
fishes[8] = newBorns;

0 commit comments

Comments
 (0)