Log in to get your input and submit your answers.

Day 03: Crossing the Cluster

It is Monday morning, 8:59 AM. The rush was just announced and a horde of students in hoodies is stampeding down the stairs toward the cluster. The rule is simple: the first to arrive drapes their hoodie over an iMac, and the seat is reserved.

The Bocal has provided you with a map of the cluster as a grid. Each cell represents an iMac:

The map covers only a section of the cluster. But 42's cluster is legendary for its length: the pattern repeats infinitely to the right.

Part 1

You enter the cluster at the top-left corner. Exhausted and bleary-eyed, you walk in a straight line with a fixed trajectory: 3 steps right, 1 step down, at each step, until you reach the bottom row.

How many occupied iMacs do you encounter along your path?

Example

Here is a simplified cluster map:

..##.......
#...#...#..
.#....#..#.
..#.#...#.#
.#...##..#.
..#.##.....
.#.#.#....#
.#........#
#.##...#...
#...##....#
.#..#...#.#

Starting at the top-left corner (0, 0) and taking 3 steps right and 1 step down at each move:

O..##.......
#..O#...#..
.#....X..#.
..#.#...X.#
.#...##..X.
..#.##...X.
.#.#.#....X
.X........#
#.X#...#...
#...X#....#
.#..#...X.#

(O = open seat visited, X = occupied iMac encountered)

You encounter an occupied iMac 7 times.