Add 2024 Quests 17 - 19
This commit is contained in:
parent
5d1320bec9
commit
6632529d20
27 changed files with 1613 additions and 0 deletions
6
2024/day17_galactic_geometry/Cargo.toml
Normal file
6
2024/day17_galactic_geometry/Cargo.toml
Normal file
|
@ -0,0 +1,6 @@
|
|||
[package]
|
||||
name = "day17_galactic_geometry"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
59
2024/day17_galactic_geometry/challenge.txt
Normal file
59
2024/day17_galactic_geometry/challenge.txt
Normal file
|
@ -0,0 +1,59 @@
|
|||
Part I
|
||||
|
||||
Stars are an excellent form of navigation system. Knowledge of them allows travellers to determine the exact locations of places both on land and at sea. Of course, the Knights of the Order possess extensive knowledge on this subject and can effortlessly identify all constellations. The best knights not only have physical strength but also intellectual prowess, so the Order is seeking to test the contestants' abilities in celestial cartography.
|
||||
First, you need to know how to measure the distance between two stars. Each star has coordinates that define its position in space. To calculate the distance between two stars based on their coordinates, take the absolute difference of their X coordinates and the absolute difference of their Y coordinates. Then sum these differences. For example, if you have two stars with coordinates at 2, 4 and at 7, 3 , the distance between them is calculated as abs(2 - 7) + abs(4 - 3) = 5 + 1 = 6 .
|
||||
This method of measurement is known as the algorithm from Manhattan's Realm.
|
||||
A constellation is a group of stars that forms a single structure such that the sum of all distances between connected stars is as low as possible. There are also as few connections as necessary to maintain connectivity.
|
||||
Once the stars are connected in this manner, the size of the constellation is determined, which is the number of stars forming the constellation combined with the sum of the distances between connected stars.
|
||||
The sky is exceptionally clear and dark tonight. These are ideal conditions for the tournament's astronomy competition. Each participant receives a fragment of the sky to analyse (your notes), featuring several stars. Your goal is to create a constellation from these stars and determine its size.
|
||||
Example based on the following notes:
|
||||
*...*
|
||||
..*..
|
||||
.....
|
||||
.....
|
||||
*.*..
|
||||
There are five stars in the sample part of the sky, so let's use numbers to identify them more easily and note their coordinates, assuming the bottom left corner has coordinates 1, 1 :
|
||||
1...2
|
||||
..3..
|
||||
.....
|
||||
.....
|
||||
4.5..
|
||||
|
||||
Star Coordinates
|
||||
1 1,5
|
||||
2 5,5
|
||||
3 3,4
|
||||
4 1,1
|
||||
5 3,1
|
||||
Creating a constellation from this group may look as follows:
|
||||
|
||||
There are four connections with the distances as below:
|
||||
Connected Stars Distance
|
||||
1 and 3 3
|
||||
2 and 3 3
|
||||
3 and 5 3
|
||||
4 and 5 2
|
||||
The constellation contains 5 stars, and the sum of all connections between them is 11, so the final size is equal to 5 + 11 = 16.
|
||||
There are many other ways to connect the stars into a single structure; however, the one above results in the lowest possible size for this example, so only this is considered an actual constellation.
|
||||
What is the size of the constellation created from all the stars on your part of the sky?
|
||||
|
||||
Part II
|
||||
|
||||
The second round of the task is exactly the same. The only changes are the size of the sky you need to analyse and the number of stars to connect into a single constellation. However, your method is very well prepared for slightly larger notes!
|
||||
What is the size of the constellation created from all the stars on your part of the sky?
|
||||
|
||||
Part III
|
||||
|
||||
There is also a special type of constellation called a brilliant constellation. They function similarly to regular constellations, but the distance between connected stars must be less than 6. If two stars or groups of stars are further apart, they are considered as separate brilliant constellations.
|
||||
The final round involves finding brilliant constellations on the given fragment of the sky. Identify the three largest brilliant constellations and multiply their sizes to get the final answer.
|
||||
Example based on the following notes:
|
||||
.......................................
|
||||
..*.......*...*.....*...*......**.**...
|
||||
....*.................*.......*..*..*..
|
||||
..*.........*.......*...*.....*.....*..
|
||||
......................*........*...*...
|
||||
..*.*.....*...*.....*...*........*.....
|
||||
.......................................
|
||||
There are 4 brilliant constellations with sizes (from the left): 14, 21, 24, and 31.
|
||||
Multiplying the three largest sizes gives 31 * 24 * 21 = 15624.
|
||||
Find the three largest brilliant constellations on your new part of the sky. What is the result of multiplying their sizes?
|
210
2024/day17_galactic_geometry/src/lib.rs
Normal file
210
2024/day17_galactic_geometry/src/lib.rs
Normal file
|
@ -0,0 +1,210 @@
|
|||
use core::fmt::Display;
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum ParseError {
|
||||
NoStars,
|
||||
}
|
||||
|
||||
impl Display for ParseError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::NoStars => write!(f, "No Stars found in input. Stars should be represented by \'*\'."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Star {
|
||||
x: usize,
|
||||
y: usize,
|
||||
}
|
||||
|
||||
impl Star {
|
||||
fn distance_to(&self, other: &Self) -> usize {
|
||||
self.x.abs_diff(other.x) + self.y.abs_diff(other.y)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
struct Constellation {
|
||||
stars: usize,
|
||||
distance: usize,
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for Constellation {
|
||||
type Error = ParseError;
|
||||
|
||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
// Initialize the stars without connections
|
||||
let stars: Vec<Star> = value
|
||||
.lines()
|
||||
.enumerate()
|
||||
.flat_map(|(y, line)| line
|
||||
.chars()
|
||||
.enumerate()
|
||||
.filter(|(_x, c)| *c == '*')
|
||||
.map(|(x, _c)| Star { x, y, })
|
||||
.collect::<Vec<_>>()
|
||||
).collect();
|
||||
|
||||
if stars.is_empty() {
|
||||
return Err(Self::Error::NoStars);
|
||||
}
|
||||
|
||||
// Find connections using Prim's algorithm
|
||||
let mut distances = vec![vec![0; stars.len()]; stars.len()];
|
||||
stars.iter().enumerate().for_each(|(l_idx, l_star)| stars.iter().enumerate().skip(l_idx+1).for_each(|(r_idx, r_star)| {
|
||||
let distance = l_star.distance_to(r_star);
|
||||
distances[l_idx][r_idx] = distance;
|
||||
distances[r_idx][l_idx] = distance;
|
||||
}));
|
||||
let mut conncections = vec![Vec::new(); stars.len()];
|
||||
let (first_idx, dist) = distances[0].iter().enumerate().skip(1).min_by_key(|(_idx, dist)| *dist).unwrap();
|
||||
conncections[0].push(first_idx);
|
||||
conncections[first_idx].push(0);
|
||||
let mut distance = *dist;
|
||||
|
||||
loop {
|
||||
let missing: Vec<_> = conncections.iter().enumerate().filter(|(_idx, conns)| conns.is_empty()).map(|(idx, _conns)| idx).collect();
|
||||
if missing.is_empty() {
|
||||
break;
|
||||
}
|
||||
let (next_l, (next_r, dist)) = missing
|
||||
.iter()
|
||||
.map(|l_idx| (*l_idx, distances[*l_idx]
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(r_idx, _dist)| missing.binary_search(r_idx).is_err())
|
||||
.min_by_key(|(_r_idx, dist)| **dist)
|
||||
.unwrap_or((0, &usize::MAX)))
|
||||
).min_by_key(|(_l_idx, (_r_idx, dist))| **dist)
|
||||
.unwrap();
|
||||
conncections[next_l].push(next_r);
|
||||
conncections[next_r].push(next_l);
|
||||
distance += *dist;
|
||||
}
|
||||
|
||||
Ok(Self { stars: stars.len(), distance, })
|
||||
}
|
||||
}
|
||||
|
||||
impl Constellation {
|
||||
fn size(&self) -> usize {
|
||||
self.stars + self.distance
|
||||
}
|
||||
}
|
||||
|
||||
struct BrilliantConstellations {
|
||||
constellations: Vec<Constellation>
|
||||
}
|
||||
|
||||
impl TryFrom<&str> for BrilliantConstellations {
|
||||
type Error = ParseError;
|
||||
|
||||
fn try_from(value: &str) -> Result<Self, Self::Error> {
|
||||
// Initialize the stars without connections
|
||||
let stars: Vec<_> = value
|
||||
.lines()
|
||||
.enumerate()
|
||||
.flat_map(|(y, line)| line
|
||||
.chars()
|
||||
.enumerate()
|
||||
.filter(|(_x, c)| *c == '*')
|
||||
.map(|(x, _c)| Star { x, y, })
|
||||
.collect::<Vec<_>>()
|
||||
).collect();
|
||||
|
||||
if stars.is_empty() {
|
||||
return Err(Self::Error::NoStars);
|
||||
}
|
||||
|
||||
// Find connections using Prim's algorithm
|
||||
let mut distances = vec![vec![0; stars.len()]; stars.len()];
|
||||
stars.iter().enumerate().for_each(|(l_idx, l_star)| stars.iter().enumerate().skip(l_idx+1).for_each(|(r_idx, r_star)| {
|
||||
let distance = l_star.distance_to(r_star);
|
||||
distances[l_idx][r_idx] = distance;
|
||||
distances[r_idx][l_idx] = distance;
|
||||
}));
|
||||
let mut constellations: Vec<(Vec<usize>, usize)> = Vec::new();
|
||||
for first_idx in 0..stars.len() {
|
||||
if constellations.iter().any(|(cons, _d)| cons.contains(&first_idx)) {
|
||||
continue;
|
||||
}
|
||||
if let Some((next_idx, dist)) = distances[first_idx]
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(idx, dist)| **dist < 6 &&
|
||||
*idx != first_idx &&
|
||||
!constellations.iter().any(|(cons, _d)| cons.contains(idx)))
|
||||
.min_by_key(|(_idx, dist)| **dist)
|
||||
{
|
||||
let mut this_cons = Vec::from([first_idx, next_idx]);
|
||||
let mut this_len = *dist;
|
||||
while let Some((other, dist)) = this_cons
|
||||
.iter()
|
||||
.flat_map(|seen| distances[*seen]
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(new, dist)| **dist < 6 &&
|
||||
!this_cons.contains(new) &&
|
||||
!constellations.iter().any(|(cons, _d)| cons.contains(new))
|
||||
))
|
||||
.min_by_key(|(_idx, dist)| **dist)
|
||||
{
|
||||
this_cons.push(other);
|
||||
this_len += dist;
|
||||
}
|
||||
constellations.push((this_cons, this_len));
|
||||
|
||||
} else {
|
||||
constellations.push((Vec::from([first_idx]), 0));
|
||||
}
|
||||
}
|
||||
Ok(Self { constellations: constellations.iter().map(|(stars, dist)| Constellation{ stars: stars.len(), distance: *dist }).collect(), })
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run(input: &str, part: usize) -> Result<usize, ParseError> {
|
||||
// let items: Vec<_> = input.lines().map(::try_from).collect::<Result<Vec<_>, _>>()?;
|
||||
match part {
|
||||
1 | 2 => {
|
||||
let constellation = Constellation::try_from(input)?;
|
||||
Ok(constellation.size())
|
||||
},
|
||||
3 => {
|
||||
let brilliant_constellations = BrilliantConstellations::try_from(input)?;
|
||||
let mut sizes: Vec<_> = brilliant_constellations.constellations.iter().map(Constellation::size).collect();
|
||||
sizes.sort_by_key(|s| usize::MAX - s);
|
||||
Ok(sizes.iter().take(3).product())
|
||||
},
|
||||
_ => panic!("Illegal part number"),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::fs::read_to_string;
|
||||
|
||||
fn read_file(name: &str) -> String {
|
||||
read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_sample() {
|
||||
let expected = [16, 16, 15624];
|
||||
for part in 1..=expected.len() {
|
||||
let sample_input = read_file(&format!("tests/sample{part}"));
|
||||
assert_eq!(run(&sample_input, part), Ok(expected[part-1]));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_challenge() {
|
||||
let expected = [135, 1244, 3818228112];
|
||||
for part in 1..=expected.len() {
|
||||
let challenge_input = read_file(&format!("tests/challenge{part}"));
|
||||
assert_eq!(run(&challenge_input, part), Ok(expected[part-1]));
|
||||
}
|
||||
}
|
||||
}
|
17
2024/day17_galactic_geometry/tests/challenge1
Normal file
17
2024/day17_galactic_geometry/tests/challenge1
Normal file
|
@ -0,0 +1,17 @@
|
|||
*.........*.........*
|
||||
.....................
|
||||
..*.........*...*....
|
||||
.....................
|
||||
......*....*......*..
|
||||
.....................
|
||||
........*...*........
|
||||
.....................
|
||||
*.....*...*...*.....*
|
||||
.....................
|
||||
........*...*........
|
||||
.....................
|
||||
...*....*...*........
|
||||
.....................
|
||||
....*...*....*.......
|
||||
.....................
|
||||
*.........*.........*
|
51
2024/day17_galactic_geometry/tests/challenge2
Normal file
51
2024/day17_galactic_geometry/tests/challenge2
Normal file
|
@ -0,0 +1,51 @@
|
|||
*........................................*...........*..........*....*.................*.....*......*
|
||||
.......*..*.............................................................*.......*....................
|
||||
...*...................*..*.................................*........................................
|
||||
.....................*...*.......*......*...........*.....*......*.................................*.
|
||||
.*..................................*.................................*..............................
|
||||
.......*...................*...*.*..................*................................................
|
||||
..........................................*.....................*.............*............*...*.....
|
||||
...............*..*..............*........................*...........*..............................
|
||||
...........................................................................*.........................
|
||||
.......................................*.....................*...........................*........*..
|
||||
.........................................................................................*...........
|
||||
..........*.....................*.*............*............................................*........
|
||||
............................*...................*....................................................
|
||||
..........*........*......................*............*.......................................*.....
|
||||
...............*..........................*..........................................................
|
||||
......*..............*........*........*...*.....*.......*..........*.......*........................
|
||||
...........................................................*...................................*.....
|
||||
..*...*.......................*....*.*................*....................*..*....*.....*.....*.*...
|
||||
.........*.*...........................*......*...........................*......*...........*.......
|
||||
.......*..............................*..*.................*.............................*...........
|
||||
.*.........*.....................*.*..................**.....*....*..*.*.............*.*..**.........
|
||||
....*.......................*..*..................*.....................................*............
|
||||
.......................................*..............*.............................*.*..............
|
||||
...................................*................................*....*...........................
|
||||
...............*............*.....................*..........................*.......................
|
||||
............................*....................***............*......................*.............
|
||||
.*......*..*....*.................................*....*.....................*...............*.*.....
|
||||
........................................................*...*........................................
|
||||
...................................................*...........*.................................*..*
|
||||
......*......*.............................................................*.........**..............
|
||||
......................................................*...*......*......*..................*.........
|
||||
........................*..............*....*..........*............................*................
|
||||
.....................*.............*..*..............*.*..................................*.......**.
|
||||
............*....*...*..................*.......................................*....................
|
||||
..............................*....................*...............................*.................
|
||||
.........*............................*........*..*..................*..............................*
|
||||
................*...................................................*.............*..................
|
||||
.....................*............*.............*...*....................*...........................
|
||||
...................*...............*............................*.................*............*..*..
|
||||
.................*............................*.........*......*......*..*.....*..*..............*...
|
||||
..........................................*.......................*..*.................*.............
|
||||
**.....................................................*..................*..........................
|
||||
.........*.........*.......................*...................*............*...............*........
|
||||
..............*...............*................................*......*..............................
|
||||
.................*.......*..............*.......................*...........................**.......
|
||||
................*....................*......*..............*...............................*.........
|
||||
...........*....*..........*.*...............................................*.......................
|
||||
.......................*.....................*.......*................*.....................*........
|
||||
.........*.............*.................................*.*................*........................
|
||||
....*................*...............*.............................................................**
|
||||
*...............*.......*...................*.......*............................*..........*......**
|
151
2024/day17_galactic_geometry/tests/challenge3
Normal file
151
2024/day17_galactic_geometry/tests/challenge3
Normal file
|
@ -0,0 +1,151 @@
|
|||
*....*................*.............................*........*..............*..........*............*...*..........*.............*............*..............*.........*...*......*.................*...*
|
||||
..............................*.......*.............*.........................................................................................*...*................*.....*.....*.........*...............
|
||||
..............................*..........*....................*....*.................................*...........*.......*.................*.........................................*...................
|
||||
...................*...*.................*..*........................*..............*............*..............................................*..................*..*.*..*...........*.....*...........
|
||||
........*.......................*............................*..............*.....*.........*..........*.*.....*............*.............*..*...........................................*...............
|
||||
.............*.................*.............................*.................*...............................*......................*.................................*.....*..........*...............
|
||||
.................................**..............*.........................*...................................................*.......*.................................*.*.................*...........
|
||||
.......*.........*........*...................................*..................................*.............*..................*.*......................*................*.......*....................
|
||||
.*..............................*.....*.............................*.*...............*....*.................................................................*..........*.........*..........*........*..
|
||||
...*.......................*......................................*....*.*....................*.*.......*.........................................................*.............*........................
|
||||
....*.........................................................................*............*...........................................*.................................................................
|
||||
......*.......................*.......**.......*..*.......*..............*...........................*........*.**.......................................*........**......*...............*..............
|
||||
.....................*...................*..................**...............***..........*.....................................................................*........................*...............
|
||||
............*...............*.......*.....*..*....................*....**...................*.................................*................**..........*........*.*.....*......*.....................
|
||||
................*................................................................*..................*...................................................*...............................................*
|
||||
.......................*..*.......*..*...*.*.......*.............*.*..........*.*...................*.........*....*.......................**.*..............*.......***......*..........................
|
||||
....................*.........................*.*..................*...............*.**..................................................*..............................*..........*.....................
|
||||
.*...................*...*.....**......*.*....*....*.....*....*..........................*..........*...........................*.......*.....*................*........*......*.......*.................
|
||||
........................................*..............**............*........*.*......*.............*...........................*....*....*............*.....*..*......*......*......*....*.............
|
||||
....*..................*.......*...*...*...........................................*......................*.....................................*................*.......*....*..*...............*.......
|
||||
............*.*........*............................................................*.........*...................................*....*..................*..........................*.....*....*..*.....
|
||||
......................*......*.......*.............................................**.........................................*................***.................*.....*.*..*...*......................
|
||||
.......................................*..................*.............*............................*.*..............*.................*..*..................*.................................*.*......
|
||||
*...................**.*....*......*...............*...........................*...........................................................................*...*.....**.....*.......*.*.............*....
|
||||
......*...............*.**...................................................................................*........................*............*..*..................................................
|
||||
............*.....**......*.*.....*.............*...........................*..............................*............*.............................................*.......*......*........*.........*
|
||||
................................................................*.....*............................................*..............................................*..........................**..........
|
||||
..*...............*...*..*......*........*.........................*....*...............*.*.....*....................................................*..................*......*......*..................
|
||||
....*..................*...............*............................*.............................*.......*....*...............................................................*.........................
|
||||
...*.............*......*......*.................................................................................*.....*....................*........................*...*......*......*............*....
|
||||
......................*..................................*.........*................*...*...*.......*....................................*..*.......*...........................................*........
|
||||
................*......*......*......................*....*.........*.*............................................*..*...........**.........................*...*....*...*......*......*................
|
||||
..................................*........................................................*...................*.................................................*..................*....................
|
||||
..........*.*..*......*.....*..................................................*.........*....*...................................*.............*...........................*.....*......*...............
|
||||
..............*...............................*......*...........*...................**........................................................*.......*.............*....*.....*.*......................
|
||||
*...........*.*...*.*.*....*.*...........................*...*..*...**..............*..............................*............*........................*...........*.......*......**....*.*....*.......
|
||||
....*....................*.............................................................*.......*......*...*...................**........*..............................*................*...........*..*.
|
||||
.............*..**..*...*.*................................*...*...........*...............**.........................*.........*......................*...*.....*......*.....*....**....*.*.....*.......
|
||||
......*......*.....................................................*....................................................*.....................*.*...............*.*...........*.................*........
|
||||
.*..........*......*.....*....................*.......*....................*..........*..........................................*..................*..........................*.*...*......*............
|
||||
.....*................*.....................................................*..................*.........................................*..*........*..........................................*........
|
||||
...........*......*.....*..*......*.*.........*........................*........................*..........*..................................*.................................*.....*......*...........
|
||||
.......*.................*.......................*.*.*.*.........*.............................*..........*...............................*.....................................................*........
|
||||
..*...*....*.....*.....*.*.............*................*....................................................*.....................*..............................*.......*.*....*..*..*.....**....*.....
|
||||
......................................*............*.....................................*....*................................................*.............*......*...*................................
|
||||
..........*.*...*..*...*....*...........................**................*................*.................................*....*............*...........*......*..............*......*....**.........*
|
||||
...............*.........*....*....*...........................................................................................................*..........*..............*.*.............*...*...........
|
||||
...*.....*......*.....*.......................*...........*..............*....***....................*.........*...........................*...................................*..*.....*......*.........
|
||||
............*..*........................*........*...................................*......................*..............*........*...................................................*................
|
||||
......*..*...*.*..*..*..........................*........................*...............*............*.*....*...**...........................................*....................*.....*.....*.........
|
||||
...*......*.......................................**........................*...................................*..................*..*.......*............*............*...*............................
|
||||
........*.*...*......*...*...........*.....................*.......*..........**...................*........*..................*......*..................*....*....................*......*.....*........
|
||||
.....................*..*...........................................................*...............*.................*..*......................*....*...................................................
|
||||
........*.....*...*.*.......................................**...............*.......................................................................................*..............*.....*.....*........
|
||||
........*.............................................*........*...........*........................................................................*...............................*....................
|
||||
.......*.....*.....*.............*...........*...............*..................*.............................................................*.................*....................*.....*.....*......*
|
||||
.......*.......*....*..............................*.................*.....*..........*............*..........*.........................*............*..................................*................
|
||||
.......*.....*.....*...................*.............................*....*......*..........*................................*........*..............................................*.....*.....*.....*.
|
||||
.......................................*....*..*...........*....................................*...............................*...*....*.........*..........................*........................*.
|
||||
......*.....*......*.............................*.......................*........*.*.**.........*...................*...................*....*...*....*..............*..............*......*.....*.....*
|
||||
........*...........*.........**................................*..*.....*.....................*.................*..............................*........*....*................*.*.......................
|
||||
......*...*.*.....*...........................................*.....*..*...........................................*..*..............................................*...........*....*.....*.....*......
|
||||
......................*......................................................................................**.........................*..*..*......................*..*.....**.........................
|
||||
......*.....*.....*..........*........*........................................................*...................*...............*....................*..*..........................*.....*.....*......
|
||||
........................*..................................*...*.......*..............................................................................................*.........*..*..............*......
|
||||
......*.*...*...*.*............................*..........*...........................*....*....................................*..............................**..*...*..............*....**.....*......
|
||||
...........*..............*..................................**....................................*.*.*.*.*.*.*.*.*..................................................*.............*....................
|
||||
.....**....*.....*.................................................*......*............*.......*.*.*.*.*.*.*.*.*.*.*.*..............................*...................*.....*..*.....*.....*.....*.....
|
||||
.........................................................*................*....*.............*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.............................*.....*....*......*...............................
|
||||
*.*.**.....*.....*............*...............................*.*..........*....*...........*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*............................................................*.....*.*...*.....
|
||||
........*.........................*.......*..............*.......*.........................*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*.*...**...............................*...........*.................*..........
|
||||
.....*...*.*.....*........................................*.....................................*.*.*.*.*.*.*.*..**...*.*.*.*........*........................*.............*..........**...**.....*.....
|
||||
..........*...........*..............................*...........*...........*.*.*.*.*...........*.*.*.*.*.*.*....*....*.*.*.*......................*...............*....................................
|
||||
.....*.....*.....*......................*................................*....*.*.*.*.*.*.*.*.....*.*.*.*.*.*...........*.*.*.*....................................*....*..............*.....*.....**....
|
||||
.....................................*..........................*...*............*.*.*.*.*.*.*.....*.*.*.*.*.*.........*.*.*.*.......*........................................................*........*.
|
||||
.....*.....*.................*....................................*.....................*.*.*.*.*...*.*.*.*.*.*.*...*.*.*.*.*.*.......*.............*.....*..................................*.....*...*.
|
||||
....................................................*...........*.....*...*........................*.*.*.*.*.*.*.*.*.*.*.*.*.*............*..........**..................................................
|
||||
.....*....**.....*.......................................*.........................*.*.*.*.*.*......*.*.*.*.*.*.*.*.*.*.*.*.*.*....*.........*.........................................*.....*.*...*.....
|
||||
.**..........*..........*....*...........................*............................*.*.*.*.*......*.*.*.*.*.*.*.*.*.*.*.*.*.......*.............*.................*...*................*.*......*.....
|
||||
.*...*.....*.....*....................................................................................*.*.*.*.*.*.*.*.*.*.*.*.*.....................*..................................**....*.....*.....
|
||||
.......................................*...*........................*...........*......................*.*.*.*.*.*.*.*.*.*.*.*.......*......*............................................*...............
|
||||
.....*.....**....*.*....................*....*.....*..*............................*......................*.*.*.*.*.*.*.*.*.*........................................................*.*.....*.....**....
|
||||
*............*.....................................................*.....*................*.......*..........*.*.*.*.*.*.*.*.................................*........*.........*.........*..............
|
||||
.....*.....*.....*..................................................*.....................*.*...*.................*.*.*.*.*............................................................*..*..*.....*.....
|
||||
.......*...........**.....................*.......*...............*...........**........................*...............*...........*.................................................**.............*...
|
||||
......*.....*.....*..........*..............*.........*....*...................................*........**.**................................................*..*.....................*.....*.....*...*..
|
||||
......*...........*..................*............*..........................*......*.................................................*........................*.........*......................*........
|
||||
......*.....*.....*.......*......................*.......*.*..*.......*..........................*........*........*.....................*............................................*.....*.....*......
|
||||
..........**.............*.............................................................*...........*..........*.............................*...........*...................................*............
|
||||
......*.....*.....*................................*...........*............*................................*.....*.................*...........................................*.*..*.....*.....**.....
|
||||
....................*...................*.................................*............*..................................................*............*...........*......................*.......*......
|
||||
......*..*.**......*........*.................................................................*.................**...........*..*............*..................................*....*..*...*.....*......
|
||||
....*.......................**..................................*..*.................*..........................................*.........*.*....*.......................................................
|
||||
.......*.....*...*.*...............................................................................*......*......................................*......*..*.......................*.*.....*.....*.......
|
||||
...**.....................................................................................*.................*........*....*...................................................*..........................
|
||||
.......*.....*.....*..................................*...................................*...........*..........................................*.................................*.*.....**....*.......
|
||||
.......................*......**...*...................*...........................................................*.......*...........*..........................*......................................
|
||||
........*....**.....*..................*.............................*....................*...........*....*.................................*...........................*..........*....**.....*..*.....
|
||||
........................................*........................*...............................*......................*.*.........*..*..............*..........*..*....................................
|
||||
........*.....*......*..........................................................................*..........*............................................*....*.............*.......*.*...**.*...*........
|
||||
.*........*..................*....................................*.............*.................................*.....................*..........................................*.......*.............
|
||||
.........*.....*.....*...................*.....*........*..*.*...................................*.........*.........................*...........................*.................*.....*.....*......*..
|
||||
..*......................*.............................................................................*..............*...........*.....*..................................*...............*.............
|
||||
.........*......*.....*...........*.........................*........*...*.......*...................*..................*................*.........*............................*.*.....*......*.........
|
||||
.......*........*..............................*.................................**.............**......*.............................*........................................*.........................
|
||||
.........**.*...*......**.............*....................................*..........................*..........*.*.....*.......................................................*.....**.....*..........
|
||||
.................................*.....*............*...*.....................................*......*........................*......*................*....................*.............................
|
||||
...........*.....*.....*..........*...........................................*....*......*..*..................*...*.....................*......................................*.*...*.....*...........
|
||||
*......................................*.......*.........*......*......................*..................*.....................*.......*.................*..............................................
|
||||
..*........*......*.....*...............*..*....................*................*.*....................................*.........................*........................*...**.*...*......*..*........
|
||||
.*..............................................*.......*..................*..................................*......................................................*........*.......*.*.....*...*......
|
||||
............*......*.....**..*.................*.*....*..........................................*.......*...................**........................*..............*.....*..*.....*...*..*............
|
||||
...............*.......*..........*.............................*....................*....**.*....*.........................................*............................................................
|
||||
....*....*...*......*.....*...........*......................................................................................*..................................*.............*.....*......*.*...........
|
||||
...............................*................................*.........................*..............*................*..............*..............*......................*............*.....**.....
|
||||
............*.*.....*......*..........................................*.......*...........**.....*.............................*...................*........................**......*.....*............*.
|
||||
........*.....................................*........................................*...............................*.............*..................*.*.............*..............*.*............*..
|
||||
...............*......*...*.*..............*.*...........**...................................................*........................*.*.......*..........................*.....**.....*..*............
|
||||
..................*......*..................*.......*........*...*....*.*...............................*........*....................................................................................*.*
|
||||
*...............*......*......*..................*..*.*.......................................................................*.......................................*...**.....*......*................
|
||||
..................................*...*.............................................................................*.*.................*...............*....................................*......*....
|
||||
..............*..*......*.**...*...*...........*............*..............*.......................................................*....................................**......*......*.................
|
||||
.................................**............................*...**......*.............*.................*..............*.........................................*....................................
|
||||
..................*......*....*.*.........*.*............................**.....*..*........................*.....**.......*...*............*................*......*...*......*......*..................
|
||||
..*...............................................................*.*....**..............................................................*.....*.........................................*...............
|
||||
................*..*......**......*...............................*....................*..........*...................*.*.................*..*...............*........*.......*..*...*...................
|
||||
............*.......*...*.........................................................*..............................................................*..........................................*...*........
|
||||
....................*.......*......*..*....................................*...................................................................................**....*......*.......*....................
|
||||
............................................................................*...................................*.................................*.........*.*........................*..........*......
|
||||
......................*......*.......*......................*......*.*..................*......*............................**.........................*.........*.*.......*......*......................
|
||||
........*..................................................*..................*.........................*.........................*......*..................*................*...........................
|
||||
.*.....................**....*.*.......*.................*.*.......**......................*.........................**...........*..*.................*.........*.......*.......*...........*....*......
|
||||
......*..........*.......................*................................................................*..*.................................................*.......................*...*.......*.....
|
||||
.........................*..*...*........*..............................*.........*..........................*.......*......*..........................*......**........*......*..*......*..........*....
|
||||
..*........................*..........*......................................................*........*....*.....*...................*.....................................*.......*..........*..........
|
||||
..........*..............**.......*.......**.........................*...*............*........*.*............................*..*...*.......................*........*..*...**.....................*....
|
||||
...............*.........*..........*............*................................................................*.............................*.....*.......*.............................**...........
|
||||
.*..........................*..*....*........*..............*........*.*..................................................................................**........*.......*........................*...
|
||||
.........................................................*...............*...........*...........................*..**........*..........*......*........................................................
|
||||
........*.*...................*.......*........*............*.....*..**..............................**............*....................*.............*..*........*.......*.............*................
|
||||
...............................*.........*............*............*..*..............*.................*....*............*........*.....*.................*............*....*............................
|
||||
.................................*.......*.......................................................................*......................................................................*...............*
|
||||
.*..........*.................*...........................................*.......................*......*................................*...........**...............*......*................*.........
|
||||
......................*................................................*......*.......*.....*.*......*.....................*.*................*.*.........................*.....*.............*..**.....*
|
||||
....*.*......................*..*....*..........*.....................*.......**..............................................*.......*....................................**...*......*.........*.......
|
||||
.........*...................*................*............*...*.................*.........****.............................*........................................................*...................
|
||||
...............*.............**.................*.........*.....*........................................*......................*..........................................*..............*..............
|
||||
.............*...........................*................................................................................................................*..............................................
|
||||
.....*............*....................................................*..........*..*......*.........................................................................*.....................*.*..........
|
||||
....*.........................................*..............*.............*.........................................*.......*..*...................*...................................*..............**
|
||||
*..................*.................................*................*.................................**...*............*.............*...*.........*......*...........................*.............**
|
5
2024/day17_galactic_geometry/tests/sample1
Normal file
5
2024/day17_galactic_geometry/tests/sample1
Normal file
|
@ -0,0 +1,5 @@
|
|||
*...*
|
||||
..*..
|
||||
.....
|
||||
.....
|
||||
*.*..
|
5
2024/day17_galactic_geometry/tests/sample2
Normal file
5
2024/day17_galactic_geometry/tests/sample2
Normal file
|
@ -0,0 +1,5 @@
|
|||
*...*
|
||||
..*..
|
||||
.....
|
||||
.....
|
||||
*.*..
|
7
2024/day17_galactic_geometry/tests/sample3
Normal file
7
2024/day17_galactic_geometry/tests/sample3
Normal file
|
@ -0,0 +1,7 @@
|
|||
.......................................
|
||||
..*.......*...*.....*...*......**.**...
|
||||
....*.................*.......*..*..*..
|
||||
..*.........*.......*...*.....*.....*..
|
||||
......................*........*...*...
|
||||
..*.*.....*...*.....*...*........*.....
|
||||
.......................................
|
Loading…
Add table
Add a link
Reference in a new issue