From adcf94c5e597062f3d44825af5bb596f69561f4d Mon Sep 17 00:00:00 2001 From: Gabriel Bizdoc Date: Wed, 24 Dec 2025 22:25:47 +0200 Subject: [PATCH] day 9 --- year25/day9/part2_mask.go | 136 -------------------------------------- 1 file changed, 136 deletions(-) delete mode 100644 year25/day9/part2_mask.go diff --git a/year25/day9/part2_mask.go b/year25/day9/part2_mask.go deleted file mode 100644 index 0faa5c7..0000000 --- a/year25/day9/part2_mask.go +++ /dev/null @@ -1,136 +0,0 @@ -package day9 - -//) -// -//func Part2BF(ctx aoc.Context) (int, error) { -// g, err := geometry.ScannerToGrid(ctx.Scanner(), ",", strconv.Atoi) -// if err != nil { -// return 0, fmt.Errorf("day9: failed to parse intput %w", err) -// } -// points := geometry.UnsafeGridData(g) -// -// //data := g.Data() -// // -// //minx, miny := math.MaxInt, math.MaxInt -// //for i := range g.Rows() { -// // minx = min(data[i][0], minx) -// // miny = min(data[i][1], miny) -// //} -// //for i := range g.Rows() { -// // data[i][0] -= minx -// // data[i][1] -= miny -// // if data[i][1] == 0 { -// // fmt.Println() -// // } -// //} -// //g = geometry.GridFrom(data) -// -// bottomRight := []int{0, 0} -// for _, p := range points { -// bottomRight[colIndex] = max(bottomRight[colIndex], p[colIndex]) -// bottomRight[lineIndex] = max(bottomRight[lineIndex], p[lineIndex]) -// } -// bottomRight[colIndex] += 3 -// bottomRight[lineIndex] += 2 -// -// mask := geometry.NewGrid[byte](bottomRight[lineIndex], bottomRight[colIndex]) -// //data := geometry.UnsafeGridData(mask) -// //for i := 0; i < mask.Rows(); i++ { -// // for j := 0; j < mask.Cols(); j++ { -// // data[i][j] = dot -// // } -// //} -// //mask.Fill(dot) -// for _, point := range points { -// p := geometry.NewPoint(point[lineIndex], point[colIndex]) -// mask.Set(p, '#') -// } -// -// fillGrid := func(mask geometry.Grid[byte], start, end []int) { -// a := geometry.NewPoint(start[lineIndex], start[colIndex]).ToDirectional(0) -// b := geometry.NewPoint(end[lineIndex], end[colIndex]).ToDirectional(0) -// -// var d geometry.Direction -// if a.GetLine() == b.GetLine() { -// if a.GetCol() < b.GetCol() { -// d = geometry.DirectionRight -// } else { -// d = geometry.DirectionLeft -// } -// } else { -// if a.GetLine() < b.GetLine() { -// d = geometry.DirectionDown -// } else { -// d = geometry.DirectionUp -// } -// } -// a = a.SetDirection(d) -// b = b.SetDirection(d).MoveBackward() -// -// for a != b { -// a = a.MoveForward() -// mask.Set(a, 'X') -// } -// } -// -// var prev = points[len(points)-1] -// for i := 0; i < len(points); i++ { -// next := points[i] -// if prev[colIndex] == next[colIndex] || prev[lineIndex] == next[lineIndex] { -// fillGrid(mask, prev, next) -// } else { -// panic("day9: points out of range") -// } -// prev = next -// } -// -// stack := dsa.NewStack[geometry.Point]() -// for i, line := range geometry.UnsafeGridData(mask) { -// walls := 0 -// for j, point := range line { -// if point == 'X' || point == '#' { -// walls += 1 -// } -// if point == dot && walls == 1 { -// stack.Push(geometry.NewPoint(i, j)) -// break -// } -// } -// if !stack.IsEmpty() { -// break -// } -// } -// for !stack.IsEmpty() { -// p := stack.Pop() -// if mask.At(p) == dot { -// mask.Set(p, 'Y') -// stack.Push(p.MoveUp()) -// stack.Push(p.MoveLeft()) -// stack.Push(p.MoveRight()) -// stack.Push(p.MoveDown()) -// } -// } -// -// for _, pair := range day9FindRectangles(points) { -// p1 := points[pair.Point1] -// p2 := points[pair.Point2] -// -// start := geometry.NewPoint(min(p1[lineIndex], p2[lineIndex]), min(p1[colIndex], p2[colIndex])) -// end := geometry.NewPoint(max(p1[lineIndex], p2[lineIndex]), max(p1[colIndex], p2[colIndex])) -// -// for i := start.Line; i <= end.Line; i++ { -// for j := start.Col; j <= end.Col; j++ { -// p := geometry.NewPoint(i, j) -// old := mask.At(p) -// mask.Set(p, '*') -// mask.Set(p, old) -// if mask.At(p) == dot { -// goto skip -// } -// } -// } -// return int(pair.Area), nil -// skip: -// } -// panic("day9: no solution found") -//}