From bd274c826ce09c6b1de138beb7449e58e78056f1 Mon Sep 17 00:00:00 2001 From: Brian Buller Date: Wed, 29 May 2019 15:19:18 -0500 Subject: [PATCH] Commiting day25. Not done though --- 2018/day25/day25.go | 160 +++++ 2018/day25/input | 1315 +++++++++++++++++++++++++++++++++++++++++ 2018/day25/testinput1 | 8 + 2018/day25/testinput2 | 10 + 2018/day25/testinput3 | 10 + 2018/day25/testinput4 | 10 + 6 files changed, 1513 insertions(+) create mode 100644 2018/day25/day25.go create mode 100644 2018/day25/input create mode 100644 2018/day25/testinput1 create mode 100644 2018/day25/testinput2 create mode 100644 2018/day25/testinput3 create mode 100644 2018/day25/testinput4 diff --git a/2018/day25/day25.go b/2018/day25/day25.go new file mode 100644 index 0000000..7d57386 --- /dev/null +++ b/2018/day25/day25.go @@ -0,0 +1,160 @@ +package main + +import ( + "bufio" + "errors" + "fmt" + "log" + "math" + "os" + "strconv" + "strings" +) + +var grid *Grid + +// Pt 1 +// 431 too high +func main() { + input := stdinToStringSlice() + grid = &Grid{} + for _, v := range input { + grid.addPoint(v) + } + last := len(grid.constellations) + for grid.checkMerges() { + fmt.Println("++ merge ++ ", len(grid.constellations)) + if len(grid.constellations) == last { + break + } + last = len(grid.constellations) + } + fmt.Println("Points:", len(grid.points)) + fmt.Println("Constellations:", len(grid.constellations)) +} + +type Grid struct { + points []*Pos + constellations []*Constellation +} + +func (g *Grid) checkMerges() bool { + for ci, c := range g.constellations { + for _, p := range c.points { + for wrki, wrk := range g.constellations { + if wrki == ci { + continue + } + if wrk.should(p) { + g.merge(ci, wrki) + g.remove(wrki) + return true + } + } + } + } + fmt.Println("Nothing merged") + return false +} + +func (g *Grid) addPoint(inp string) { + pts := strings.Split(inp, ",") + pt := &Pos{ + x: atoi(pts[0]), + y: atoi(pts[1]), + z: atoi(pts[2]), + t: atoi(pts[3]), + } + g.points = append(g.points, pt) + + // Check if this point is within 3 from any other points + cIdx := -1 + var mergedIdx []int + for i, v := range g.constellations { + if v.should(pt) { + if cIdx >= 0 { + g.merge(cIdx, i) + mergedIdx = append(mergedIdx, i) + } else { + cIdx = i + g.constellations[cIdx].add(pt) + } + } + } + for i := range mergedIdx { + g.remove(i) + } + if cIdx == -1 { + c := &Constellation{} + c.add(pt) + g.constellations = append(g.constellations, c) + } +} + +func (g *Grid) merge(c1Idx, c2Idx int) error { + fmt.Println(" Merging", c1Idx, c2Idx) + if c1Idx >= len(g.constellations) || c2Idx >= len(g.constellations) { + return errors.New("Invalid Constellation Index") + } + for _, v := range g.constellations[c2Idx].points { + g.constellations[c1Idx].add(v) + } + return nil +} + +func (g *Grid) remove(remIdx int) error { + if remIdx >= len(g.constellations) { + return errors.New("Invalid Constellation Index") + } + g.constellations = append(g.constellations[:remIdx], g.constellations[remIdx+1:]...) + return nil +} + +type Constellation struct { + points []*Pos +} + +func (c *Constellation) should(p *Pos) bool { + for _, v := range c.points { + if v.to(p) <= 3 { + return true + } + } + return false +} + +func (c *Constellation) add(p *Pos) { + p.constellation = c + c.points = append(c.points, p) +} + +type Pos struct { + x, y, z, t int + constellation *Constellation +} + +func (p *Pos) to(p2 *Pos) int { + xs := math.Abs(float64(p.x) - float64(p2.x)) + ys := math.Abs(float64(p.y) - float64(p2.y)) + zs := math.Abs(float64(p.z) - float64(p2.z)) + ts := math.Abs(float64(p.t) - float64(p2.t)) + return int(xs + ys + zs + ts) +} + +func stdinToStringSlice() []string { + var input []string + scanner := bufio.NewScanner(os.Stdin) + for scanner.Scan() { + input = append(input, scanner.Text()) + } + return input +} + +func atoi(i string) int { + var ret int + var err error + if ret, err = strconv.Atoi(i); err != nil { + log.Fatal("Invalid Atoi: " + i) + } + return ret +} diff --git a/2018/day25/input b/2018/day25/input new file mode 100644 index 0000000..761b364 --- /dev/null +++ b/2018/day25/input @@ -0,0 +1,1315 @@ +-7,1,-6,1 +-4,-2,2,2 +0,-6,-3,-7 +0,5,-4,-2 +-1,-4,4,1 +-3,7,8,1 +-8,-7,4,-8 +-7,8,8,3 +3,-4,-2,-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4,-5,1 +-4,3,-2,-5 +-6,8,-6,8 +-4,2,0,3 +4,0,-3,0 +-3,-6,-6,1 +7,0,5,0 +0,5,0,2 +-2,-7,-8,8 +-6,1,6,-6 +6,-1,-8,-8 +-2,0,0,7 +4,-2,-4,-4 +-6,4,4,-7 +3,-3,0,4 +-2,-7,3,-5 +-2,-6,-8,7 +7,3,-3,0 +-5,-1,4,-5 +1,-3,-4,5 +-7,7,0,-1 +0,0,-3,4 +-8,8,-5,-2 +5,4,-5,3 +7,0,-5,0 +2,0,-4,-6 +0,8,-1,5 +6,6,0,-3 +-2,8,-8,6 +-3,0,7,7 +6,-5,-1,1 +5,-6,-5,3 +0,3,6,-6 +0,7,-3,-4 +0,-7,-2,-4 +-4,2,0,-7 +-8,-7,-7,-1 +5,8,-2,6 +-5,7,-6,8 +6,0,6,1 +6,6,3,6 +1,3,6,-3 +5,-8,6,-4 +6,-4,-6,-8 +1,0,-5,0 +-6,3,0,-6 +5,4,5,7 +-6,-6,-8,7 +1,0,-2,-1 +5,-6,5,7 +-7,8,7,-7 +-1,2,0,2 +0,-2,-8,8 +-8,8,0,5 +7,-2,3,3 +0,6,8,2 +-3,-1,-7,3 +5,1,-8,4 +3,-3,4,0 +6,3,2,3 +-6,-8,5,-7 +7,0,-7,0 +-4,0,-7,-3 +0,8,3,-8 +-4,0,0,-5 +-6,-8,-3,0 +-5,1,4,6 +-3,0,-2,8 +1,1,-7,-5 +-4,5,4,-7 diff --git a/2018/day25/testinput1 b/2018/day25/testinput1 new file mode 100644 index 0000000..3089dd5 --- /dev/null +++ b/2018/day25/testinput1 @@ -0,0 +1,8 @@ +0,0,0,0 +3,0,0,0 +0,3,0,0 +0,0,3,0 +0,0,0,3 +0,0,0,6 +9,0,0,0 +12,0,0,0 diff --git a/2018/day25/testinput2 b/2018/day25/testinput2 new file mode 100644 index 0000000..3a97e16 --- /dev/null +++ b/2018/day25/testinput2 @@ -0,0 +1,10 @@ +-1,2,2,0 +0,0,2,-2 +0,0,0,-2 +-1,2,0,0 +-2,-2,-2,2 +3,0,2,-1 +-1,3,2,2 +-1,0,-1,0 +0,2,1,-2 +3,0,0,0 diff --git a/2018/day25/testinput3 b/2018/day25/testinput3 new file mode 100644 index 0000000..bf5c2b9 --- /dev/null +++ b/2018/day25/testinput3 @@ -0,0 +1,10 @@ +1,-1,0,1 +2,0,-1,0 +3,2,-1,0 +0,0,3,1 +0,0,-1,-1 +2,3,-2,0 +-2,2,0,0 +2,-2,0,-1 +1,-1,0,-1 +3,2,0,2 diff --git a/2018/day25/testinput4 b/2018/day25/testinput4 new file mode 100644 index 0000000..1147af7 --- /dev/null +++ b/2018/day25/testinput4 @@ -0,0 +1,10 @@ +1,-1,-1,-2 +-2,-2,0,1 +0,2,1,3 +-2,3,-2,1 +0,2,3,-2 +-1,-1,1,-2 +0,-2,-1,0 +-2,2,3,-1 +1,2,2,0 +-1,-2,0,-2