mirror of
https://github.com/fredrikr79/advent_of_code.git
synced 2026-06-22 21:07:56 +02:00
2025/8/odin: wip
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
162,817,812
|
||||
57,618,57
|
||||
906,360,560
|
||||
592,479,940
|
||||
352,342,300
|
||||
466,668,158
|
||||
542,29,236
|
||||
431,825,988
|
||||
739,650,466
|
||||
52,470,668
|
||||
216,146,977
|
||||
819,987,18
|
||||
117,168,530
|
||||
805,96,715
|
||||
346,949,466
|
||||
970,615,88
|
||||
941,993,340
|
||||
862,61,35
|
||||
984,92,344
|
||||
425,690,689
|
||||
@@ -0,0 +1,40 @@
|
||||
package day_8
|
||||
|
||||
import "core:fmt"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
|
||||
input :: cast(string)#load("../ex_input")
|
||||
|
||||
Pos :: [3]int
|
||||
|
||||
parse :: proc(input: string) -> (res: []Pos, ok: bool) {
|
||||
data: [dynamic]Pos
|
||||
for line in strings.split_lines(strings.trim_space(input)) {
|
||||
raw_pos := strings.split(line, ",")
|
||||
pos: Pos
|
||||
for &v, i in pos {
|
||||
v = strconv.parse_int(raw_pos[i]) or_return
|
||||
}
|
||||
append(&data, pos)
|
||||
}
|
||||
return data[:], true
|
||||
}
|
||||
|
||||
solve_1 :: proc(data: []Pos) -> int {
|
||||
edges: map[Pos]Pos
|
||||
for p1 in data {
|
||||
for p2 in data {
|
||||
if p1 == p2 do continue
|
||||
if p1 not_in edges do edges[p1] = p2
|
||||
}
|
||||
}
|
||||
fmt.println(edges)
|
||||
return 0
|
||||
}
|
||||
|
||||
main :: proc() {
|
||||
data, ok := parse(input)
|
||||
if !ok do fmt.eprintln("failed to parse")
|
||||
fmt.println(solve_1(data))
|
||||
}
|
||||
Reference in New Issue
Block a user