Prepare structure for day 7
This commit is contained in:
@@ -38,13 +38,13 @@
|
||||
[Challenge](day06/README.md)
|
||||
[Notes](day06/Notes.md)
|
||||
|
||||
<!--
|
||||
## Day 07 – tba
|
||||
## Day 07 – Laboratories
|
||||
|
||||
[Page](https://adventofcode.com/2025/day/7)
|
||||
[Challenge](day07/README.md)
|
||||
[Notes](day07/Notes.md)
|
||||
|
||||
<!--
|
||||
## Day 08 – tba
|
||||
|
||||
[Page](https://adventofcode.com/2025/day/8)
|
||||
|
||||
143
day07/README.md
143
day07/README.md
@@ -0,0 +1,143 @@
|
||||
# Day 07 – Laboratories
|
||||
|
||||
## Part one
|
||||
|
||||
You thank the cephalopods for the help and exit the trash compactor, finding yourself in the familiar halls of a North Pole research wing.
|
||||
|
||||
Based on the large sign that says "teleporter hub", they seem to be researching teleportation; you can't help but try it for yourself and step onto the large yellow teleporter pad.
|
||||
|
||||
Suddenly, you find yourself in an unfamiliar room! The room has no doors; the only way out is the teleporter. Unfortunately, the teleporter seems to be leaking magic smoke.
|
||||
|
||||
Since this is a teleporter lab, there are lots of spare parts, manuals, and diagnostic equipment lying around. After connecting one of the diagnostic tools, it helpfully displays error code `0H-N0`, which apparently means that there's an issue with one of the tachyon manifolds.
|
||||
|
||||
You quickly locate a diagram of the tachyon manifold (your puzzle input). A tachyon beam __enters the manifold at the location marked `S`__; tachyon beams always move downward. Tachyon beams pass __freely through empty space (`.`)__. However, __if a tachyon beam encounters a splitter (`^`), the beam is stopped; instead, a new tachyon beam continues from the immediate left and from the immediate right of the splitter__.
|
||||
|
||||
*For example:*
|
||||
|
||||
```
|
||||
.......S.......
|
||||
...............
|
||||
.......^.......
|
||||
...............
|
||||
......^.^......
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
```
|
||||
|
||||
In this example, the incoming tachyon beam (`|`) extends downward from `S` until it reaches the first splitter:
|
||||
|
||||
```
|
||||
.......S.......
|
||||
.......|.......
|
||||
.......^.......
|
||||
...............
|
||||
......^.^......
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
```
|
||||
|
||||
At that point, the original beam stops, and two new beams are emitted from the splitter:
|
||||
|
||||
```
|
||||
.......S.......
|
||||
.......|.......
|
||||
......|^|......
|
||||
...............
|
||||
......^.^......
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
```
|
||||
|
||||
*Those beams continue downward until they reach more splitters:*
|
||||
|
||||
```
|
||||
.......S.......
|
||||
.......|.......
|
||||
......|^|......
|
||||
......|.|......
|
||||
......^.^......
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
```
|
||||
|
||||
*At this point, the two splitters create a total of only three tachyon beams, since they are both dumping tachyons into the same place between them:*
|
||||
|
||||
```
|
||||
.......S.......
|
||||
.......|.......
|
||||
......|^|......
|
||||
......|.|......
|
||||
.....|^|^|.....
|
||||
...............
|
||||
.....^.^.^.....
|
||||
...............
|
||||
....^.^...^....
|
||||
...............
|
||||
...^.^...^.^...
|
||||
...............
|
||||
..^...^.....^..
|
||||
...............
|
||||
.^.^.^.^.^...^.
|
||||
...............
|
||||
```
|
||||
|
||||
*This process continues until all of the tachyon beams reach a splitter or exit the manifold:*
|
||||
|
||||
```
|
||||
.......S.......
|
||||
.......|.......
|
||||
......|^|......
|
||||
......|.|......
|
||||
.....|^|^|.....
|
||||
.....|.|.|.....
|
||||
....|^|^|^|....
|
||||
....|.|.|.|....
|
||||
...|^|^|||^|...
|
||||
...|.|.|||.|...
|
||||
..|^|^|||^|^|..
|
||||
..|.|.|||.|.|..
|
||||
.|^|||^||.||^|.
|
||||
.|.|||.||.||.|.
|
||||
|^|^|^|^|^|||^|
|
||||
|.|.|.|.|.|||.|
|
||||
```
|
||||
|
||||
To repair the teleporter, you first need to understand the beam-splitting properties of the tachyon manifold. *In this example, a tachyon beam is split a total of 21 times.*
|
||||
|
||||
Analyze your manifold diagram. __How many times will the beam be split?__
|
||||
3
day07/go.mod
Normal file
3
day07/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module day07
|
||||
|
||||
go 1.25.5
|
||||
41
day07/main.go
Normal file
41
day07/main.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
// readInput reads and parses the given input
|
||||
func readInput(fileName string) string {
|
||||
file, err := os.ReadFile(fileName)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
// TODO parse
|
||||
return string(file)
|
||||
}
|
||||
|
||||
// Level1 solves the riddle for the first star
|
||||
func Level1() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
// Level2 solves the riddle for the second star
|
||||
func Level2() int {
|
||||
return -1
|
||||
}
|
||||
|
||||
func main() {
|
||||
// get file name, if given, otherwise use default one
|
||||
fileName := "input.txt"
|
||||
if len(os.Args) > 1 {
|
||||
fileName = os.Args[1]
|
||||
}
|
||||
|
||||
// read input
|
||||
input := readInput(fileName)
|
||||
|
||||
// TODO
|
||||
_ = input
|
||||
}
|
||||
Reference in New Issue
Block a user