chore: change module
Some checks failed
Go Bump / bump (push) Failing after 7s
Go Test / build (push) Successful in 33s

This commit is contained in:
xuu 2023-12-15 15:13:24 -07:00
parent a0d852416f
commit b97ecdc93c
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
17 changed files with 38 additions and 36 deletions

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { aoc.MustResult(aoc.Runner(run)) } func main() { aoc.MustResult(aoc.Runner(run)) }

View File

@ -8,7 +8,7 @@ import (
"strconv" "strconv"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { func main() {

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strconv" "strconv"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { aoc.MustResult(aoc.Runner(run)) } func main() { aoc.MustResult(aoc.Runner(run)) }
@ -56,7 +56,6 @@ func (tab symbolTab) scanSymbol(p partNumber) bool {
// 553079 // 553079
// 84363105 // 84363105
type result struct { type result struct {
valuePT1 int valuePT1 int
valuePT2 int valuePT2 int
@ -110,7 +109,7 @@ func run(scan *bufio.Scanner) (*result, error) {
return p.number return p.number
} }
return 0 return 0
}, parts...,) }, parts...)
sumGears := aoc.SumFunc( sumGears := aoc.SumFunc(
func(s *symbol) int { func(s *symbol) int {

View File

@ -7,7 +7,7 @@ import (
"strconv" "strconv"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
//go:embed input.txt //go:embed input.txt

View File

@ -8,8 +8,7 @@ import (
"strconv" "strconv"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { aoc.MustResult(aoc.Runner(run)) } func main() { aoc.MustResult(aoc.Runner(run)) }

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"sort" "sort"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { aoc.MustResult(aoc.Runner(run)) } func main() { aoc.MustResult(aoc.Runner(run)) }

View File

@ -6,7 +6,7 @@ import (
"os" "os"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { func main() {
@ -147,4 +147,3 @@ func (m nodeMap) SolvePT2(path []rune) uint64 {
} }
return aoc.LCM(loops...) return aoc.LCM(loops...)
} }

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
func main() { aoc.MustResult(aoc.Runner(run)) } func main() { aoc.MustResult(aoc.Runner(run)) }

View File

@ -5,7 +5,7 @@ import (
"fmt" "fmt"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
// var log = aoc.Log // var log = aoc.Log
@ -113,7 +113,8 @@ func (m *Path) readLine(text string) {
} }
func (m *Path) buildPath() int { func (m *Path) buildPath() int {
m.start() m.start()
for m.next() {} for m.next() {
}
return (len(m.p) + 1) / 2 return (len(m.p) + 1) / 2
} }
func (m *Path) start() { func (m *Path) start() {
@ -171,21 +172,27 @@ func (m *Path) next() bool {
} }
} }
if n == nil { if n == nil {
return false return false
} }
if n.value == 'S' { if n.value == 'S' {
last := n.whence last := n.whence
next := m.head.left.whence next := m.head.left.whence
switch last<<4|next { switch last<<4 | next {
case UP<<4|UP, DN<<4|DN: m.head.value = '|' // UP UP, DN DN case UP<<4 | UP, DN<<4 | DN:
case LF<<4|LF, RT<<4|RT: m.head.value = '-' // LF LF, RT RT m.head.value = '|' // UP UP, DN DN
case LF<<4 | LF, RT<<4 | RT:
m.head.value = '-' // LF LF, RT RT
case UP<<4|RT, LF<<4|DN: m.head.value = 'J' // UP RT, LT DN case UP<<4 | RT, LF<<4 | DN:
case UP<<4|LF, RT<<4|DN: m.head.value = 'L' // UP RT, RT DN m.head.value = 'J' // UP RT, LT DN
case UP<<4 | LF, RT<<4 | DN:
m.head.value = 'L' // UP RT, RT DN
case DN<<4|RT, LF<<4|UP: m.head.value = '7' // DN LF, LF UP case DN<<4 | RT, LF<<4 | UP:
case RT<<4|UP, DN<<4|LF: m.head.value = 'F' // DN LF, RT UP m.head.value = '7' // DN LF, LF UP
case RT<<4 | UP, DN<<4 | LF:
m.head.value = 'F' // DN LF, RT UP
} }
return false return false
@ -193,7 +200,6 @@ func (m *Path) next() bool {
m.add(n) m.add(n)
return true return true
} }
@ -201,7 +207,7 @@ const (
ST int8 = iota ST int8 = iota
UP UP
DN DN
LF LF
RT RT
) )

View File

@ -7,7 +7,7 @@ import (
"sort" "sort"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
// var log = aoc.Log // var log = aoc.Log
@ -194,4 +194,4 @@ func all(m map[int]bool) []int {
return lis return lis
} }
func fromXY(x, y, w int) int { return y*w + x } func fromXY(x, y, w int) int { return y*w + x }
func toXY(i, w int) [2]int { return [2]int{i % w, i / w} } func toXY(i, w int) [2]int { return [2]int{i % w, i / w} }

View File

@ -7,7 +7,7 @@ import (
"slices" "slices"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
// var log = aoc.Log // var log = aoc.Log
@ -107,7 +107,7 @@ func countPossible(s []rune, c []int) int {
for len(cstates) > 0 { for len(cstates) > 0 {
for st, num := range cstates { for st, num := range cstates {
si, ci, cc, expdot := st.springIndex, st.groupIndex, st.continuous, st.expectDot si, ci, cc, expdot := st.springIndex, st.groupIndex, st.continuous, st.expectDot
// have we reached the end? // have we reached the end?
if si == len(s) { if si == len(s) {
if ci == len(c) { if ci == len(c) {

View File

@ -7,7 +7,7 @@ import (
_ "embed" _ "embed"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
"github.com/matryer/is" "github.com/matryer/is"
) )

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
var log = aoc.Log var log = aoc.Log

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
"golang.org/x/exp/maps" "golang.org/x/exp/maps"
) )
@ -132,7 +132,6 @@ func reverse(m Map) Map {
} }
return m return m
} }
func cycle(m Map) (Map, [5]int) { func cycle(m Map) (Map, [5]int) {
var current [5]int var current [5]int

View File

@ -7,7 +7,7 @@ import (
"slices" "slices"
"strings" "strings"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
var log = aoc.Log var log = aoc.Log
@ -129,7 +129,7 @@ func (lis boxes) Sum() int {
var sum int var sum int
for b := range lis { for b := range lis {
for s := range lis[b] { for s := range lis[b] {
sum += (b+1) * (s+1) * lis[b][s].value sum += (b + 1) * (s + 1) * lis[b][s].value
} }
} }
return sum return sum

2
go.mod
View File

@ -1,4 +1,4 @@
module go.sour.is/advent-of-code-2023 module go.sour.is/advent-of-code
go 1.21.4 go 1.21.4

View File

@ -5,7 +5,7 @@ import (
_ "embed" _ "embed"
"fmt" "fmt"
aoc "go.sour.is/advent-of-code-2023" aoc "go.sour.is/advent-of-code"
) )
// var log = aoc.Log // var log = aoc.Log