Skip to content

Commit ccffaa8

Browse files
test(2018 day-12): Try 500 generations
1 parent faaebcb commit ccffaa8

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

2018/day-12/20-generations.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Generating 20 generations from the input looks like this:
2+
..#...#...##..####..##.####.#...#...#.#.#.#......##....#....######.####.##..#..#..##.##..##....#######.....................
3+
..##..##.#.#....##...##..#..##..##...#######....#.##...##..#..###.#..#.#.#.######..##.#...##..#..######....................
4+
.#.#...#.####..#.##.#.#.###..#...##.#..######....#.##.#.#.###..#..###.#####..####...#.##.#.#.###...#####...................
5+
..###...#..##.#.#.#.####.##.###.#.#.##...#####....#.#.####.##.###..#.#..###....###...#.#.####.###.#..####..................
6+
.#.###..##..#.######..#.#.##.#..####.##.#..####....###..#.#.##.##.#.###..###..#.###...###..#.#.#..##...###.................
7+
..#.##...#.#.#..####.#.###.#.##...#.#.#.##...###..#.##.#.###.##.#.##.##...##.#.#.###.#.##.#.#####..##.#.###................
8+
...#.##...#####...#..##.#..##.##...#####.##.#.##.#.#.#.##.#.#.#.##.##.##.#.#.####.#..##.#.##..###...#.##.###...............
9+
....#.##.#..####..##..#.##..##.##.#..##.#.#.##.#.######.#.######.##.##.#.####..#..##..#.##.#...###...#.##.###..............
10+
.....#.#.##...##...#.#.#.#...##.#.##..#.####.#.##..###..##..###.#.##.#.##..##.###..#.#.#.#.##.#.###...#.##.###.............
11+
......###.##.#.##...#######.#.#.##.#.#.#..#..##.#...##...#...#..##.#.##.#...##.##.#.#######.#.##.###...#.##.###............
12+
.....#.#.#.#.##.##.#..####..####.#.#########..#.##.#.##..##..##..#.##.#.##.#.##.#.##..####..##.##.###...#.##.###...........
13+
......#######.##.#.##...##....#..##..#######.#.#.#.##.#...#...#.#.#.#.##.#.##.#.##.#....##...##.##.###...#.##.###..........
14+
.....#..####.#.#.##.##.#.##...##..#....####..######.#.##..##...#######.#.##.#.##.#.##..#.##.#.##.##.###...#.##.###.........
15+
.....##...#..####.##.#.##.##.#.#.###..#..##....###..##.#...##.#..####..##.#.##.#.##.#.#.#.#.##.##.##.###...#.##.###........
16+
....#.##..##...#.#.#.##.##.#.####.##.###..##..#.##...#.##.#.#.##...##...#.##.#.##.#.########.##.##.##.###...#.##.###.......
17+
.....#.#...##...#####.##.#.##..#.#.##.##...#.#.#.##...#.#.####.##.#.##...#.#.##.#.##..#####.#.##.##.##.###...#.##.###......
18+
......###.#.##.#..##.#.#.##.#.#.###.##.##...#####.##...###..#.#.#.##.##...###.#.##.#....##..##.##.##.##.###...#.##.###.....
19+
.....#.#..##.#.##..#.####.#.####.#.#.##.##.#..##.#.##.#.##.#.#####.##.##.#.#..##.#.##..#.#...##.##.##.##.###...#.##.###....
20+
......###..#.##.#.#.#..#..##..#..####.##.#.##..#.##.#.##.#.##..##.#.##.#.####..#.##.#.#.###.#.##.##.##.##.###...#.##.###...
21+
.....#.##.#.#.#.#########..#.###...#.#.#.##.#.#.#.#.##.#.##.#...#.##.#.##..##.#.#.#.####.#..##.##.##.##.##.###...#.##.###..
22+
......#.#.######..#######.#.#.###...#####.#.########.#.##.#.##...#.#.##.#...#.######..#..##..##.##.##.##.##.###...#.##.###.
565 KB
Loading
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Generating 20 generations from the input looks like this:
2+
..#...#...##..####..##.####.#...#...#.#.#.#......##....#....######.####.##..#..#..##.##..##....#######.....................
3+
..##..##.#.#....##...##..#..##..##...#######....#.##...##..#..###.#..#.#.#.######..##.#...##..#..######....................
4+
.#.#...#.####..#.##.#.#.###..#...##.#..######....#.##.#.#.###..#..###.#####..####...#.##.#.#.###...#####...................
5+
..###...#..##.#.#.#.####.##.###.#.#.##...#####....#.#.####.##.###..#.#..###....###...#.#.####.###.#..####..................
6+
.#.###..##..#.######..#.#.##.#..####.##.#..####....###..#.#.##.##.#.###..###..#.###...###..#.#.#..##...###.................
7+
..#.##...#.#.#..####.#.###.#.##...#.#.#.##...###..#.##.#.###.##.#.##.##...##.#.#.###.#.##.#.#####..##.#.###................
8+
...#.##...#####...#..##.#..##.##...#####.##.#.##.#.#.#.##.#.#.#.##.##.##.#.#.####.#..##.#.##..###...#.##.###...............
9+
....#.##.#..####..##..#.##..##.##.#..##.#.#.##.#.######.#.######.##.##.#.####..#..##..#.##.#...###...#.##.###..............
10+
.....#.#.##...##...#.#.#.#...##.#.##..#.####.#.##..###..##..###.#.##.#.##..##.###..#.#.#.#.##.#.###...#.##.###.............
11+
......###.##.#.##...#######.#.#.##.#.#.#..#..##.#...##...#...#..##.#.##.#...##.##.#.#######.#.##.###...#.##.###............
12+
.....#.#.#.#.##.##.#..####..####.#.#########..#.##.#.##..##..##..#.##.#.##.#.##.#.##..####..##.##.###...#.##.###...........
13+
......#######.##.#.##...##....#..##..#######.#.#.#.##.#...#...#.#.#.#.##.#.##.#.##.#....##...##.##.###...#.##.###..........
14+
.....#..####.#.#.##.##.#.##...##..#....####..######.#.##..##...#######.#.##.#.##.#.##..#.##.#.##.##.###...#.##.###.........
15+
.....##...#..####.##.#.##.##.#.#.###..#..##....###..##.#...##.#..####..##.#.##.#.##.#.#.#.#.##.##.##.###...#.##.###........
16+
....#.##..##...#.#.#.##.##.#.####.##.###..##..#.##...#.##.#.#.##...##...#.##.#.##.#.########.##.##.##.###...#.##.###.......
17+
.....#.#...##...#####.##.#.##..#.#.##.##...#.#.#.##...#.#.####.##.#.##...#.#.##.#.##..#####.#.##.##.##.###...#.##.###......
18+
......###.#.##.#..##.#.#.##.#.#.###.##.##...#####.##...###..#.#.#.##.##...###.#.##.#....##..##.##.##.##.###...#.##.###.....
19+
.....#.#..##.#.##..#.####.#.####.#.#.##.##.#..##.#.##.#.##.#.#####.##.##.#.#..##.#.##..#.#...##.##.##.##.###...#.##.###....
20+
......###..#.##.#.#.#..#..##..#..####.##.#.##..#.##.#.##.#.##..##.#.##.#.####..#.##.#.#.###.#.##.##.##.##.###...#.##.###...
21+
.....#.##.#.#.#.#########..#.###...#.#.#.##.#.#.#.#.##.#.##.#...#.##.#.##..##.#.#.#.####.#..##.##.##.##.##.###...#.##.###..
22+
......#.#.######..#######.#.#.###...#####.#.########.#.##.#.##...#.#.##.#...#.######..#..##..##.##.##.##.##.###...#.##.###.

2018/day-12/solution.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,27 @@ const initialState = '#...#...##..####..##.####.#...#...#.#.#.#......##....#....
1010

1111
const init = (data) => {
1212
const rules = data
13-
const plantTracker = new Plants(initialState, rules)
13+
let plantTracker = new Plants(initialState, rules)
1414
const generations = 20
1515
for (let gen = 1; gen <= generations; gen++) {
1616
plantTracker.advance()
1717
}
1818
console.log(`Generating ${generations} generations from the input looks like this:`)
1919
plantTracker.display()
2020
const answer = plantTracker.getCheckSum(generations)
21+
22+
// Start for part 2
23+
const generations2 = 500
24+
for (let gen = generations + 1; gen <= generations2; gen++) {
25+
plantTracker.advance()
26+
}
27+
console.log(`Generating ${generations2} generations from the input looks like this:`)
28+
plantTracker.display()
29+
30+
// 500 generations takes about 30s, so running 50B generations isn't possible. It's
31+
// clear looking at the log there's a "Game of Life"-style glider.
32+
// See output/500-generations.txt and output/500-generations.png
33+
2134
const answer2 = ''
2235

2336
console.log(`-- Part 1 --`)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy