Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2023] [Day 21]: Step Counter #221

Open
victoraugustofd opened this issue Dec 30, 2024 · 1 comment
Open

[2023] [Day 21]: Step Counter #221

victoraugustofd opened this issue Dec 30, 2024 · 1 comment
Assignees
Labels
puzzle Advent of Code challenge
Milestone

Comments

@victoraugustofd
Copy link
Owner

Challenge description

You manage to catch the airship right as it's dropping someone else off on their all-expenses-paid trip to Desert Island! It even helpfully drops you off near the gardener and his massive farm.

"You got the sand flowing again! Great work! Now we just need to wait until we have enough sand to filter the water for Snow Island and we'll have snow again in no time."

While you wait, one of the Elves that works with the gardener heard how good you are at solving problems and would like your help. He needs to get his steps in for the day, and so he'd like to know which garden plots he can reach with exactly his remaining 64 steps.

He gives you an up-to-date map (your puzzle input) of his starting position (S), garden plots (.), and rocks (#). For example:

...........
.....###.#.
.###.##..#.
..#.#...#..
....#.#....
.##..S####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........

The Elf starts at the starting position (S) which also counts as a garden plot. Then, he can take one step north, south, east, or west, but only onto tiles that are garden plots. This would allow him to reach any of the tiles marked O:

...........
.....###.#.
.###.##..#.
..#.#...#..
....#O#....
.##.OS####.
.##..#...#.
.......##..
.##.#.####.
.##..##.##.
...........

Then, he takes a second step. Since at this point he could be at either tile marked O, his second step would allow him to reach any garden plot that is one step north, south, east, or west of any tile that he could have reached after the first step:

...........
.....###.#.
.###.##..#.
..#.#O..#..
....#.#....
.##O.O####.
.##.O#...#.
.......##..
.##.#.####.
.##..##.##.
...........

After two steps, he could be at any of the tiles marked O above, including the starting position (either by going north-then-south or by going west-then-east).

A single third step leads to even more possibilities:

...........
.....###.#.
.###.##..#.
..#.#.O.#..
...O#O#....
.##.OS####.
.##O.#...#.
....O..##..
.##.#.####.
.##..##.##.
...........

He will continue like this until his steps for the day have been exhausted. After a total of 6 steps, he could reach any of the garden plots marked O:

...........
.....###.#.
.###.##.O#.
.O#O#O.O#..
O.O.#.#.O..
.##O.O####.
.##.O#O..#.
.O.O.O.##..
.##.#.####.
.##O.##.##.
...........

In this example, if the Elf's goal was to get exactly 6 more steps today, he could use them to reach any of 16 garden plots.

However, the Elf actually needs to get 64 steps today, and the map he's handed you is much larger than the example map.

Starting from the garden plot marked S on your map, how many garden plots could the Elf reach in exactly 64 steps?

Challenge input

...................................................................................................................................
.#.........#......#................#...#.......#.....##............................##..#........#.#.#.#......#......#...#........#.
..............#..#.....#.....##....................#....................................#....##.#.......#.......#...#...........#..
.#..#..#.#...#.....#.......#......#..#..#.............#.#..................#.......#.............#..#.......#.......#..............
.....................#.............#............#.#................................#.......#........#...............#....#..#......
.....#...........#.......#..................................................#..............#.##.....#..............................
...#.........................##...#.#................#.....................................#.......#.#........#....#.......#....#..
.#....####..........#......................#........#..................................#...........#..#..#....#......#.............
...#.....................#........................#...............................#.......................#....#......#............
....#......#....#......#....#....##..........................#.....#................#.....#........#.....##........................
................#.#....#.#..#....................#..............#........................#...#.......#.#..........#.......#.#......
.........#.#.......#............#.............#...........................................#...#.....#.......................#......
.....#.................#.........#.#.....................#............#..........#.#.#......#...........#.#..............#...#.....
..............................#......#.......#..#..............#....................#...#.##..##..........#...............#...##...
.....#........#.#............#.......#.....###...........................#.....................#................................#..
..##..........#......#...#..............#.....#................#.........#.#...............#...............#.......................
............................#...#.#..................#....................#.......................#.......#........#..#....#....#..
...#............#..#......#...........#................#.....#............................##...##........#..............##.........
..#...#............................#...#...............................#..#..............................#.............#..#....#...
.#.............#...#.....#.#..........#.............#......#..........#....#.#.................#.................#..#......##..#...
.......#........#..................#.....#........#.#.........#........##....#..............#.......#...#....#.............#.......
.........#.........#......#.#..#....#............##......#...........#.....................#.....#.#.....#.................#.......
..............................#.#......#............#..#....#....................##.............#...##....#.................###....
......#...##...#....#.##...........#.#...........#...##..............#.#.....##....#..........#..#.........#.....#.................
....##...###.........................#............#............#.............#.##...............#..............##.....#............
.....#..#......##.#.........#.....##............#.....#.........#...................#......................#........#..........###.
............#.............#........#.......#...###......#...#.#......##.#...........#..#......................#................#...
..........................................................#........................#..........................#....#....##.....#...
....#...#........#.......................#..........#.............#..#.#...............................#.......##.#...##...........
...#........#..........#........................#...........#.............#.#.....................#...#.#.##.#..................#..
.......................#....#..............#..####......##.#.............#...........#...##............#..#..........##...#.....#..
..#.................#.#..................#.#.....#...#.#..##...#.........#.................#.............#....#..#.......#.........
..#............#..#.....................#.................#............#.....##.#..#.#................#....................#...#...
..#.###.##.......................................##.............#..#...#...........#...#....#...........###......#............#....
........#....#.......#.....................#...................................#...#.#.....#..............................#....#...
.#..#........#...#.....#.............##..#....#................#................................#.........#....#..............#....
............#..........#............#...#.......#..#.#.#.......#....#...........#...#....#............................#.#..........
............................................................#..................#..............#...............................#....
.........#.....#......##........#......#.##..##............##.......................#.........................#....#...............
.#...#...#.#..#...#..............................#...................#..#....................##..........................#.##......
.............#...#...........#......#..#..##...#......#....##.....#................##.........#...........................#........
.................#..................#.........#....#...#..................##............#..#...#.................#..#...........#..
...#...#..........#.........#.....#.........................#.#................#......##...............#............#......#....##.
.............#.................#.............#..#...#.............#.........#..#.#..#............##.............#...#..............
......#.#........#........#...........#..##...................##....#.....................#..#.........#..........#.....##.....#.#.
...........#.#.............#.......#....#..........#.#...............#.#...##.............................................#........
...............#........................#.....#.......#................#........#.......#.....#.......................##...........
......................................#...............................#..........#................#........#.......................
.............................#....#.....##.....#....#...#...........#....#.......##..#.................................#...........
............#.............#......#..#.#.##............#.............#.......#....................#....##...........................
..........#...........#..#.......#.........#.............#...................#.#..#..#....#........#...#...........................
.....................#........#............#.........#.........#..................#...#.........#..............#........#......#...
.................#.............#.#.#.#....#...#..#...................................................#......#......................
........#........#....................#...##....#.#...#..#..#.......#.....#.....#....#.............................................
...#...................#.....#...................#......................#............#......#....#.#.........#.#...................
.#.......................#...#.....#.#....................#.......#............#............#........#.............................
...............#..#..#..............#...#..#...............#.##..................#.......#...........#....#....#...#..........#....
...............#................................#..#............#....#....#.............#...............##..#......#............#..
.........................#..............#.#..#....................#.#.#.....#...............#........#.##.#.......#................
.#...........#.##..#...#.#...........#.......#...............................####....................##....#.........#.#...........
...................#...........#........#..#.........#............#..........#.........#...#.......................................
..............#..#...#..#..#.##............#..#..#.............##.##.#..#.......................#..........#..........#..#.........
........##...............##..#..#...........#.............#.#.................#..........#........................#.#...#..........
..............#......#........#........#.#.........#..#.....#.....#..#...##...................#..........#.............#...........
.................#.......#....#.....................#....##...............##....................#......#....#..........#..#.#......
.................................................................S.................................................................
.........#..##...#..#.........#.................................#.........#....#.#............#..#........#.......#.......#........
...................#....#..#....#...#......#....#......#...........................#.............###...............#......#........
...........#...............#........................#.#......#.#............#...#.#.................#....#...#...#.................
..................#...................#..#.........#...##..#...#...................#...#.....#.....#....#.......#.#................
...............#..............#........#................................................#...#.#......#.#.........#....#............
...............##.........#.....#....#................#.....#.#................#.......#................#..........................
...........#.............#...#...................##................#.......#....#...#...........#.#................................
.................#..............................#.....................#.....#...............#...#...................#..............
..............................#.................#..........#............#.......#..............#.#.................................
...............#..............#....#............#......#...#.........#.......##............##...#..#..........................##...
..........................#.#...........#....#.........##..............##......#.........................#.....#................#..
........#...................#..#...#.......................#..................#.#.............#..#.............#...........#.......
.............................#............#....#.....................#.....#..........#..##.............#.#......#.......#.........
....#.........................................#......##...#...........................##........#...#.#............................
.....#.....................#..#....##..#..........#........................##.....#..........#................#....................
.......................................#..#......#.#..##.....#...........#..#.......#.................#...#.................##..##.
....#.....#............#...#......#..............#...................#...........#.........#.........................#....##..##...
......#....#.................#.............#....#..#.....#........#.#........#.....#.#.#.#..#......................................
.........#..........................................#..............##.......#........#...#..#............#.#.............#.#...#...
............#............#.....#..#............#..#.....#.....#....#....#..#............#................#..............#......#...
.###.........#....................................#.#..#......#...#.....#.......#..#.....#.....##.....##.............#....#.#......
..###.......................#.......#..#..........#.............................#...............#..#..#.............##.......#.....
.#.......#...........................................#..#.................#........#.#...............#.....................#.......
.......#....#.....##...........#..#.............#........#..................#.......#.......#.........#......................#.....
.......#...#......#................#..#.#..........#.....................................##....#.............#......#..........##..
.....###.#....#.#..................#........##.#........#...#..............#...........#......#.......................#....#.....#.
.#...........................................................#.#.......#..........#.#.......................#.......#.#......#.....
.....#.................................#....#...#.#.#....#...#....#....#....#.....##....#.............................#.#..#.......
.............#..#........#...........#.....#.......#..#....#..#...#.......................#....#...........#...............#.......
...##...#.##.....#............................#.....##.........................#..#.#...........#.............#........#...........
.........#..#........#..#..................#....#.#........#....#....##....#...........#...#............................#..#.......
..#....#..#.#......#.......#..............#.#............................#............#.................#.......#...###.....#.#.#..
..#.......#.........###....#.........#........##....#......................#...........................#.....##.........#...#......
.##.............#.........#...........#..................................#.....#....#....#.##...............#......#...............
.....#...........#...#......#..........#..................#..#..#.......................#..........................................
.....#..................#..#..#............#..#...........#..#.......#........##...#..................#............................
.....................#.......#...........#..........##........#...............#.#..#...................#........#..#....#..........
.#.........#..#................#............#......#.......#.......#.....#..#.#.#..##..#..........#....##..#.......................
..................##..##..................................#................#.........#...........#....#.........#..#.#.............
.....#..#..............#......#................................#...........#...#...#............##...........................#.....
...#................##.........#.#...#............................#.#....#.#....#...#.........#.......#............#....#.#..#..#..
.................#.......#.#......#.#............##........#................................#....#..#..............................
...#................#................................#.##.#.##.......#...........#....................#......#.....................
.#.........#....#..........##........#.#..........#.#......#..#............##....#................#.......#.............#..........
.................#....#..........#..................#........#.#..........#...............#.....#..#..............#............#.#.
...#..#.......#.......................#...........##.................#....#.....#............#........##.............#.....#..#....
....#.............##............#...#..#....................#.......#.........#..............................#.....................
...#......................#.................#.............#............................#....#.............#......#...#.............
...#.........#........................................#..#.....##......#....##.......#..#........#...#..#.....#.#.............#..#.
..#.......#..................#..#.....#.....#.#.........#.....#......................#....##...............#..........#.....#......
..................#..##........#....#...................#.......#..................#..#.......##...................................
.....#..#.#.#.#.....#........#.....................................#......#..........##........................#......#...#..#.....
...#.#.........##....#..#...................#............#.....##.............................##.........#.....#.............#.....
.#....#................#..........................................#............................#........#...##................#.#..
.........#..........##...#........##.#....#.....#............#.....#..............#....#.#..#............##....#.....#.......##....
.............##......#.................#........#..##...............#..........................#....#.......##........#........##..
......#.....##.......#....................#..........#.........................#...#.......#...##..#..............#........#.......
..#..........#......#....#..............#.......................#...........#.....#................#....#.#.#...#.........#........
.....##.#.#..#.#..............................#...#..##..........................#.#..............###.#............................
.........#.....#...##.............#.........#.....#..........................#.....................................#..#..........#.
.#..##........................#........#............#..........................................#..#..........#.....#..#.....#...#..
.............#..............#.##..............#........#..................##........#.........##.......#.#.....#..#......#..#.#....
..........#....#.###...#........#..#......................................#......#..............#..............#...................
...........#..................#...........#..............................#....................#..#.................#...............
...................................................................................................................................

Challenge year

2023

@victoraugustofd victoraugustofd added the puzzle Advent of Code challenge label Dec 30, 2024
@victoraugustofd victoraugustofd self-assigned this Dec 30, 2024
@victoraugustofd victoraugustofd added this to the 2023 Challenges milestone Dec 30, 2024
@victoraugustofd
Copy link
Owner Author

Challenge link

https://adventofcode.com/2023/day/21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
puzzle Advent of Code challenge
Projects
Status: Backlog
Development

No branches or pull requests

1 participant