refactor aoc.utils
This commit is contained in:
parent
579ae1211b
commit
7a02e47899
@ -7,7 +7,7 @@ import (
|
||||
"iter"
|
||||
"strconv"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
)
|
||||
|
||||
func Day1Part1(ctx aoc.Context) (any, error) {
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
)
|
||||
|
||||
type day2Scanner struct {
|
||||
|
||||
@ -6,7 +6,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
)
|
||||
|
||||
func Day3Part1(ctx aoc.Context) (any, error) {
|
||||
|
||||
@ -3,7 +3,7 @@ package year25
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
"git.bizdoc.ro/private/devkit.git/collections/geometry/v2"
|
||||
)
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
)
|
||||
|
||||
type Day5Interval struct {
|
||||
|
||||
@ -9,6 +9,7 @@ const [start, end] = [0, 1]
|
||||
function part1(input: string): number {
|
||||
const [db, ids] = parseInput(input)
|
||||
return ids.filter(currentId => {
|
||||
// @ts-ignore
|
||||
return db.find(id => id[start] <= currentId && id[end] >= currentId)
|
||||
}).length
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
"git.bizdoc.ro/private/devkit.git/collections/geometry/v2"
|
||||
)
|
||||
|
||||
|
||||
@ -4,8 +4,6 @@ import (
|
||||
"fmt"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aocutils"
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/year25/day7_pg"
|
||||
"git.bizdoc.ro/private/devkit.git/collections/geometry/v2"
|
||||
)
|
||||
|
||||
@ -79,14 +77,3 @@ func Day7Part2(c aoc.Context) (int, error) {
|
||||
}
|
||||
return fill(g, h, start), nil
|
||||
}
|
||||
|
||||
func Day7Part1Render(c aoc.Context) (int, error) {
|
||||
g, start, err := day7ParseInput(c)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("day7: failed to parse input %w", err)
|
||||
}
|
||||
var ev day7_pg.Day7Part1RenderEvent
|
||||
for ev = range day7_pg.Day7ProgressFillPart1(g, start) {
|
||||
}
|
||||
return int(ev.TotalProcessed), nil
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package day7_pg
|
||||
import (
|
||||
"iter"
|
||||
|
||||
"git.bizdoc.ro/gabi-public/Advent-of-Code.git/aoc"
|
||||
"git.bizdoc.ro/private/devkit.git/collections/dsa"
|
||||
"git.bizdoc.ro/private/devkit.git/collections/geometry/v2"
|
||||
)
|
||||
@ -46,3 +47,15 @@ func Day7ProgressFillPart1(g geometry.Grid[byte], start geometry.Point) iter.Seq
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func Day7Part1Render(c aoc.Context) (int, error) {
|
||||
panic("not implmented")
|
||||
//g, start, err := day7ParseInput(c)
|
||||
//if err != nil {
|
||||
// return 0, fmt.Errorf("day7: failed to parse input %w", err)
|
||||
//}
|
||||
//var ev Day7Part1RenderEvent
|
||||
//for ev = range Day7ProgressFillPart1(g, start) {
|
||||
//}
|
||||
//return int(ev.TotalProcessed), nil
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user